From fff9d8014d26a903c15ef2df1a8699b50955d5fb Mon Sep 17 00:00:00 2001 From: xile611 Date: Tue, 6 Aug 2024 10:16:35 +0000 Subject: [PATCH 01/35] docs: generate changelog of release v1.11.11 --- docs/assets/changelog/en/release.md | 31 ++++++++++++++++++++ docs/assets/changelog/zh/release.md | 31 ++++++++++++++++++++ packages/harmony_vchart/library/CHANGELOG.md | 31 ++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index 71b4029d45..f2e4640f2f 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,34 @@ +# v1.11.11 + +2024-08-06 + + +**🆕 New feature** + +- **@visactor/vchart**: label line support custom path. close[#3000](https://github.com/VisActor/VChart/issues/3000) +- **@visactor/vchart**: upgrade vrender to 0.19.20, to support `catmullRom` and `catmullRomClosed` curveType, related [#2610](https://github.com/VisActor/VChart/issues/2610) + +**🐛 Bug fix** + +- **@visactor/vchart**: fix crosshair of histogram, fix [#2826](https://github.com/VisActor/VChart/issues/2826) +- **@visactor/vchart**: use `vglobal.getElementById` to replace `document.getElementById` +- **@visactor/vchart**: liquid gradient not work after reverse +- **@visactor/vchart**: add group mark to fix gradient color bug of liquid and add rect shape to fix rect symbol padding bug +- **@visactor/vchart**: fix `lockAfterClick` of tooltip, related [#1574](https://github.com/VisActor/VChart/issues/1574) +- **@visactor/vchart**: prevent trigger original event in panEnd composite event [#2931](https://github.com/VisActor/VChart/issues/2931) +- **@visactor/vchart**: charts should not stack when only specify `stackValue` but `stack` is false, fix [#3005](https://github.com/VisActor/VChart/issues/3005) +- **@visactor/vchart**: `updateData` incorrect with datazoom, related [#3041](https://github.com/VisActor/VChart/issues/3041) +- **@visactor/vchart**: fix issue of `updateSpec` when visible of grid in axis change, fix [#3004](https://github.com/VisActor/VChart/issues/3004) +- **@visactor/vchart**: fix fontFamily when update theme, fix [#3028](https://github.com/VisActor/VChart/issues/3028) + +**🔖 other** + +- **@visactor/vchart**: fix:curveType `monotone` in seriesStyle not work + + + +[more detail about v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) + # v1.11.10 2024-07-24 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 27b15808c4..1c2d6fcbc1 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,34 @@ +# v1.11.11 + +2024-08-06 + + +**🆕 新增功能** + +- **@visactor/vchart**: label line support custom path. close[#3000](https://github.com/VisActor/VChart/issues/3000) +- **@visactor/vchart**: upgrade vrender to 0.19.20, to support `catmullRom` and `catmullRomClosed` curveType, related [#2610](https://github.com/VisActor/VChart/issues/2610) + +**🐛 功能修复** + +- **@visactor/vchart**: fix crosshair of histogram, fix [#2826](https://github.com/VisActor/VChart/issues/2826) +- **@visactor/vchart**: use `vglobal.getElementById` to replace `document.getElementById` +- **@visactor/vchart**: liquid gradient not work after reverse +- **@visactor/vchart**: add group mark to fix gradient color bug of liquid and add rect shape to fix rect symbol padding bug +- **@visactor/vchart**: fix `lockAfterClick` of tooltip, related [#1574](https://github.com/VisActor/VChart/issues/1574) +- **@visactor/vchart**: prevent trigger original event in panEnd composite event [#2931](https://github.com/VisActor/VChart/issues/2931) +- **@visactor/vchart**: charts should not stack when only specify `stackValue` but `stack` is false, fix [#3005](https://github.com/VisActor/VChart/issues/3005) +- **@visactor/vchart**: `updateData` incorrect with datazoom, related [#3041](https://github.com/VisActor/VChart/issues/3041) +- **@visactor/vchart**: fix issue of `updateSpec` when visible of grid in axis change, fix [#3004](https://github.com/VisActor/VChart/issues/3004) +- **@visactor/vchart**: fix fontFamily when update theme, fix [#3028](https://github.com/VisActor/VChart/issues/3028) + +**🔖 其他** + +- **@visactor/vchart**: fix:curveType `monotone` in seriesStyle not work + + + +[更多详情请查看 v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) + # v1.11.10 2024-07-24 diff --git a/packages/harmony_vchart/library/CHANGELOG.md b/packages/harmony_vchart/library/CHANGELOG.md index 22cdcd7698..9a030c2f7e 100644 --- a/packages/harmony_vchart/library/CHANGELOG.md +++ b/packages/harmony_vchart/library/CHANGELOG.md @@ -1,3 +1,34 @@ +# v1.11.11 + +2024-08-06 + + +**🆕 New feature** + +- **@visactor/vchart**: label line support custom path. close[#3000](https://github.com/VisActor/VChart/issues/3000) +- **@visactor/vchart**: upgrade vrender to 0.19.20, to support `catmullRom` and `catmullRomClosed` curveType, related [#2610](https://github.com/VisActor/VChart/issues/2610) + +**🐛 Bug fix** + +- **@visactor/vchart**: fix crosshair of histogram, fix [#2826](https://github.com/VisActor/VChart/issues/2826) +- **@visactor/vchart**: use `vglobal.getElementById` to replace `document.getElementById` +- **@visactor/vchart**: liquid gradient not work after reverse +- **@visactor/vchart**: add group mark to fix gradient color bug of liquid and add rect shape to fix rect symbol padding bug +- **@visactor/vchart**: fix `lockAfterClick` of tooltip, related [#1574](https://github.com/VisActor/VChart/issues/1574) +- **@visactor/vchart**: prevent trigger original event in panEnd composite event [#2931](https://github.com/VisActor/VChart/issues/2931) +- **@visactor/vchart**: charts should not stack when only specify `stackValue` but `stack` is false, fix [#3005](https://github.com/VisActor/VChart/issues/3005) +- **@visactor/vchart**: `updateData` incorrect with datazoom, related [#3041](https://github.com/VisActor/VChart/issues/3041) +- **@visactor/vchart**: fix issue of `updateSpec` when visible of grid in axis change, fix [#3004](https://github.com/VisActor/VChart/issues/3004) +- **@visactor/vchart**: fix fontFamily when update theme, fix [#3028](https://github.com/VisActor/VChart/issues/3028) + +**🔖 other** + +- **@visactor/vchart**: fix:curveType `monotone` in seriesStyle not work + + + +[more detail about v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) + # v1.11.10 2024-07-24 From e11029143a89655d244a01c0e9056d9a9dce7c05 Mon Sep 17 00:00:00 2001 From: xile611 Date: Tue, 6 Aug 2024 18:31:30 +0800 Subject: [PATCH 02/35] docs: update changelog of 1.11.11 --- docs/assets/changelog/en/release.md | 81 ++++++++++++++--------------- docs/assets/changelog/zh/release.md | 61 +++++++++++----------- 2 files changed, 70 insertions(+), 72 deletions(-) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index f2e4640f2f..0b3bfd1ff5 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,14 +1,14 @@ -# v1.11.11 - -2024-08-06 - - -**🆕 New feature** +# v1.11.11 + +2024-08-06 + + +**🆕 New feature** - **@visactor/vchart**: label line support custom path. close[#3000](https://github.com/VisActor/VChart/issues/3000) - **@visactor/vchart**: upgrade vrender to 0.19.20, to support `catmullRom` and `catmullRomClosed` curveType, related [#2610](https://github.com/VisActor/VChart/issues/2610) - -**🐛 Bug fix** + +**🐛 Bug fix** - **@visactor/vchart**: fix crosshair of histogram, fix [#2826](https://github.com/VisActor/VChart/issues/2826) - **@visactor/vchart**: use `vglobal.getElementById` to replace `document.getElementById` @@ -20,54 +20,53 @@ - **@visactor/vchart**: `updateData` incorrect with datazoom, related [#3041](https://github.com/VisActor/VChart/issues/3041) - **@visactor/vchart**: fix issue of `updateSpec` when visible of grid in axis change, fix [#3004](https://github.com/VisActor/VChart/issues/3004) - **@visactor/vchart**: fix fontFamily when update theme, fix [#3028](https://github.com/VisActor/VChart/issues/3028) - -**🔖 other** - - **@visactor/vchart**: fix:curveType `monotone` in seriesStyle not work - - -[more detail about v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) - -# v1.11.10 - -2024-07-24 - - -**🆕 New feature** + + + + +[more detail about v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) + +# v1.11.10 + +2024-07-24 + + +**🆕 New feature** - **@visactor/vchart**: liquid support reverse and target mark. close [#2977](https://github.com/VisActor/VChart/issues/2977) & close [#2978](https://github.com/VisActor/VChart/issues/2978) - **@visactor/vchart**: add `totalScale` params in geo zoom event - **@visactor/vchart**: support `geoZoomByIndex`/`geoZoomById` API, close [#2925](https://github.com/VisActor/VChart/issues/2925) - **@visactor/vchart**: marker label background support custom path. close [#2959](https://github.com/VisActor/VChart/issues/2959) - -**🐛 Bug fix** + +**🐛 Bug fix** - **@visactor/vchart**: prevent issue with ios bug while pointEvent is configed - **@visactor/vchart**: liquid gradient not work after reverse - **@visactor/vchart**: prevent trigger original event in zoomEnd composite event [#2931](https://github.com/VisActor/VChart/issues/2931) - **@visactor/vchart**: fix error of setDimentionIndex when dimension axis is linear - -**🔧 Configuration releated** + +**🔧 Configuration releated** - **@visactor/vchart**: update rollup.config.js to fix es5/index.js, fix [#2971](https://github.com/VisActor/VChart/issues/2971) - - -[more detail about v1.11.10](https://github.com/VisActor/VChart/releases/tag/v1.11.10) - -# v1.11.9 - -2024-07-17 - - -**🆕 New feature** + + +[more detail about v1.11.10](https://github.com/VisActor/VChart/releases/tag/v1.11.10) + +# v1.11.9 + +2024-07-17 + + +**🆕 New feature** * @visactor/vchart: tooltip theme support transition duration - -**🐛 Bug fix** + +**🐛 Bug fix** * @visactor/vchart: fix statistics confict of linear and discrete field, close [#2926](https://github.com/VisActor/VChart/issues/2926) @@ -77,10 +76,10 @@ * @visactor/vchart: react attributes should support react 17 * @visactor/vchart: fix height of link when set `minNodeHeight` of sankey - - -[more detail about v1.11.9](https://github.com/VisActor/VChart/releases/tag/v1.11.9) - + + +[more detail about v1.11.9](https://github.com/VisActor/VChart/releases/tag/v1.11.9) + # v1.11.7 2024-07-06 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 1c2d6fcbc1..58010fada1 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,34 +1,33 @@ -# v1.11.11 - -2024-08-06 - - -**🆕 新增功能** - -- **@visactor/vchart**: label line support custom path. close[#3000](https://github.com/VisActor/VChart/issues/3000) -- **@visactor/vchart**: upgrade vrender to 0.19.20, to support `catmullRom` and `catmullRomClosed` curveType, related [#2610](https://github.com/VisActor/VChart/issues/2610) - -**🐛 功能修复** - -- **@visactor/vchart**: fix crosshair of histogram, fix [#2826](https://github.com/VisActor/VChart/issues/2826) -- **@visactor/vchart**: use `vglobal.getElementById` to replace `document.getElementById` -- **@visactor/vchart**: liquid gradient not work after reverse -- **@visactor/vchart**: add group mark to fix gradient color bug of liquid and add rect shape to fix rect symbol padding bug -- **@visactor/vchart**: fix `lockAfterClick` of tooltip, related [#1574](https://github.com/VisActor/VChart/issues/1574) -- **@visactor/vchart**: prevent trigger original event in panEnd composite event [#2931](https://github.com/VisActor/VChart/issues/2931) -- **@visactor/vchart**: charts should not stack when only specify `stackValue` but `stack` is false, fix [#3005](https://github.com/VisActor/VChart/issues/3005) -- **@visactor/vchart**: `updateData` incorrect with datazoom, related [#3041](https://github.com/VisActor/VChart/issues/3041) -- **@visactor/vchart**: fix issue of `updateSpec` when visible of grid in axis change, fix [#3004](https://github.com/VisActor/VChart/issues/3004) -- **@visactor/vchart**: fix fontFamily when update theme, fix [#3028](https://github.com/VisActor/VChart/issues/3028) - -**🔖 其他** - -- **@visactor/vchart**: fix:curveType `monotone` in seriesStyle not work - - - -[更多详情请查看 v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) - +# v1.11.11 + +2024-08-06 + + +**🆕 新增功能** + +- **@visactor/vchart**: 标签引导线支持自定义形状,关闭[#3000](https://github.com/VisActor/VChart/issues/3000) +- **@visactor/vchart**: 新增曲线插值算法`catmullRom` 和 `catmullRomClosed`,相关issue[#2610](https://github.com/VisActor/VChart/issues/2610) + + +**🐛 功能修复** + +- **@visactor/vchart**: 修复直方图crosshair不展示的问题, 关闭 [#2826](https://github.com/VisActor/VChart/issues/2826) +- **@visactor/vchart**: 使用 `vglobal.getElementById` 替代 `document.getElementById`,修复小程序报错问题 +- **@visactor/vchart**: 修复水波图反转后不支持渐变色的问题 +- **@visactor/vchart**: 优化水波图渐变色效果 +- **@visactor/vchart**: 修复tooltip `lockAfterClick` 配置不生效的问题,相关issue [#1574](https://github.com/VisActor/VChart/issues/1574) +- **@visactor/vchart**: 在`panEnd` 事件完成前,阻止默认事件,相关issue [#2931](https://github.com/VisActor/VChart/issues/2931) +- **@visactor/vchart**: 当申明了 `stackValue` ,但是配置`stack` 为`false`的时候,图表不应该堆积, 修复[#3005](https://github.com/VisActor/VChart/issues/3005) +- **@visactor/vchart**: 修复`updateData` 在存在 datazoom组件时,更新错误的问题, 相关issue [#3041](https://github.com/VisActor/VChart/issues/3041) +- **@visactor/vchart**: 修复坐标轴网格线显示/隐藏切换时,图表不更新的问题,修复[#3004](https://github.com/VisActor/VChart/issues/3004) +- **@visactor/vchart**: 修复更新主题中`fontFamily` 时,更新不生效的问题,修复 [#3028](https://github.com/VisActor/VChart/issues/3028) + +- **@visactor/vchart**: 修复`seriesStyle`配置`monotone` 不生效的问题 + + + +[更多详情请查看 v1.11.11](https://github.com/VisActor/VChart/releases/tag/v1.11.11) + # v1.11.10 2024-07-24 From eacf6e0dc9eb2c7db0b5a3efd68c345efcd62638 Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Wed, 7 Aug 2024 19:27:17 +0800 Subject: [PATCH 03/35] fix: supply interface defination, related #3024 --- packages/vchart/src/core/interface.ts | 66 +++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/packages/vchart/src/core/interface.ts b/packages/vchart/src/core/interface.ts index 79cce2c6e1..58f54d440c 100644 --- a/packages/vchart/src/core/interface.ts +++ b/packages/vchart/src/core/interface.ts @@ -24,7 +24,7 @@ import type { ITheme } from '../theme'; import type { IComponent } from '../component/interface'; import type { LayoutCallBack } from '../layout/interface'; import type { Compiler } from '../compile/compiler'; -import type { IChart, IChartSpecInfo } from '../chart/interface'; +import type { DimensionIndexOption, IChart, IChartSpecInfo } from '../chart/interface'; import type { Stage } from '@visactor/vrender-core'; import type { IContainerSize } from '@visactor/vrender-components'; import type { IBaseScale } from '@visactor/vscale'; @@ -69,7 +69,7 @@ export interface IVChart { * @param morphConfig 图表 morph 动画配置,可选 * @returns VChart 实例 */ - renderSync: (morphConfig?: IMorphConfig, resetMediaQuery?: boolean) => IVChart; + renderSync: (morphConfig?: IMorphConfig) => IVChart; /** * **异步**渲染图表。 @@ -77,10 +77,11 @@ export interface IVChart { * @param morphConfig 图表 morph 动画配置,可选 * @returns VChart 实例 */ - renderAsync: (morphConfig?: IMorphConfig, resetMediaQuery?: boolean) => Promise; + renderAsync: (morphConfig?: IMorphConfig) => Promise; /** * **异步**更新数据。 + * @async * @param id 数据 id * @param data 数据值 * @param options 数据参数 @@ -90,6 +91,7 @@ export interface IVChart { /** * **异步**批量更新数据。 + * @async * @param list 待更新的数据列表 * @returns VChart 实例 */ @@ -106,12 +108,22 @@ export interface IVChart { /** * **同步方法** 更新数据 + * @async * @param data 图表配置结构中的数据对象 * @returns VChart 实例 */ updateFullDataSync: (data: IDataValues | IDataValues[], reRender?: boolean) => IVChart; + + /** + * **同步方法** 更新数据 + * @param data 图表配置结构中的数据对象 + * @returns VChart 实例 + */ + updateFullData: (data: IDataValues | IDataValues[], reRender?: boolean) => Promise; + /** * **异步**spec 更新。 + * @sync * @param spec * @param forceMerge * @returns @@ -142,7 +154,7 @@ export interface IVChart { * @param spec * @param forceMerge * @returns - * @sync 1.4.0 + * @since 1.4.0 */ updateModelSpecSync: ( filter: string | { type: string; index: number }, @@ -153,11 +165,12 @@ export interface IVChart { /** * **异步方法** 模块 spec 更新 + * @async * @param filter * @param spec * @param forceMerge * @returns - * @sync 1.4.0 + * @since 1.4.0 */ updateModelSpec: ( filter: string | { type: string; index: number }, @@ -179,6 +192,7 @@ export interface IVChart { /** * **异步方法**,图表尺寸更新方法。 + * @async * @param width 宽度 * @param height 高度 * @returns VChart 当前实例 @@ -431,6 +445,14 @@ export interface IVChart { */ getScale: (scaleId: string) => IBaseScale | null; + /** + * 手动调用触发 dimension 交互效果。 + * @param datum dimension 值 + * @param options 触发配置 + * @returns + */ + setDimensionIndex: (value: StringOrNumber, options?: DimensionIndexOption) => void; + // 数据转换相关的 api /** * Convert the data to coordinate position @@ -465,6 +487,40 @@ export interface IVChart { isRelativeToCanvas?: boolean ) => IPoint | null); + /** + * 根据 indicator 组件 id 更新 indicator 数据 + * @param id spec 中定义的 indicator id + * @param datum 具体数据项 + * @since 1.11.7 + */ + updateIndicatorDataById: (id: string, datum?: Datum) => void; + + /** + * 根据 indicator 组件 id 更新 indicator 数据 + * @param index indicator 索引下标 + * @param datum 具体数据项 + * @since 1.11.7 + */ + updateIndicatorDataByIndex: (index?: number, datum?: Datum) => void; + + /** + * 地图缩放 API + * @param [regionIndex=0] 根据索引顺序指定某个 region 区域的地图坐标系进行缩放 + * @param zoom 缩放比例 + * @param center 缩放中心 + * @since 1.11.10 + */ + geoZoomByIndex: (regionIndex: number, zoom: number, center?: { x: number; y: number }) => void; + + /** + * 地图缩放 API + * @param 根据 region id 指定某个 region 区域的地图坐标系进行缩放 + * @param zoom 缩放比例 + * @param center 缩放中心 + * @since 1.11.10 + */ + geoZoomById: (regionId: string | number, zoom: number, center?: { x: number; y: number }) => void; + /** 停止正在进行的所有动画 */ stopAnimation: () => void; From c3aa1f830e65f58b73f392399f3bd99ee09de8c2 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 12:17:00 +0800 Subject: [PATCH 04/35] feat: support `layoutRadius` of pie --- .../src/chart/pie/base/pie-transformer.ts | 3 +- packages/vchart/src/chart/polar/interface.ts | 5 ++- .../vchart/src/component/axis/polar/axis.ts | 40 +++++-------------- .../component/axis/polar/interface/spec.ts | 5 ++- .../src/component/axis/polar/util/common.ts | 26 +++++++++++- packages/vchart/src/series/pie/interface.ts | 7 ++++ packages/vchart/src/series/pie/pie.ts | 15 ++++++- 7 files changed, 64 insertions(+), 37 deletions(-) diff --git a/packages/vchart/src/chart/pie/base/pie-transformer.ts b/packages/vchart/src/chart/pie/base/pie-transformer.ts index c28da7e54b..6400eb8fd0 100644 --- a/packages/vchart/src/chart/pie/base/pie-transformer.ts +++ b/packages/vchart/src/chart/pie/base/pie-transformer.ts @@ -23,7 +23,8 @@ export class BasePieChartSpecTransformer extends PolarC cornerRadius: spec.cornerRadius, padAngle: spec.padAngle, - minAngle: spec.minAngle + minAngle: spec.minAngle, + layoutRadius: spec.layoutRadius }; } } diff --git a/packages/vchart/src/chart/polar/interface.ts b/packages/vchart/src/chart/polar/interface.ts index 43a119d6f7..c0e57bd2fe 100644 --- a/packages/vchart/src/chart/polar/interface.ts +++ b/packages/vchart/src/chart/polar/interface.ts @@ -1,6 +1,7 @@ +import type { IPointLike } from '@visactor/vutils'; import type { IPolarAxisSpec } from '../../component/axis/polar/interface'; import type { IPolarCrosshairSpec } from '../../component/crosshair/interface'; -import type { IChartSpec, ILayoutRect, IPoint } from '../../typings'; +import type { IChartSpec, ILayoutRect } from '../../typings'; export interface IPolarChartSpec extends IChartSpec { /** @@ -17,5 +18,5 @@ export interface IPolarChartSpec extends IChartSpec { /** * @since 1.11.2 */ - layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPoint) => number); + layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPointLike) => number); } diff --git a/packages/vchart/src/component/axis/polar/axis.ts b/packages/vchart/src/component/axis/polar/axis.ts index 9056058e01..44923b14af 100644 --- a/packages/vchart/src/component/axis/polar/axis.ts +++ b/packages/vchart/src/component/axis/polar/axis.ts @@ -25,22 +25,12 @@ import { isPolarAxisSeries } from '../../../series/util/utils'; import { getAxisItem, getAxisLabelOffset, isValidPolarAxis } from '../util'; import type { Dict, Maybe } from '@visactor/vutils'; // eslint-disable-next-line no-duplicate-imports -import { - PointService, - degreeToRadian, - isValid, - isArray, - isValidNumber, - isNumber, - isFunction, - calculateMaxRadius, - polarToCartesian -} from '@visactor/vutils'; +import { PointService, degreeToRadian, isValid, isArray, isValidNumber, polarToCartesian } from '@visactor/vutils'; import type { IEffect, IModelSpecInfo } from '../../../model/interface'; import { AxisComponent } from '../base-axis'; import type { IBandAxisSpec, ITick } from '../interface'; import { HOOK_EVENT } from '@visactor/vgrammar-core'; -import { getPolarAxisInfo } from './util'; +import { computeLayoutRadius, getPolarAxisInfo } from './util'; // eslint-disable-next-line no-duplicate-imports import { mergeSpec } from '@visactor/vutils-extension'; import { calcLayoutNumber } from '../../../util/space'; @@ -529,21 +519,13 @@ export abstract class PolarAxis 0 && height > 0) { - return calculateMaxRadius(layoutRect, this.getCenter(), this._startAngle, this._endAngle); - } - - return Math.min(width / 2, height / 2); + return computeLayoutRadius( + this._spec.layoutRadius, + this.getRefLayoutRect, + this.getCenter, + this._startAngle, + this._endAngle + ); } private computeLayoutOuterRadius() { @@ -561,9 +543,9 @@ export abstract class PolarAxis { return this.getRegions()[0].getLayoutRect(); - } + }; private getRefSeriesRadius() { let outerRadius: number = POLAR_DEFAULT_RADIUS; diff --git a/packages/vchart/src/component/axis/polar/interface/spec.ts b/packages/vchart/src/component/axis/polar/interface/spec.ts index 3c1382e1f2..dfdfd33580 100644 --- a/packages/vchart/src/component/axis/polar/interface/spec.ts +++ b/packages/vchart/src/component/axis/polar/interface/spec.ts @@ -1,4 +1,5 @@ -import type { ILayoutRect, IPoint, IPolarOrientType } from '../../../../typings'; +import type { IPointLike } from '@visactor/vutils'; +import type { ILayoutRect, IPolarOrientType } from '../../../../typings'; import type { IBandAxisSpec, IDomainLine, ILinearAxisSpec, ITitle, ILabel, ICommonAxisSpec } from '../../interface'; import type { IPolarGrid } from './common'; @@ -11,7 +12,7 @@ export type IPolarAxisCommonSpec = Omit & { * 默认值为: region宽度、高度最小值的一般 * @since 1.11.2 */ - layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPoint) => number); + layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPointLike) => number); /** * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴展示在内圆。 * @default false diff --git a/packages/vchart/src/component/axis/polar/util/common.ts b/packages/vchart/src/component/axis/polar/util/common.ts index 2f16553062..36f96ca294 100644 --- a/packages/vchart/src/component/axis/polar/util/common.ts +++ b/packages/vchart/src/component/axis/polar/util/common.ts @@ -1,7 +1,9 @@ -import { isValid } from '@visactor/vutils'; +import { calculateMaxRadius, isFunction, isNumber, isValid } from '@visactor/vutils'; import { POLAR_DEFAULT_RADIUS, POLAR_END_ANGLE, POLAR_START_ANGLE } from '../../../../constant'; import { ComponentTypeEnum } from '../../../interface'; import type { IPolarAxisCommonSpec } from '../interface'; +import type { ILayoutRect } from '../../../../typings/layout'; +import type { IPoint } from '../../../../typings/coordinate'; export const getPolarAxisInfo = (spec: IPolarAxisCommonSpec, chartSpec: any) => { // TODO: 基于数据处理 axis 类型 @@ -28,3 +30,25 @@ export const getPolarAxisInfo = (spec: IPolarAxisCommonSpec, chartSpec: any) => layoutRadius: chartSpec.layoutRadius }; }; + +export const computeLayoutRadius = ( + layoutRadius: 'auto' | number | ((layoutRect: ILayoutRect, center: IPoint) => number), + getLayoutRect: () => ILayoutRect, + getCenter: () => IPoint, + startAngle: number = 0, + endAngle: number = 0 * Math.PI +) => { + if (isNumber(layoutRadius)) { + return layoutRadius; + } else if (isFunction(layoutRadius)) { + return layoutRadius(getLayoutRect(), getCenter()); + } + + const rect = getLayoutRect(); + + if (layoutRadius === 'auto' && rect.width > 0 && rect.height > 0) { + return calculateMaxRadius(rect, getCenter(), startAngle, endAngle); + } + + return Math.min(rect.width / 2, rect.height / 2); +}; diff --git a/packages/vchart/src/series/pie/interface.ts b/packages/vchart/src/series/pie/interface.ts index e3fb353afe..1d210e0e60 100644 --- a/packages/vchart/src/series/pie/interface.ts +++ b/packages/vchart/src/series/pie/interface.ts @@ -6,6 +6,8 @@ import type { IPolarSeriesSpec, IPolarSeriesTheme } from '../polar/interface'; import type { PieAppearPreset } from './animation/animation'; import type { ILabelSpec, IMultiLabelSpec } from '../../component/label'; import type { ICustomPath2D, ILineGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core'; +import type { ILayoutRect } from '../../typings/layout'; +import type { IPointLike } from '@visactor/vutils'; export type PieMarks = 'pie' | 'label' | 'labelLine'; @@ -73,6 +75,11 @@ export interface IPieSeriesSpec extends IPolarSeriesSpec, IAnimationSpec number); + /** 扇区样式 */ [SeriesMarkNameEnum.pie]?: IMarkSpec; /** 标签配置 */ diff --git a/packages/vchart/src/series/pie/pie.ts b/packages/vchart/src/series/pie/pie.ts index 7aa5754b3a..19eb8e583f 100644 --- a/packages/vchart/src/series/pie/pie.ts +++ b/packages/vchart/src/series/pie/pie.ts @@ -49,6 +49,7 @@ import { pieSeriesMark } from './constant'; import { Factory } from '../../core/factory'; import { isNil, polarToCartesian } from '@visactor/vutils'; import { PieSeriesSpecTransformer } from './pie-transformer'; +import { computeLayoutRadius } from '../../component/axis/polar/util/common'; export class BasePieSeries extends PolarSeries implements IArcSeries { static readonly transformerConstructor = PieSeriesSpecTransformer as any; @@ -62,13 +63,13 @@ export class BasePieSeries extends PolarSeries protected _viewDataLabel!: SeriesData; // 饼图渲染不依赖于极坐标系轴,因此由 series 自己存储相关配置信息 - getCenter(): IPoint { + getCenter = (): IPoint => { const { width, height } = this._region.getLayoutRect(); return { x: this._spec?.centerX ?? width / 2, y: this._spec?.centerY ?? height / 2 }; - } + }; protected _centerOffset!: number; protected _cornerRadius!: number; @@ -184,6 +185,16 @@ export class BasePieSeries extends PolarSeries return field(ARC_END_ANGLE)(datum); } + protected _computeLayoutRadius() { + return computeLayoutRadius( + this._spec.layoutRadius, + this.getLayoutRect, + this.getCenter, + this._startAngle, + this._endAngle + ); + } + initMarkStyle(): void { const pieMark = this._pieMark; if (pieMark) { From 837843ba9a5280423c53a3e983c35fb7b219f951 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 12:21:30 +0800 Subject: [PATCH 05/35] docs: update changlog of rush --- .../feat-pie-layout-radius_2024-08-09-04-21.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json diff --git a/common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json b/common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json new file mode 100644 index 0000000000..1609b555d9 --- /dev/null +++ b/common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "feat: support `layoutRadius` of pie\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From fb1f1a153c67f814b19153fd73d108c1f954c15f Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 12:35:57 +0800 Subject: [PATCH 06/35] docs: update docs of `layoutRadius` in pie --- docs/assets/option/en/series/pie.md | 22 ++++++++++++++++------ docs/assets/option/zh/series/pie.md | 24 +++++++++++++++++------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/docs/assets/option/en/series/pie.md b/docs/assets/option/en/series/pie.md index 6a3239721d..a07ff3fb3b 100644 --- a/docs/assets/option/en/series/pie.md +++ b/docs/assets/option/en/series/pie.md @@ -52,11 +52,25 @@ pie: { } ``` +#${prefix} layoutRadius(string|number|function) + +Introduced in version **1.11.12** + +The layout radius of the polar coordinate, which is the base value for calculating the inner and outer radii. The optional values are as follows: + +- Not set: The default value is `Math.min(width, height) / 2`, which is equivalent to this effect before version **1.11.2** +- `'auto'`: Automatically calculate the maximum available layout radius based on `center`, `startAngle`, and `endAngle` +- Custom function, the type definition of the function is as follows: + +```ts +(layoutRect: { width: number; height: number }, center: { x: number; y: number }) => number; +``` + #${prefix} outerRadius(number) Pie chart outer sector radius. The default value is 0.6. -#${prefix} outerRadius(number) +#${prefix} innerRadius(number) Pie chart inner sector radius. The default value is 0. @@ -191,11 +205,7 @@ The callback function is defined as follows: * @params path object, user-defined drawing * @return Returns the path after drawing is completed */ -( - text: ITextGraphicAttribute, - attrs: Partial, - path: ICustomPath2D -) => ICustomPath2D; +(text: ITextGraphicAttribute, attrs: Partial, path: ICustomPath2D) => ICustomPath2D; ``` ###${prefix} style(Object) diff --git a/docs/assets/option/zh/series/pie.md b/docs/assets/option/zh/series/pie.md index a89d14797f..72f87975d5 100644 --- a/docs/assets/option/zh/series/pie.md +++ b/docs/assets/option/zh/series/pie.md @@ -53,11 +53,25 @@ pie: { } ``` +#${prefix} layoutRadius(string|number|function) + +自 **1.11.12**版本开始支持 + +极坐标的布局半径,即计算内径、外径的基准值,可选值如下: + +- 不设置: 默认值为`Math.min(width, height) / 2`,**1.11.2**之前的版本相当于这个效果 +- `'auto'`: 根据`center`、`startAngle`、`endAngle`自动计算最大可用的布局半径 +- 自定义函数,函数的类型定义如下: + +```ts +(layoutRect: { width: number; height: number }, center: { x: number; y: number }) => number; +``` + #${prefix} outerRadius(number) 饼图扇区外半径。默认值为 0.6。 -#${prefix} outerRadius(number) +#${prefix} innerRadius(number) 饼图扇区内半径。默认值为 0。 @@ -181,7 +195,7 @@ pie: { ) }} ##${prefix} customShape(function) -自1.11.11版本, 标签引导线支持自定义path. +自 1.11.11 版本, 标签引导线支持自定义 path. 回调函数的定义如下: @@ -192,11 +206,7 @@ pie: { * @params path对象, 用户自定义绘制 * @return 返回绘制完成后的path */ -( - text: ITextGraphicAttribute, - attrs: Partial, - path: ICustomPath2D -) => ICustomPath2D; +(text: ITextGraphicAttribute, attrs: Partial, path: ICustomPath2D) => ICustomPath2D; ``` ###${prefix} style(Object) From fa8cce334e0a445dbb7e6f6b343b4eccad3e6633 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 13:29:42 +0800 Subject: [PATCH 07/35] fix: fix `padding` of region not work --- packages/vchart/src/layout/base-layout.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/vchart/src/layout/base-layout.ts b/packages/vchart/src/layout/base-layout.ts index 3044517204..f5984b51a8 100644 --- a/packages/vchart/src/layout/base-layout.ts +++ b/packages/vchart/src/layout/base-layout.ts @@ -285,9 +285,12 @@ export class Layout implements IBaseLayout { 0 ); regionItems.forEach(region => { + const width = regionWidth - region.layoutPaddingLeft - region.layoutPaddingRight; + const height = regionHeight - region.layoutPaddingTop - region.layoutPaddingBottom; + region.setLayoutRect({ - width: regionWidth, - height: regionHeight + width: width, + height: height }); region.setLayoutStartPosition({ From 4fab2811f559bb7c815977d0e2dfd43fa8af844c Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 13:30:17 +0800 Subject: [PATCH 08/35] docs: update changlog of rush --- .../vchart/feat-region-padding_2024-08-09-05-30.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json diff --git a/common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json b/common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json new file mode 100644 index 0000000000..79cee72f5c --- /dev/null +++ b/common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix `padding` of region not work\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From 1da75fa7f7c63f0970a234b47ff011a3eb9001c0 Mon Sep 17 00:00:00 2001 From: skie1997 Date: Fri, 9 Aug 2024 15:08:10 +0800 Subject: [PATCH 09/35] fix: brush error after legend filter. fix#3061 --- .../vchart/fix-brush-error_2024-08-09-07-07.json | 10 ++++++++++ packages/vchart/src/component/brush/brush.ts | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json diff --git a/common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json b/common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json new file mode 100644 index 0000000000..5f498c5a76 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "fix: brush error after legend filter. fix#3061", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file diff --git a/packages/vchart/src/component/brush/brush.ts b/packages/vchart/src/component/brush/brush.ts index a583b60b80..7cfe296c23 100644 --- a/packages/vchart/src/component/brush/brush.ts +++ b/packages/vchart/src/component/brush/brush.ts @@ -1,10 +1,9 @@ import { AttributeLevel, ChartEvent, LayoutZIndex } from '../../constant'; import { BaseComponent } from '../base/base-component'; -import type { IComponent, IComponentOption } from '../interface'; // eslint-disable-next-line no-duplicate-imports import { ComponentTypeEnum } from '../interface/type'; import { Brush as BrushComponent, IOperateType as BrushEvent } from '@visactor/vrender-components'; -import type { IBounds, IPointLike, Maybe } from '@visactor/vutils'; +import type { IPointLike, Maybe } from '@visactor/vutils'; // eslint-disable-next-line no-duplicate-imports import { array, isNil, polygonIntersectPolygon, isValid } from '@visactor/vutils'; import type { IModelRenderOption, IModelSpecInfo } from '../../model/interface'; @@ -136,7 +135,9 @@ export class Brush extends BaseComponent i protected _extendDatumOutOfBrush(elementsMap: { [elementKey: string]: IElement }) { const data = []; for (const elementKey in elementsMap) { - data.push(elementsMap[elementKey].data[0]); + // 图例筛选后, elementKey未更新, 导致data可能为null + // FIXME: brush透出的map维护有待优化 + data.push(elementsMap[elementKey].data?.[0]); } return data; } From 0054f653cb0757e3d7c85475dfa5ebb7dec5b8e2 Mon Sep 17 00:00:00 2001 From: skie1997 Date: Fri, 9 Aug 2024 15:14:11 +0800 Subject: [PATCH 10/35] chore: add notes --- packages/vchart/src/component/brush/brush.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vchart/src/component/brush/brush.ts b/packages/vchart/src/component/brush/brush.ts index 7cfe296c23..067df8d7de 100644 --- a/packages/vchart/src/component/brush/brush.ts +++ b/packages/vchart/src/component/brush/brush.ts @@ -136,7 +136,7 @@ export class Brush extends BaseComponent i const data = []; for (const elementKey in elementsMap) { // 图例筛选后, elementKey未更新, 导致data可能为null - // FIXME: brush透出的map维护有待优化 + // FIXME: brush透出的map维护逻辑有待优化 data.push(elementsMap[elementKey].data?.[0]); } return data; From fe22bf6f064831bf955adf9f9b9f71cdb57de252 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Fri, 9 Aug 2024 17:50:13 +0800 Subject: [PATCH 11/35] fix: fix issue with harmony event --- packages/vchart/src/util/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vchart/src/util/env.ts b/packages/vchart/src/util/env.ts index 0af8b9f54c..3e8da27820 100644 --- a/packages/vchart/src/util/env.ts +++ b/packages/vchart/src/util/env.ts @@ -18,5 +18,5 @@ export function isMobileLikeMode(mode: RenderMode) { } export function isMiniAppLikeMode(mode: RenderMode) { - return mode.includes('miniApp') || mode === 'lynx' || mode === 'wx'; + return mode.includes('miniApp') || mode === 'lynx' || mode === 'wx' || mode === 'harmony'; } From 90be3cfda7bdf9fc0fb0a3315952fdda9486ab81 Mon Sep 17 00:00:00 2001 From: xile611 Date: Mon, 12 Aug 2024 09:34:32 +0800 Subject: [PATCH 12/35] fix: fix type error of react vchart, fix #3065 --- packages/react-vchart/src/charts/AreaChart.tsx | 9 +++++---- packages/react-vchart/src/charts/Bar3dChart.tsx | 9 +++++---- packages/react-vchart/src/charts/BarChart.tsx | 9 +++++---- packages/react-vchart/src/charts/BoxPlotChart.tsx | 11 ++++++----- .../react-vchart/src/charts/CirclePackingChart.tsx | 11 ++++++----- .../react-vchart/src/charts/CircularProgressChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/CommonChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/CorrelationChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/Funnel3dChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/FunnelChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/GaugeChart.tsx | 9 +++++---- packages/react-vchart/src/charts/HeatmapChart.tsx | 9 +++++---- packages/react-vchart/src/charts/Histogram3dChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/HistogramChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/LineChart.tsx | 9 +++++---- .../react-vchart/src/charts/LinearProgressChart.tsx | 11 ++++++----- packages/react-vchart/src/charts/LiquidChart.tsx | 9 +++++---- packages/react-vchart/src/charts/MapChart.tsx | 9 +++++---- packages/react-vchart/src/charts/Pie3dChart.tsx | 9 +++++---- packages/react-vchart/src/charts/PieChart.tsx | 9 +++++---- packages/react-vchart/src/charts/RadarChart.tsx | 9 +++++---- .../react-vchart/src/charts/RangeColumn3dChart.tsx | 9 +++++---- packages/react-vchart/src/charts/RangeColumnChart.tsx | 9 +++++---- packages/react-vchart/src/charts/RoseChart.tsx | 9 +++++---- packages/react-vchart/src/charts/SankeyChart.tsx | 9 +++++---- packages/react-vchart/src/charts/ScatterChart.tsx | 9 +++++---- packages/react-vchart/src/charts/SequenceChart.tsx | 9 +++++---- packages/react-vchart/src/charts/SunburstChart.tsx | 9 +++++---- packages/react-vchart/src/charts/TreemapChart.tsx | 9 +++++---- packages/react-vchart/src/charts/WaterfallChart.tsx | 9 +++++---- packages/react-vchart/src/charts/WordCloud3dChart.tsx | 9 +++++---- packages/react-vchart/src/charts/WordCloudChart.tsx | 9 +++++---- 32 files changed, 170 insertions(+), 138 deletions(-) diff --git a/packages/react-vchart/src/charts/AreaChart.tsx b/packages/react-vchart/src/charts/AreaChart.tsx index 4447dffa23..6ea5b937bf 100644 --- a/packages/react-vchart/src/charts/AreaChart.tsx +++ b/packages/react-vchart/src/charts/AreaChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IAreaChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerAreaChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface AreaChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const AreaChart = createChart & { type: 'area' }>( +export const AreaChart = createChart & { type?: 'area' }>( 'AreaChart', { type: 'area', diff --git a/packages/react-vchart/src/charts/Bar3dChart.tsx b/packages/react-vchart/src/charts/Bar3dChart.tsx index 10ce8814f7..7d26119a7a 100644 --- a/packages/react-vchart/src/charts/Bar3dChart.tsx +++ b/packages/react-vchart/src/charts/Bar3dChart.tsx @@ -1,16 +1,17 @@ -import React from 'react'; +import type React from 'react'; import type { IBar3dChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerBar3dChart, registerLabel, registerTotalLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface Bar3dChartProps extends Omit, - Omit { + Omit, 'type'> { // } -export const Bar3dChart = createChart & { type: 'bar3d' }>( +export const Bar3dChart = createChart & { type?: 'bar3d' }>( 'Bar3dChart', { type: 'bar3d', diff --git a/packages/react-vchart/src/charts/BarChart.tsx b/packages/react-vchart/src/charts/BarChart.tsx index 55b1f97c5f..d57f54f8a3 100644 --- a/packages/react-vchart/src/charts/BarChart.tsx +++ b/packages/react-vchart/src/charts/BarChart.tsx @@ -1,16 +1,17 @@ -import React from 'react'; +import type React from 'react'; import type { IBarChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerBarChart, registerLabel, registerTotalLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface BarChartProps extends Omit, - Omit { + Omit, 'type'> { // } -export const BarChart = createChart & { type: 'bar' }>( +export const BarChart = createChart & { type?: 'bar' }>( 'BarChart', { type: 'bar', diff --git a/packages/react-vchart/src/charts/BoxPlotChart.tsx b/packages/react-vchart/src/charts/BoxPlotChart.tsx index df353e2d3d..21d2206fc9 100644 --- a/packages/react-vchart/src/charts/BoxPlotChart.tsx +++ b/packages/react-vchart/src/charts/BoxPlotChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; -import { IBoxPlotChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { IBoxPlotChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerBoxplotChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface BoxPlotChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const BoxPlotChart = createChart & { type: 'boxPlot' }>( +export const BoxPlotChart = createChart & { type?: 'boxPlot' }>( 'BoxPlotChart', { type: 'boxPlot', diff --git a/packages/react-vchart/src/charts/CirclePackingChart.tsx b/packages/react-vchart/src/charts/CirclePackingChart.tsx index a195c92d0b..4265c923fc 100644 --- a/packages/react-vchart/src/charts/CirclePackingChart.tsx +++ b/packages/react-vchart/src/charts/CirclePackingChart.tsx @@ -1,15 +1,16 @@ -import React from 'react'; -import { ICirclePackingChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { ICirclePackingChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerCirclePackingChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface CirclePackingChartProps extends Omit, - Omit {} + Omit, 'type'> {} export const CirclePackingChart = createChart< - React.PropsWithChildren & { type: 'circlePacking' } + React.PropsWithChildren & { type?: 'circlePacking' } >( 'CirclePackingChart', { diff --git a/packages/react-vchart/src/charts/CircularProgressChart.tsx b/packages/react-vchart/src/charts/CircularProgressChart.tsx index d1b4b4faf1..f0f03b6f1f 100644 --- a/packages/react-vchart/src/charts/CircularProgressChart.tsx +++ b/packages/react-vchart/src/charts/CircularProgressChart.tsx @@ -1,15 +1,16 @@ -import React from 'react'; -import { ICircularProgressChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { ICircularProgressChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerCircularProgressChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { polarComponentsRegisters } from './register'; export interface CircularProgressChartProps extends Omit, - Omit {} + Omit, 'type'> {} export const CircularProgressChart = createChart< - React.PropsWithChildren & { type: 'circularProgress' } + React.PropsWithChildren & { type?: 'circularProgress' } >( 'CircularProgressChart', { diff --git a/packages/react-vchart/src/charts/CommonChart.tsx b/packages/react-vchart/src/charts/CommonChart.tsx index 6af6ea085d..67e578306b 100644 --- a/packages/react-vchart/src/charts/CommonChart.tsx +++ b/packages/react-vchart/src/charts/CommonChart.tsx @@ -1,5 +1,5 @@ -import React from 'react'; -import { ICommonChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { ICommonChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerCommonChart, @@ -16,13 +16,14 @@ import { registerScatterSeries, registerPieSeries } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; export interface CommonChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const CommonChart = createChart & { type: 'common' }>( +export const CommonChart = createChart & { type?: 'common' }>( 'CommonChart', { type: 'common', diff --git a/packages/react-vchart/src/charts/CorrelationChart.tsx b/packages/react-vchart/src/charts/CorrelationChart.tsx index 42bea5c0b9..9946d22c38 100644 --- a/packages/react-vchart/src/charts/CorrelationChart.tsx +++ b/packages/react-vchart/src/charts/CorrelationChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; -import { ICorrelationChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { ICorrelationChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerCorrelationChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface CorrelationChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const CorrelationChart = createChart & { type: 'correlation' }>( +export const CorrelationChart = createChart & { type?: 'correlation' }>( 'CorrelationChart', { type: 'correlation', diff --git a/packages/react-vchart/src/charts/Funnel3dChart.tsx b/packages/react-vchart/src/charts/Funnel3dChart.tsx index 7b4f12100c..0c4c5154f6 100644 --- a/packages/react-vchart/src/charts/Funnel3dChart.tsx +++ b/packages/react-vchart/src/charts/Funnel3dChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; -import { IFunnel3dChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { IFunnel3dChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerFunnel3dChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface Funnel3dChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const Funnel3dChart = createChart & { type: 'funnel3d' }>( +export const Funnel3dChart = createChart & { type?: 'funnel3d' }>( 'Funnel3dChart', { type: 'funnel3d', diff --git a/packages/react-vchart/src/charts/FunnelChart.tsx b/packages/react-vchart/src/charts/FunnelChart.tsx index 6eea0ac994..78b51cfd8c 100644 --- a/packages/react-vchart/src/charts/FunnelChart.tsx +++ b/packages/react-vchart/src/charts/FunnelChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; -import { IFunnelChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { IFunnelChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerFunnelChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface FunnelChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const FunnelChart = createChart & { type: 'funnel' }>( +export const FunnelChart = createChart & { type?: 'funnel' }>( 'FunnelChart', { type: 'funnel', diff --git a/packages/react-vchart/src/charts/GaugeChart.tsx b/packages/react-vchart/src/charts/GaugeChart.tsx index 7196f1ac5d..bb932516e7 100644 --- a/packages/react-vchart/src/charts/GaugeChart.tsx +++ b/packages/react-vchart/src/charts/GaugeChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IGaugeChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerGaugeChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface GaugeChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const GaugeChart = createChart & { type: 'gauge' }>( +export const GaugeChart = createChart & { type?: 'gauge' }>( 'GaugeChart', { type: 'gauge', diff --git a/packages/react-vchart/src/charts/HeatmapChart.tsx b/packages/react-vchart/src/charts/HeatmapChart.tsx index fa8809b94c..8fd033f5bc 100644 --- a/packages/react-vchart/src/charts/HeatmapChart.tsx +++ b/packages/react-vchart/src/charts/HeatmapChart.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import type React from 'react'; import type { IHeatmapChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, @@ -7,16 +7,17 @@ import { registerCartesianCrossHair, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface HeatmapChartProps extends Omit, - Omit { + Omit, 'type'> { // } -export const HeatmapChart = createChart & { type: 'heatmap' }>( +export const HeatmapChart = createChart & { type?: 'heatmap' }>( 'HeatmapChart', { type: 'heatmap', diff --git a/packages/react-vchart/src/charts/Histogram3dChart.tsx b/packages/react-vchart/src/charts/Histogram3dChart.tsx index 7935eefadc..5c24475619 100644 --- a/packages/react-vchart/src/charts/Histogram3dChart.tsx +++ b/packages/react-vchart/src/charts/Histogram3dChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; -import { IHistogram3dChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { IHistogram3dChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerHistogram3dChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface Histogram3dChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const Histogram3dChart = createChart & { type: 'histogram3d' }>( +export const Histogram3dChart = createChart & { type?: 'histogram3d' }>( 'Histogram3dChart', { type: 'histogram3d', diff --git a/packages/react-vchart/src/charts/HistogramChart.tsx b/packages/react-vchart/src/charts/HistogramChart.tsx index 58f0e5f2c2..b11642c031 100644 --- a/packages/react-vchart/src/charts/HistogramChart.tsx +++ b/packages/react-vchart/src/charts/HistogramChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; -import { IHistogramChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { IHistogramChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerHistogramChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface HistogramChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const HistogramChart = createChart & { type: 'histogram' }>( +export const HistogramChart = createChart & { type?: 'histogram' }>( 'HistogramChart', { type: 'histogram', diff --git a/packages/react-vchart/src/charts/LineChart.tsx b/packages/react-vchart/src/charts/LineChart.tsx index a2596f5893..68e49857bf 100644 --- a/packages/react-vchart/src/charts/LineChart.tsx +++ b/packages/react-vchart/src/charts/LineChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { ILineChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerLineChart, registerLabel, registerTotalLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface LineChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const LineChart = createChart & { type: 'line' }>( +export const LineChart = createChart & { type?: 'line' }>( 'LineChart', { type: 'line', diff --git a/packages/react-vchart/src/charts/LinearProgressChart.tsx b/packages/react-vchart/src/charts/LinearProgressChart.tsx index 1e34814f8f..32019e6479 100644 --- a/packages/react-vchart/src/charts/LinearProgressChart.tsx +++ b/packages/react-vchart/src/charts/LinearProgressChart.tsx @@ -1,15 +1,16 @@ -import React from 'react'; -import { ILinearProgressChartSpec, IVChartConstructor } from '@visactor/vchart'; +import type React from 'react'; +import type { ILinearProgressChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerLinearProgressChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface LinearProgressChartProps extends Omit, - Omit {} + Omit, 'type'> {} export const LinearProgressChart = createChart< - React.PropsWithChildren & { type: 'linearProgress' } + React.PropsWithChildren & { type?: 'linearProgress' } >( 'LinearProgressChart', { diff --git a/packages/react-vchart/src/charts/LiquidChart.tsx b/packages/react-vchart/src/charts/LiquidChart.tsx index 945cb646e4..fc97d4044e 100644 --- a/packages/react-vchart/src/charts/LiquidChart.tsx +++ b/packages/react-vchart/src/charts/LiquidChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { ILiquidChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerLiquidChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface LiquidChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const LiquidChart = createChart & { type: 'liquid' }>( +export const LiquidChart = createChart & { type?: 'liquid' }>( 'LiquidChart', { type: 'liquid', diff --git a/packages/react-vchart/src/charts/MapChart.tsx b/packages/react-vchart/src/charts/MapChart.tsx index 41dd04d6b1..ceb04ebbfe 100644 --- a/packages/react-vchart/src/charts/MapChart.tsx +++ b/packages/react-vchart/src/charts/MapChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IMapChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerMapChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface MapChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const MapChart = createChart & { type: 'map' }>( +export const MapChart = createChart & { type?: 'map' }>( 'MapChart', { type: 'map', diff --git a/packages/react-vchart/src/charts/Pie3dChart.tsx b/packages/react-vchart/src/charts/Pie3dChart.tsx index 4b698788c2..3f666e1054 100644 --- a/packages/react-vchart/src/charts/Pie3dChart.tsx +++ b/packages/react-vchart/src/charts/Pie3dChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IPie3dChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerPie3dChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface Pie3dChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const Pie3dChart = createChart & { type: 'pie3d' }>( +export const Pie3dChart = createChart & { type?: 'pie3d' }>( 'Pie3dChart', { type: 'pie3d', diff --git a/packages/react-vchart/src/charts/PieChart.tsx b/packages/react-vchart/src/charts/PieChart.tsx index c5ba5b822f..9a2f27b463 100644 --- a/packages/react-vchart/src/charts/PieChart.tsx +++ b/packages/react-vchart/src/charts/PieChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IPieChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerPieChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface PieChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const PieChart = createChart & { type: 'pie' }>( +export const PieChart = createChart & { type?: 'pie' }>( 'PieChart', { type: 'pie', diff --git a/packages/react-vchart/src/charts/RadarChart.tsx b/packages/react-vchart/src/charts/RadarChart.tsx index 1b82ee60d9..13bd5a11ee 100644 --- a/packages/react-vchart/src/charts/RadarChart.tsx +++ b/packages/react-vchart/src/charts/RadarChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IRadarChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerRadarChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { polarComponentsRegisters } from './register'; export interface RadarChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const RadarChart = createChart & { type: 'radar' }>( +export const RadarChart = createChart & { type?: 'radar' }>( 'RadarChart', { type: 'radar', diff --git a/packages/react-vchart/src/charts/RangeColumn3dChart.tsx b/packages/react-vchart/src/charts/RangeColumn3dChart.tsx index 635c115f8c..0b0c311a11 100644 --- a/packages/react-vchart/src/charts/RangeColumn3dChart.tsx +++ b/packages/react-vchart/src/charts/RangeColumn3dChart.tsx @@ -1,15 +1,16 @@ -import React from 'react'; +import type React from 'react'; import type { IRangeColumn3dChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerRangeColumn3dChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface RangeColumn3dChartProps extends Omit, - Omit {} + Omit, 'type'> {} export const RangeColumn3dChart = createChart< - React.PropsWithChildren & { type: 'rangeColumn3d' } + React.PropsWithChildren & { type?: 'rangeColumn3d' } >( 'RangeColumn3dChart', { diff --git a/packages/react-vchart/src/charts/RangeColumnChart.tsx b/packages/react-vchart/src/charts/RangeColumnChart.tsx index 389332a017..39919e586a 100644 --- a/packages/react-vchart/src/charts/RangeColumnChart.tsx +++ b/packages/react-vchart/src/charts/RangeColumnChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IRangeColumnChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerRangeColumnChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface RangeColumnChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const RangeColumnChart = createChart & { type: 'rangeColumn' }>( +export const RangeColumnChart = createChart & { type?: 'rangeColumn' }>( 'RangeColumnChart', { type: 'rangeColumn', diff --git a/packages/react-vchart/src/charts/RoseChart.tsx b/packages/react-vchart/src/charts/RoseChart.tsx index d0c6099177..897ce0fed1 100644 --- a/packages/react-vchart/src/charts/RoseChart.tsx +++ b/packages/react-vchart/src/charts/RoseChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IRoseChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerRoseChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { polarComponentsRegisters } from './register'; export interface RoseChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const RoseChart = createChart & { type: 'rose' }>( +export const RoseChart = createChart & { type?: 'rose' }>( 'RoseChart', { type: 'rose', diff --git a/packages/react-vchart/src/charts/SankeyChart.tsx b/packages/react-vchart/src/charts/SankeyChart.tsx index 258c3eb8bc..8ca9ff721e 100644 --- a/packages/react-vchart/src/charts/SankeyChart.tsx +++ b/packages/react-vchart/src/charts/SankeyChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { ISankeyChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerSankeyChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface SankeyChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const SankeyChart = createChart & { type: 'sankey' }>( +export const SankeyChart = createChart & { type?: 'sankey' }>( 'SankeyChart', { type: 'sankey', diff --git a/packages/react-vchart/src/charts/ScatterChart.tsx b/packages/react-vchart/src/charts/ScatterChart.tsx index 58d3159d54..63fa8e0df9 100644 --- a/packages/react-vchart/src/charts/ScatterChart.tsx +++ b/packages/react-vchart/src/charts/ScatterChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IScatterChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerScatterChart, registerLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface ScatterChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const ScatterChart = createChart & { type: 'scatter' }>( +export const ScatterChart = createChart & { type?: 'scatter' }>( 'ScatterChart', { type: 'scatter', diff --git a/packages/react-vchart/src/charts/SequenceChart.tsx b/packages/react-vchart/src/charts/SequenceChart.tsx index 1107502732..4d1a9b7f2a 100644 --- a/packages/react-vchart/src/charts/SequenceChart.tsx +++ b/packages/react-vchart/src/charts/SequenceChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { ISequenceChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerSequenceChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface SequenceChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const SequenceChart = createChart & { type: 'sequence' }>( +export const SequenceChart = createChart & { type?: 'sequence' }>( 'SequenceChart', { type: 'sequence', diff --git a/packages/react-vchart/src/charts/SunburstChart.tsx b/packages/react-vchart/src/charts/SunburstChart.tsx index ad9dc82630..f0f14f2cd1 100644 --- a/packages/react-vchart/src/charts/SunburstChart.tsx +++ b/packages/react-vchart/src/charts/SunburstChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { ISunburstChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerSunburstChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface SunburstChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const SunburstChart = createChart & { type: 'sunburst' }>( +export const SunburstChart = createChart & { type?: 'sunburst' }>( 'SunburstChart', { type: 'sunburst', diff --git a/packages/react-vchart/src/charts/TreemapChart.tsx b/packages/react-vchart/src/charts/TreemapChart.tsx index 41e4030aaf..4ce28a700e 100644 --- a/packages/react-vchart/src/charts/TreemapChart.tsx +++ b/packages/react-vchart/src/charts/TreemapChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { ITreemapChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerTreemapChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface TreemapChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const TreemapChart = createChart & { type: 'treemap' }>( +export const TreemapChart = createChart & { type?: 'treemap' }>( 'TreemapChart', { type: 'treemap', diff --git a/packages/react-vchart/src/charts/WaterfallChart.tsx b/packages/react-vchart/src/charts/WaterfallChart.tsx index be27a7cd30..7f0aa98eca 100644 --- a/packages/react-vchart/src/charts/WaterfallChart.tsx +++ b/packages/react-vchart/src/charts/WaterfallChart.tsx @@ -1,16 +1,17 @@ -import React from 'react'; +import type React from 'react'; import type { IWaterfallChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerWaterfallChart, registerLabel, registerTotalLabel } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { cartesianComponentsRegisters } from './register'; export interface WaterfallChartProps extends Omit, - Omit { + Omit, 'type'> { // } -export const WaterfallChart = createChart & { type: 'waterfall' }>( +export const WaterfallChart = createChart & { type?: 'waterfall' }>( 'WaterfallChart', { type: 'waterfall', diff --git a/packages/react-vchart/src/charts/WordCloud3dChart.tsx b/packages/react-vchart/src/charts/WordCloud3dChart.tsx index 2f9dad90ec..454528aa2b 100644 --- a/packages/react-vchart/src/charts/WordCloud3dChart.tsx +++ b/packages/react-vchart/src/charts/WordCloud3dChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IWordCloud3dChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerWordCloud3dChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface WordCloud3dChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const WordCloud3dChart = createChart & { type: 'wordCloud3d' }>( +export const WordCloud3dChart = createChart & { type?: 'wordCloud3d' }>( 'WordCloud3dChart', { type: 'wordCloud3d', diff --git a/packages/react-vchart/src/charts/WordCloudChart.tsx b/packages/react-vchart/src/charts/WordCloudChart.tsx index b2c75e1016..e7ed0b3cf6 100644 --- a/packages/react-vchart/src/charts/WordCloudChart.tsx +++ b/packages/react-vchart/src/charts/WordCloudChart.tsx @@ -1,14 +1,15 @@ -import React from 'react'; +import type React from 'react'; import type { IWordCloudChartSpec, IVChartConstructor } from '@visactor/vchart'; import { VChart, registerWordCloudChart } from '@visactor/vchart'; -import { BaseChartProps, createChart } from './BaseChart'; +import type { BaseChartProps } from './BaseChart'; +import { createChart } from './BaseChart'; import { simpleComponentsRegisters } from './register'; export interface WordCloudChartProps extends Omit, - Omit {} + Omit, 'type'> {} -export const WordCloudChart = createChart & { type: 'wordCloud' }>( +export const WordCloudChart = createChart & { type?: 'wordCloud' }>( 'WordCloudChart', { type: 'wordCloud', From 4ddc627394ad166751497caf25a61ffd6b20a73f Mon Sep 17 00:00:00 2001 From: xile611 Date: Mon, 12 Aug 2024 09:34:47 +0800 Subject: [PATCH 13/35] docs: update changlog of rush --- .../fix-react-vchart-types_2024-08-12-01-34.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json diff --git a/common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json b/common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json new file mode 100644 index 0000000000..0f6f75d35a --- /dev/null +++ b/common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix type error of react vchart, fix #3065\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From 54cc5b0ee5fc06e9eabd8f924b856652aa60810b Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Mon, 12 Aug 2024 10:50:34 +0800 Subject: [PATCH 14/35] chore: add change file --- .../vchart/fix-harmony-event_2024-08-12-02-50.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json diff --git a/common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json b/common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json new file mode 100644 index 0000000000..1bb8efa1aa --- /dev/null +++ b/common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "fix: fix issue with harmony event", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file From 7cbb4ced2db057f21fd7cb7f65045f9b87c3c19f Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Mon, 12 Aug 2024 17:52:55 +0800 Subject: [PATCH 15/35] fix: should not rewrite seriesField when configured in funnel series --- packages/vchart/src/series/funnel/funnel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vchart/src/series/funnel/funnel.ts b/packages/vchart/src/series/funnel/funnel.ts index c88de2ed4d..74863e67fe 100644 --- a/packages/vchart/src/series/funnel/funnel.ts +++ b/packages/vchart/src/series/funnel/funnel.ts @@ -112,7 +112,7 @@ export class FunnelSeries this._funnelAlign = ['left', 'right'].includes(this._spec.funnelAlign) ? this._spec.funnelAlign : 'center'; } - if (this._spec.categoryField) { + if (!this._seriesField && this._spec.categoryField) { this.setSeriesField(this._spec.categoryField); } } From 3fdabbb86eace8dfe702f7e26a877462ac7c909e Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Mon, 12 Aug 2024 18:53:13 +0800 Subject: [PATCH 16/35] docs: update changelog --- .../fix-funnel-seriesField_2024-08-12-10-52.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json diff --git a/common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json b/common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json new file mode 100644 index 0000000000..8dc09ca3b7 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "fix: fix funnel chart color bug with different category and series fields", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file From 8c602dcbca2bdfbab82e0394fb39e383d19a7611 Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 8 Aug 2024 22:05:30 +0800 Subject: [PATCH 17/35] fix: tooltip should show when chart has multiple regions --- .../vchart/src/event/events/dimension/util/cartesian.ts | 5 ----- packages/vchart/src/event/events/dimension/util/polar.ts | 6 ------ 2 files changed, 11 deletions(-) diff --git a/packages/vchart/src/event/events/dimension/util/cartesian.ts b/packages/vchart/src/event/events/dimension/util/cartesian.ts index 9992fd0430..34a0654a52 100644 --- a/packages/vchart/src/event/events/dimension/util/cartesian.ts +++ b/packages/vchart/src/event/events/dimension/util/cartesian.ts @@ -8,7 +8,6 @@ import { isNil } from '@visactor/vutils'; import { isXAxis, isYAxis } from '../../../../component/axis/cartesian/util/common'; import { Direction } from '../../../../typings/space'; import type { ILayoutPoint } from '../../../../typings/layout'; -import { getFirstSeries } from '../../../../util/model'; const discreteXAxisGetDimensionField = (series: ICartesianSeries) => series.fieldX[0]; const discreteYAxisGetDimensionField = (series: ICartesianSeries) => series.fieldY[0]; @@ -38,10 +37,6 @@ export const getCartesianDimensionInfo = ( if (!chart) { return null; } - const series = getFirstSeries(chart.getRegionsInIndex(), 'cartesian'); - if (!series) { - return null; - } const { x, y } = pos; const xAxisList = getAxis(chart, (cmp: CartesianAxis) => isXAxis(cmp.getOrient()), pos) ?? []; diff --git a/packages/vchart/src/event/events/dimension/util/polar.ts b/packages/vchart/src/event/events/dimension/util/polar.ts index 070f2376db..825395c309 100644 --- a/packages/vchart/src/event/events/dimension/util/polar.ts +++ b/packages/vchart/src/event/events/dimension/util/polar.ts @@ -7,8 +7,6 @@ import { isNil, maxInArray, minInArray } from '@visactor/vutils'; import { distance, vectorAngle } from '../../../../util/math'; import type { ILayoutPoint } from '../../../../typings/layout'; import type { PolarAxis } from '../../../../component'; -import { getFirstSeries } from '../../../../util/model'; - /** 将角度标准化为 range 范围内的角度 */ const angleStandardize = (angle: number, range: [number, number]) => { const unit = Math.PI * 2; @@ -26,10 +24,6 @@ export const getPolarDimensionInfo = (chart: IChart | undefined, pos: ILayoutPoi if (!chart) { return null; } - const series = getFirstSeries(chart.getRegionsInIndex(), 'polar'); - if (!series) { - return null; - } const { x, y } = pos; const angleAxisList = getAxis(chart, (cmp: PolarAxis) => cmp.getOrient() === 'angle', pos); From dd93645ac30f5eeeebff9692c9c85815d1edbfe7 Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 8 Aug 2024 22:06:44 +0800 Subject: [PATCH 18/35] docs: update changlog of rush --- .../fix-tooltip-of-multi-region_2024-08-08-14-06.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json diff --git a/common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json b/common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json new file mode 100644 index 0000000000..d3e12e25d3 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: tooltip should show when chart has multiple regions\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From 3adf988af264d6e26f4c4667615ddf7f99e412a9 Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 8 Aug 2024 22:10:09 +0800 Subject: [PATCH 19/35] fix: fix params of tickCount in linear-axis-mixin, fix #3053 --- packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts b/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts index 8107065041..32e5c88fa5 100644 --- a/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts +++ b/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts @@ -79,7 +79,7 @@ export class LinearAxisMixin { // tickCount需要一致,不然会导致效果不一致, fix #2050 tickCount = tick.tickCount({ - rangeSize, + axisLength: rangeSize, labelStyle: this._spec.label && this._spec.label.style }); } else if (isValidNumber(tick.tickCount)) { From fae5a877c4b5214e43cd15ad1fba1a76d66cfa88 Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 8 Aug 2024 22:10:30 +0800 Subject: [PATCH 20/35] docs: update changlog of rush --- .../@visactor/vchart/develop_2024-08-08-14-10.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/develop_2024-08-08-14-10.json diff --git a/common/changes/@visactor/vchart/develop_2024-08-08-14-10.json b/common/changes/@visactor/vchart/develop_2024-08-08-14-10.json new file mode 100644 index 0000000000..9afcfc5619 --- /dev/null +++ b/common/changes/@visactor/vchart/develop_2024-08-08-14-10.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix params of tickCount in linear-axis-mixin, fix #3053\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From 2af5f8ba6f23f7bffa18057b19ae41c9924398e2 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 09:39:48 +0800 Subject: [PATCH 21/35] fix: fix the issue background of chart not updated, fix #3054 --- packages/vchart/src/chart/base/base-chart.ts | 1 + packages/vchart/src/core/vchart.ts | 4 ++++ packages/vchart/src/model/interface.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/packages/vchart/src/chart/base/base-chart.ts b/packages/vchart/src/chart/base/base-chart.ts index 1e3ac95eb7..6b7a800afa 100644 --- a/packages/vchart/src/chart/base/base-chart.ts +++ b/packages/vchart/src/chart/base/base-chart.ts @@ -841,6 +841,7 @@ export class BaseChart extends CompilableBase implements I // background need remake if (!isEqual(this._spec.background, oldSpec.background)) { result.reMake = true; + result.changeBackground = true; } } diff --git a/packages/vchart/src/core/vchart.ts b/packages/vchart/src/core/vchart.ts index bbff95178a..23f25608f1 100644 --- a/packages/vchart/src/core/vchart.ts +++ b/packages/vchart/src/core/vchart.ts @@ -636,6 +636,8 @@ export class VChart implements IVChart { if (updateResult.changeTheme) { this._setCurrentTheme(); this._setFontFamilyTheme(this._currentTheme?.fontFamily as string); + } else if (updateResult.changeBackground) { + this._compiler?.setBackground(this._getBackground()); } // 如果不需要动画,那么释放item,避免元素残留 this._compiler?.releaseGrammar(this._option?.animation === false || this._spec?.animation === false); @@ -652,6 +654,8 @@ export class VChart implements IVChart { if (updateResult.changeTheme) { this._setCurrentTheme(); this._setFontFamilyTheme(this._currentTheme?.fontFamily as string); + } else if (updateResult.changeBackground) { + this._compiler?.setBackground(this._getBackground()); } if (updateResult.reCompile) { // recompile diff --git a/packages/vchart/src/model/interface.ts b/packages/vchart/src/model/interface.ts index f1f8438978..f4b8f317b0 100644 --- a/packages/vchart/src/model/interface.ts +++ b/packages/vchart/src/model/interface.ts @@ -59,6 +59,7 @@ export interface IUpdateSpecResult { reTransformSpec?: boolean; reAnimate?: boolean; changeTheme?: boolean; + changeBackground?: boolean; } export interface IUpdateDataResult { From d148603744c0a5efcb852068fe09f7663cd767fa Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 09:40:08 +0800 Subject: [PATCH 22/35] docs: update changlog of rush --- .../fix-update-spec-cases_2024-08-09-01-40.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json diff --git a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json new file mode 100644 index 0000000000..104a584929 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix the issue background of chart not updated, fix #3054\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From d8698c285f36e06b9c1861431ecdc31a0c3073f5 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 10:09:51 +0800 Subject: [PATCH 23/35] fix: fix the update of `startAngle` and `endAngle` in pie chart, fix #3059 --- packages/vchart/src/data/transforms/pie.ts | 30 +++++-------- packages/vchart/src/series/pie/pie.ts | 49 ++++++++++------------ 2 files changed, 32 insertions(+), 47 deletions(-) diff --git a/packages/vchart/src/data/transforms/pie.ts b/packages/vchart/src/data/transforms/pie.ts index 65df50dc1e..59e17ba3dd 100644 --- a/packages/vchart/src/data/transforms/pie.ts +++ b/packages/vchart/src/data/transforms/pie.ts @@ -5,11 +5,10 @@ import { computeQuadrant, getPercentValue } from '../../util/math'; import { ARC_TRANSFORM_VALUE } from '../../constant/polar'; export interface IPieOpt { - angleField: string; - - startAngle: number; - endAngle: number; - minAngle: number; + angleField: () => string; + startAngle: () => number; + endAngle: () => number; + minAngle: () => number; asStartAngle: string; asEndAngle: string; @@ -32,19 +31,12 @@ export const pie = (originData: Array, op: IPieOpt) => { if (!data || data.length === 0) { return data; } - const { - angleField, - startAngle, - endAngle, - minAngle, - asStartAngle, - asEndAngle, - asMiddleAngle, - asRadian, - asRatio, - asQuadrant, - asK - } = op; + const { asStartAngle, asEndAngle, asMiddleAngle, asRadian, asRatio, asQuadrant, asK } = op; + + const angleField = op.angleField(); + const startAngle = op.startAngle(); + const endAngle = op.endAngle(); + const minAngle = op.minAngle(); const appendArcInfo = (data: Datum, startAngle: number, angle: number) => { data[asStartAngle] = startAngle; @@ -88,7 +80,7 @@ export const pie = (originData: Array, op: IPieOpt) => { d[asRatio] = ratio; d[asK] = max ? angleFieldValue / max : 0; - d._percent_ = percents[i]; + d._percent_ = (percents as number[])[i]; appendArcInfo(d, dStartAngle, radian); lastAngle = dEndAngle; diff --git a/packages/vchart/src/series/pie/pie.ts b/packages/vchart/src/series/pie/pie.ts index 7aa5754b3a..19eea89add 100644 --- a/packages/vchart/src/series/pie/pie.ts +++ b/packages/vchart/src/series/pie/pie.ts @@ -132,10 +132,10 @@ export class BasePieSeries extends PolarSeries { type: 'pie', options: { - angleField: this._angleField[0], - startAngle: this._startAngle, - endAngle: this._endAngle, - minAngle: isValid(this._spec.minAngle) ? degreeToRadian(this._spec.minAngle) : 0, + angleField: () => this._angleField[0], + startAngle: () => this._startAngle, + endAngle: () => this._endAngle, + minAngle: () => (isValid(this._spec.minAngle) ? degreeToRadian(this._spec.minAngle) : 0), asStartAngle: ARC_START_ANGLE, asEndAngle: ARC_END_ANGLE, asRatio: ARC_RATIO, @@ -225,7 +225,7 @@ export class BasePieSeries extends PolarSeries super.initMarkStyleWithSpec(mark, spec, key); if (mark.name === this._pieMarkName) { // radius 配置需要额外处理比例值 - const pieSpec = this.getSpec()[mark.name]; + const pieSpec = this.getSpec()[mark.name as 'pie']; if (pieSpec) { for (const state in pieSpec.state || {}) { this.setMarkStyle(mark, this.generateRadiusStyle(pieSpec.state[state]), state, AttributeLevel.User_Mark); @@ -328,31 +328,24 @@ export class BasePieSeries extends PolarSeries _compareSpec(spec: T, prevSpec: T, ignoreCheckKeys?: { [key: string]: true }) { ignoreCheckKeys = ignoreCheckKeys ?? { data: true }; - ignoreCheckKeys.centerX = true; - ignoreCheckKeys.centerX = true; - ignoreCheckKeys.centerY = true; - ignoreCheckKeys.centerOffset = true; - ignoreCheckKeys.radius = true; - ignoreCheckKeys.innerRadius = true; - ignoreCheckKeys.cornerRadius = true; - ignoreCheckKeys.startAngle = true; - ignoreCheckKeys.endAngle = true; - ignoreCheckKeys.padAngle = true; - const { centerX, centerY, centerOffset, radius, innerRadius, cornerRadius, startAngle, endAngle, padAngle } = - prevSpec; + const defaultIgnoreKeys: string[] = [ + 'centerX', + 'centerY', + 'centerOffset', + 'radius', + 'innerRadius', + 'cornerRadius', + 'startAngle', + 'endAngle', + 'padAngle' + ]; + defaultIgnoreKeys.forEach(key => { + ignoreCheckKeys[key] = true; + }); + const result = super._compareSpec(spec, prevSpec, ignoreCheckKeys); spec = spec ?? ({} as T); - if ( - spec.centerY !== centerY || - spec.centerX !== centerX || - spec.centerOffset !== centerOffset || - spec.radius !== radius || - spec.innerRadius !== innerRadius || - spec.cornerRadius !== cornerRadius || - spec.startAngle !== startAngle || - spec.endAngle !== endAngle || - spec.padAngle !== padAngle - ) { + if (defaultIgnoreKeys.some(key => (spec as any)[key] !== (prevSpec as any)[key])) { result.reRender = true; result.change = true; } From 772608b9492dbdb0ac0d477875265bd93606714a Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 10:15:49 +0800 Subject: [PATCH 24/35] docs: update changlog of rush --- .../fix-update-spec-cases_2024-08-09-02-15.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json diff --git a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json new file mode 100644 index 0000000000..711a47c7c8 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix the update of `startAngle` and `endAngle` in pie chart, fix #3059\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From f705a4ce88fff56900ce80cf94259451494fcf96 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 10:44:59 +0800 Subject: [PATCH 25/35] fix: fix switch `visible` of legend, fix #3060 --- packages/vchart/src/component/legend/base-legend.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/vchart/src/component/legend/base-legend.ts b/packages/vchart/src/component/legend/base-legend.ts index b4096d4aeb..7062bd75da 100644 --- a/packages/vchart/src/component/legend/base-legend.ts +++ b/packages/vchart/src/component/legend/base-legend.ts @@ -208,6 +208,10 @@ export abstract class BaseLegend extends BaseCompon getBoundsInRect(rect: ILayoutRect, fullSpace: ILayoutRect) { if (!this._visible) { + if (this._legendComponent && this._legendComponent.parent) { + this._legendComponent.parent.removeChild(this._legendComponent); + this._legendComponent = null; + } return { x1: 0, y1: 0, x2: 0, y2: 0 }; } const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 }; From 1b40ae1097fa40ca0d35514742a015b9d906f420 Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 10:48:21 +0800 Subject: [PATCH 26/35] docs: update changlog of rush --- .../fix-update-spec-cases_2024-08-09-02-48.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json diff --git a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json new file mode 100644 index 0000000000..1760bd0419 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix switch `visible` of legend, fix #3060\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "dingling112@gmail.com" +} \ No newline at end of file From fcfb06d981079815ce872a358e15985882147c5e Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 9 Aug 2024 13:13:21 +0800 Subject: [PATCH 27/35] fix: fix update of background --- packages/vchart/src/chart/base/base-chart.ts | 6 ------ packages/vchart/src/chart/util.ts | 4 +++- packages/vchart/src/core/vchart.ts | 3 +++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/vchart/src/chart/base/base-chart.ts b/packages/vchart/src/chart/base/base-chart.ts index 6b7a800afa..0f2a82916b 100644 --- a/packages/vchart/src/chart/base/base-chart.ts +++ b/packages/vchart/src/chart/base/base-chart.ts @@ -837,12 +837,6 @@ export class BaseChart extends CompilableBase implements I // re compute padding & layout this._updateLayoutRect(this._viewBox); - - // background need remake - if (!isEqual(this._spec.background, oldSpec.background)) { - result.reMake = true; - result.changeBackground = true; - } } updateDataSpec() { diff --git a/packages/vchart/src/chart/util.ts b/packages/vchart/src/chart/util.ts index 62ab04959a..6874607543 100644 --- a/packages/vchart/src/chart/util.ts +++ b/packages/vchart/src/chart/util.ts @@ -81,6 +81,7 @@ export function calculateChartSize( export function mergeUpdateResult(target: IUpdateSpecResult, ...sources: IUpdateSpecResult[]) { const merge = (key: keyof IUpdateSpecResult) => sources.reduce((value, cur) => value || cur?.[key], target[key]); + Object.assign(target, { change: merge('change'), reCompile: merge('reCompile'), @@ -88,7 +89,8 @@ export function mergeUpdateResult(target: IUpdateSpecResult, ...sources: IUpdate reRender: merge('reRender'), reSize: merge('reSize'), reTransformSpec: merge('reTransformSpec'), - changeTheme: merge('changeTheme') + changeTheme: merge('changeTheme'), + changeBackground: merge('changeBackground') } as Required); return target; } diff --git a/packages/vchart/src/core/vchart.ts b/packages/vchart/src/core/vchart.ts index 23f25608f1..b2dfd5bc05 100644 --- a/packages/vchart/src/core/vchart.ts +++ b/packages/vchart/src/core/vchart.ts @@ -1059,6 +1059,9 @@ export class VChart implements IVChart { // setCurrentTheme 会导致 chart 实例的 reInit。 // 只要模块从 vchart 实例获取与 spec 相关的信息,都会出现错误,它们已经不匹配了 // this._setCurrentTheme(); + } else if (!isEqual(this._spec.background, lastSpec.background)) { + result.reMake = true; + result.changeBackground = true; } const reSize = this._shouldChartResize(lastSpec); From bf33058309f2dd78394c077370372bd764baaf0f Mon Sep 17 00:00:00 2001 From: xile611 Date: Mon, 12 Aug 2024 10:05:00 +0800 Subject: [PATCH 28/35] feat: support polygon domain line of angle-axis --- .../vchart/src/component/axis/polar/axis.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/vchart/src/component/axis/polar/axis.ts b/packages/vchart/src/component/axis/polar/axis.ts index 9056058e01..01f9981d4b 100644 --- a/packages/vchart/src/component/axis/polar/axis.ts +++ b/packages/vchart/src/component/axis/polar/axis.ts @@ -122,7 +122,9 @@ export abstract class PolarAxis { if (!isValidPolarAxis(s)) { return; @@ -146,13 +148,19 @@ export abstract class PolarAxis { (info as any).angleAxisIndex = angleAxisIndex; }); + + angleAxisSpecInfos.forEach(info => { + (info as any).radiusAxisIndex = radiusAxisIndex; + }); return specInfos; } @@ -462,7 +470,10 @@ export abstract class PolarAxis Date: Mon, 12 Aug 2024 12:11:32 +0800 Subject: [PATCH 29/35] fix: upgrade vrender version to 0.19.24 --- common/config/rush/pnpm-lock.yaml | 226 ++++++++++++------------- docs/package.json | 6 +- packages/openinula-vchart/package.json | 6 +- packages/react-vchart/package.json | 6 +- packages/vchart-extension/package.json | 4 +- packages/vchart/package.json | 22 +-- packages/vstory/package.json | 6 +- tools/story-player/package.json | 6 +- 8 files changed, 141 insertions(+), 141 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 7aef4060a6..63c7a98554 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -20,10 +20,10 @@ importers: '@visactor/react-vchart': workspace:1.11.11 '@visactor/vchart': workspace:1.11.11 '@visactor/vchart-theme': ~1.6.6 - '@visactor/vgrammar': 0.13.19 + '@visactor/vgrammar': 0.13.20 '@visactor/vmind': 1.2.4-alpha.5 - '@visactor/vrender': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 axios: ^1.4.0 @@ -53,10 +53,10 @@ importers: '@visactor/react-vchart': link:../packages/react-vchart '@visactor/vchart': link:../packages/vchart '@visactor/vchart-theme': 1.6.9 - '@visactor/vgrammar': 0.13.19 + '@visactor/vgrammar': 0.13.20 '@visactor/vmind': 1.2.4-alpha.5 - '@visactor/vrender': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 axios: 1.7.2 buble: 0.20.0 @@ -136,9 +136,9 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react-is': ^17.0.3 '@visactor/vchart': workspace:1.11.11 - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -157,9 +157,9 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../vchart - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 react-is: 18.3.1 devDependencies: @@ -201,9 +201,9 @@ importers: '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 '@visactor/vchart': workspace:1.11.11 - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -223,9 +223,9 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../vchart - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 react-is: 18.3.1 devDependencies: @@ -360,17 +360,17 @@ importers: '@types/node': '*' '@types/offscreencanvas': 2019.6.4 '@visactor/vdataset': ~0.18.10 - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-hierarchy': 0.13.19 - '@visactor/vgrammar-projection': 0.13.19 - '@visactor/vgrammar-sankey': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vgrammar-venn': 0.13.19 - '@visactor/vgrammar-wordcloud': 0.13.19 - '@visactor/vgrammar-wordcloud-shape': 0.13.19 - '@visactor/vrender-components': 0.19.23 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-hierarchy': 0.13.20 + '@visactor/vgrammar-projection': 0.13.20 + '@visactor/vgrammar-sankey': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vgrammar-venn': 0.13.20 + '@visactor/vgrammar-wordcloud': 0.13.20 + '@visactor/vgrammar-wordcloud-shape': 0.13.20 + '@visactor/vrender-components': 0.19.24 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vscale': ~0.18.10 '@visactor/vutils': ~0.18.10 '@visactor/vutils-extension': workspace:1.11.11 @@ -408,17 +408,17 @@ importers: vite: 3.2.6 dependencies: '@visactor/vdataset': 0.18.10 - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-hierarchy': 0.13.19 - '@visactor/vgrammar-projection': 0.13.19 - '@visactor/vgrammar-sankey': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vgrammar-venn': 0.13.19 - '@visactor/vgrammar-wordcloud': 0.13.19 - '@visactor/vgrammar-wordcloud-shape': 0.13.19 - '@visactor/vrender-components': 0.19.23 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-hierarchy': 0.13.20 + '@visactor/vgrammar-projection': 0.13.20 + '@visactor/vgrammar-sankey': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vgrammar-venn': 0.13.20 + '@visactor/vgrammar-wordcloud': 0.13.20 + '@visactor/vgrammar-wordcloud-shape': 0.13.20 + '@visactor/vrender-components': 0.19.24 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vscale': 0.18.10 '@visactor/vutils': 0.18.10 '@visactor/vutils-extension': link:../vutils-extension @@ -478,8 +478,8 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@visactor/vchart': workspace:1.11.11 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 @@ -499,8 +499,8 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../vchart - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -839,9 +839,9 @@ importers: '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 '@visactor/vchart': workspace:1.11.11 - '@visactor/vrender': 0.19.23 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender': 0.19.24 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': ~0.18.10 cross-env: ^7.0.3 eslint: ~8.18.0 @@ -854,9 +854,9 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../../packages/vchart - '@visactor/vrender': 0.19.23 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender': 0.19.24 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 devDependencies: '@internal/bundler': link:../bundler @@ -4830,96 +4830,96 @@ packages: topojson-client: 3.1.0 dev: false - /@visactor/vgrammar-coordinate/0.13.19: - resolution: {integrity: sha512-YAO3IQg97lmEqfZhBIdg/ST0D2IlzcQYCr56Smp7aYr0J0NJAB9zYwG9ssJzKQGENVe/RfyjWlFuJEUkmamH+w==} + /@visactor/vgrammar-coordinate/0.13.20: + resolution: {integrity: sha512-c765obW2NI1HKpYNtrRw0D9bEbK8ZZ0r9aicHg5rHJrGAx9Rk8BFSj+MMy4JXlBBG8yLwI3R5DPl0OVIlDi7WA==} dependencies: - '@visactor/vgrammar-util': 0.13.19 + '@visactor/vgrammar-util': 0.13.20 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-core/0.13.19: - resolution: {integrity: sha512-WSaUWkXQ3zVn4OCkWSlkPWULdhwkA6yby54GC/fqCoCYnPdlGDJbxR741K2fw6IbIWxu9+oSS+ZVIBZrq/VXgg==} + /@visactor/vgrammar-core/0.13.20: + resolution: {integrity: sha512-tPJ7e+W5jfslqD9fjQ6ug3+jEPyX1/AFMeKMssWFmS53sCfwx4slmQxDfrbVgOyYgCgzgX508eVZzCdxdhwMTA==} dependencies: '@visactor/vdataset': 0.18.10 - '@visactor/vgrammar-coordinate': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vrender-components': 0.19.23 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-coordinate': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vrender-components': 0.19.24 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vscale': 0.18.10 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-hierarchy/0.13.19: - resolution: {integrity: sha512-KMsV2OMkFsF2xq7ORJB9ETIifFYfiALsdhTvVgX5G/VUUYkSR6l5ZWBCd0X/Fdyb+NaRn4gIgepkII+bwiOplA==} + /@visactor/vgrammar-hierarchy/0.13.20: + resolution: {integrity: sha512-XkYO6xQxtlAzzje6bR8v4EMBq23KX5IzKMKU9YPBgpEFXJiR3XD4VIhL3Qn5GqMXUJsEo1TfZ/81I0lHnzzPhw==} dependencies: - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-projection/0.13.19: - resolution: {integrity: sha512-JXneUHRqBjMEiNACtiFX1cn0AVaYEEdFLQm+GJP58obsd7URDYjy79D0xknQJJ1N7e/d9lWJczDF1PWk34EvdQ==} + /@visactor/vgrammar-projection/0.13.20: + resolution: {integrity: sha512-G/CBzIqswq3m5hnD5gK3GqvLvCaLCbr3hmMtNlQWzUExcHMxOfj8umsrCmZf+yc8itHJGUcvzgmfWk1Oh2FNtw==} dependencies: - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 '@visactor/vutils': 0.18.10 d3-geo: 1.12.1 dev: false - /@visactor/vgrammar-sankey/0.13.19: - resolution: {integrity: sha512-/dq3H8l59aXgzZFKJILyA5C2W4efND91JX10PxT6yGpuzKNH1OdrIuVZ646Pr2EhhtEKi5Zzb6l20zVfaoeEfw==} + /@visactor/vgrammar-sankey/0.13.20: + resolution: {integrity: sha512-+oLOsZOiAFxEg7csr3hBL+ZdvT7a21zCgZtGZdNGMWybyytFYHtKu1UvGUPm5DH04ViKIEe0LkxUeL2Hq73ITQ==} dependencies: - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-util/0.13.19: - resolution: {integrity: sha512-X1APnlvbHggVDFOMkYVmOBAHnufqW/94MN9N1wpC8ojZshD1Gx13AuLk4b2qsokjTnGlCkLXZfu+0TrwIMPFNA==} + /@visactor/vgrammar-util/0.13.20: + resolution: {integrity: sha512-U1LTDV3uPJgL74VE94Llfj2b0FhMfDArtjyBCJhEv/kn9Z21TClWT5JL89AoE28yr4xBPCjn93mohiZPJNsjbA==} dependencies: '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-venn/0.13.19: - resolution: {integrity: sha512-ifqZahsSyfH6+d5nlEL/WOO4nGoxohfw31WcxObW9eVXU5XtWx+sQn1nP8RAecrQUrABCh1XzbYqfcHhtx9FUw==} + /@visactor/vgrammar-venn/0.13.20: + resolution: {integrity: sha512-mIy0jNNLuazLMdxhcMKRVyJDK2UG5RBJWoglLkxt2GHPVQCXjdzJaALSkNNjVaI4FSllkdE2GCCKSxvcOcGp1Q==} dependencies: - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-wordcloud-shape/0.13.19: - resolution: {integrity: sha512-+7ySfiinG44HR7LfAqn3srCfe99SSjXsGBUhWv9cK/dlx5/xucfyi0BbXuzULGFPf+tklKzlxUOc2iJUZZPXPw==} + /@visactor/vgrammar-wordcloud-shape/0.13.20: + resolution: {integrity: sha512-waumcYECZ6dbwkZZ+61vHSIgOpvGtaw2q6gzP6f3mx89N3oDsgFCHqE/FQ4iXW5OIH9tf1QbYTt/o0x2S+tlsw==} dependencies: - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vscale': 0.18.10 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar-wordcloud/0.13.19: - resolution: {integrity: sha512-8UZYZEru5jdI5bkLoAlA/tTGYhiAJjTW7vrAkWqUn8U6wstrfhEbD8R7KXu74W9+qVF+hqQmvOR0z8eo+dfDCQ==} + /@visactor/vgrammar-wordcloud/0.13.20: + resolution: {integrity: sha512-9FaPpICGY/RQYvsVacTE9WqHQbg+K/N/eBrQRwMmjvtkWEgYAYTExTEmnzjk0+limJx3uWs7+k15xXoJz9xDzA==} dependencies: - '@visactor/vgrammar-core': 0.13.19 - '@visactor/vgrammar-util': 0.13.19 - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vgrammar-core': 0.13.20 + '@visactor/vgrammar-util': 0.13.20 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vgrammar/0.13.19: - resolution: {integrity: sha512-05e8hISoMfVB9XqROWfHpNqVt7aUT/UPtrDWR3MUHmCBdZnwdAIVSjqBD5/r8hoNhBVHOE0VV3ODye5D3OKXsw==} + /@visactor/vgrammar/0.13.20: + resolution: {integrity: sha512-suZkOb1d8T39w7wlw+oZPGDAi/j8YwaHl/uqImIyd2XclXLuSVENcrTA3STcrVa0NYOzfiIh2bp2eloxX/fkfg==} dependencies: - '@visactor/vgrammar-core': 0.13.19 + '@visactor/vgrammar-core': 0.13.20 dev: false /@visactor/vmind/1.2.4-alpha.5: @@ -4940,36 +4940,36 @@ packages: - debug dev: false - /@visactor/vrender-components/0.19.23: - resolution: {integrity: sha512-dft7yOeSwO2jd+qU4az2oCV7WG/hfSkWAuMtz+nIUUs67HZN0zRqNjbx+IoLvzo2F1beS3uTynB/rr6dh3goZw==} + /@visactor/vrender-components/0.19.24: + resolution: {integrity: sha512-OcnfLVKyx1bnoT1h2QdWusXB32v3vPChHNxQqSC/juRdJWcaJOGGh61NCE5lC7t8iOcD1IOxeO7THfizEltTjA==} dependencies: - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 '@visactor/vscale': 0.18.10 '@visactor/vutils': 0.18.10 dev: false - /@visactor/vrender-core/0.19.23: - resolution: {integrity: sha512-aRjSr5fARAupt9+B08zdfgyk7KXN89MCeN9EOk7AMYcj2p+/QYlFT0FTEMZScrriiluGISNgbFtUVqo3oGivJw==} + /@visactor/vrender-core/0.19.24: + resolution: {integrity: sha512-6R+ZAsLlsSUOx61OqXQm0lGGi0FAZ38l4eH7cOCt2dra34XabnsCeNuAUPdiVMRlEvm7m3SleI54C8bBW237MA==} dependencies: '@visactor/vutils': 0.18.10 color-convert: 2.0.1 dev: false - /@visactor/vrender-kits/0.19.23: - resolution: {integrity: sha512-C8zyIaO4TgQ3dPnWtO1AA2K6/kAnMGgugP8Rnrqikvb8x4kVGw3zVP5PSZ9hP+ZdG9T35iyDt9uO8rl7u0OVWw==} + /@visactor/vrender-kits/0.19.24: + resolution: {integrity: sha512-kvRagS7n9WrnEVmVvIJ4PWx7mPdWbFxcFHA3sPnolyV+k+H7Sp/NpQBJWIpraWgFexiYA0GWwYZfkAomrU65sQ==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 0.19.23 + '@visactor/vrender-core': 0.19.24 '@visactor/vutils': 0.18.10 roughjs: 4.5.2 dev: false - /@visactor/vrender/0.19.23: - resolution: {integrity: sha512-4lTLHxZUz12aO7wK/gp7dBhNGHowXwV7dF7upFKWDRaVoqMz8aNYzWVOinXSWsG+rG32a+28lDhOq1AxBtSvwg==} + /@visactor/vrender/0.19.24: + resolution: {integrity: sha512-OljOOW1LpX16zWqEsnOD9CEf4bW1HQvWiSPS8hIr0AYdq8aqr7OhBbleoFIzy99Cmn3uMbF43+R0ISXnSgjzuw==} dependencies: - '@visactor/vrender-core': 0.19.23 - '@visactor/vrender-kits': 0.19.23 + '@visactor/vrender-core': 0.19.24 + '@visactor/vrender-kits': 0.19.24 dev: false /@visactor/vscale/0.18.10: @@ -5005,7 +5005,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.24.7_@babel+core@7.20.12 magic-string: 0.27.0 react-refresh: 0.14.2 - vite: 3.2.6_@types+node@20.14.11 + vite: 3.2.6 transitivePeerDependencies: - supports-color dev: true diff --git a/docs/package.json b/docs/package.json index d99833a070..5bd139cead 100644 --- a/docs/package.json +++ b/docs/package.json @@ -18,9 +18,9 @@ "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~0.18.10", - "@visactor/vrender": "0.19.23", - "@visactor/vrender-kits": "0.19.23", - "@visactor/vgrammar": "0.13.19", + "@visactor/vrender": "0.19.24", + "@visactor/vrender-kits": "0.19.24", + "@visactor/vgrammar": "0.13.20", "markdown-it": "^13.0.0", "highlight.js": "^11.8.0", "axios": "^1.4.0", diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index 26998eb60e..68ff0742f7 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -30,9 +30,9 @@ "dependencies": { "@visactor/vchart": "workspace:1.11.11", "@visactor/vutils": "~0.18.10", - "@visactor/vrender-core": "0.19.23", - "@visactor/vrender-kits": "0.19.23", - "@visactor/vgrammar-core": "0.13.19", + "@visactor/vrender-core": "0.19.24", + "@visactor/vrender-kits": "0.19.24", + "@visactor/vgrammar-core": "0.13.20", "react-is": "^18.2.0" }, "devDependencies": { diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index b74b93a06f..974828caec 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -30,9 +30,9 @@ "dependencies": { "@visactor/vchart": "workspace:1.11.11", "@visactor/vutils": "~0.18.10", - "@visactor/vrender-core": "0.19.23", - "@visactor/vrender-kits": "0.19.23", - "@visactor/vgrammar-core": "0.13.19", + "@visactor/vrender-core": "0.19.24", + "@visactor/vrender-kits": "0.19.24", + "@visactor/vgrammar-core": "0.13.20", "react-is": "^18.2.0" }, "devDependencies": { diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index 21f4486c6f..94a76b84a6 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -20,8 +20,8 @@ }, "dependencies": { "@visactor/vchart": "workspace:1.11.11", - "@visactor/vrender-core": "0.19.23", - "@visactor/vrender-kits": "0.19.23", + "@visactor/vrender-core": "0.19.24", + "@visactor/vrender-kits": "0.19.24", "@visactor/vutils": "~0.18.10" }, "devDependencies": { diff --git a/packages/vchart/package.json b/packages/vchart/package.json index e6cf6d83bd..1856da1aad 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -119,17 +119,17 @@ "@visactor/vutils": "~0.18.10", "@visactor/vdataset": "~0.18.10", "@visactor/vscale": "~0.18.10", - "@visactor/vrender-core": "0.19.23", - "@visactor/vrender-kits": "0.19.23", - "@visactor/vrender-components": "0.19.23", - "@visactor/vgrammar-core": "0.13.19", - "@visactor/vgrammar-projection": "0.13.19", - "@visactor/vgrammar-wordcloud": "0.13.19", - "@visactor/vgrammar-wordcloud-shape": "0.13.19", - "@visactor/vgrammar-hierarchy": "0.13.19", - "@visactor/vgrammar-sankey": "0.13.19", - "@visactor/vgrammar-venn": "0.13.19", - "@visactor/vgrammar-util": "0.13.19", + "@visactor/vrender-core": "0.19.24", + "@visactor/vrender-kits": "0.19.24", + "@visactor/vrender-components": "0.19.24", + "@visactor/vgrammar-core": "0.13.20", + "@visactor/vgrammar-projection": "0.13.20", + "@visactor/vgrammar-wordcloud": "0.13.20", + "@visactor/vgrammar-wordcloud-shape": "0.13.20", + "@visactor/vgrammar-hierarchy": "0.13.20", + "@visactor/vgrammar-sankey": "0.13.20", + "@visactor/vgrammar-venn": "0.13.20", + "@visactor/vgrammar-util": "0.13.20", "@visactor/vutils-extension": "workspace:1.11.11" }, "publishConfig": { diff --git a/packages/vstory/package.json b/packages/vstory/package.json index dd88942229..3a9459ec4e 100644 --- a/packages/vstory/package.json +++ b/packages/vstory/package.json @@ -21,9 +21,9 @@ }, "dependencies": { "@visactor/vchart": "workspace:1.11.0", - "@visactor/vrender-core": "0.19.23", - "@visactor/vrender-kits": "0.19.23", - "@visactor/vrender-components": "0.19.23", + "@visactor/vrender-core": "0.19.24", + "@visactor/vrender-kits": "0.19.24", + "@visactor/vrender-components": "0.19.24", "@visactor/vutils": "~0.18.10" }, "devDependencies": { diff --git a/tools/story-player/package.json b/tools/story-player/package.json index dac36075fb..4156bd2834 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -56,10 +56,10 @@ "vite": "3.2.6" }, "dependencies": { - "@visactor/vrender-core": "0.19.23", - "@visactor/vrender-kits": "0.19.23", + "@visactor/vrender-core": "0.19.24", + "@visactor/vrender-kits": "0.19.24", "@visactor/vchart": "workspace:1.11.11", - "@visactor/vrender": "0.19.23", + "@visactor/vrender": "0.19.24", "@visactor/vutils": "~0.18.10" } } From b52950edbc3b0181e52988b1c181c5555a51a77e Mon Sep 17 00:00:00 2001 From: skie1997 Date: Wed, 14 Aug 2024 03:42:20 +0800 Subject: [PATCH 30/35] fix: gange angle compute limit error --- packages/vchart/src/series/gauge/gauge.ts | 11 +++++++++-- packages/vchart/src/util/math.ts | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/vchart/src/series/gauge/gauge.ts b/packages/vchart/src/series/gauge/gauge.ts index 5effa1a1d8..0397e5629d 100644 --- a/packages/vchart/src/series/gauge/gauge.ts +++ b/packages/vchart/src/series/gauge/gauge.ts @@ -16,6 +16,7 @@ import type { IMark } from '../../mark/interface'; import { GaugeSeriesSpecTransformer } from './gauge-transformer'; import { registerArcMark, type IArcMark } from '../../mark/arc'; import { registerPolarLinearAxis } from '../../component/axis/polar'; +import { valueInRange } from '../../util'; export class GaugeSeries extends ProgressLikeSeries { static readonly type: string = SeriesTypeEnum.gauge; @@ -133,13 +134,19 @@ export class GaugeSeries extends protected _getAngleValueStartWithoutMask(datum: Datum) { const startAngle = this._getAngleValueStartWithoutPadAngle(datum); const endAngle = this._getAngleValueEndWithoutPadAngle(datum); - return Math.min(startAngle + this._padAngle / 2, (startAngle + endAngle) / 2); + return valueInRange(startAngle + (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2), [ + startAngle, + (startAngle + endAngle) / 2 + ]); } protected _getAngleValueEndWithoutMask(datum: Datum) { const startAngle = this._getAngleValueStartWithoutPadAngle(datum); const endAngle = this._getAngleValueEndWithoutPadAngle(datum); - return Math.max(endAngle - this._padAngle / 2, (startAngle + endAngle) / 2); + return valueInRange(endAngle - (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2), [ + endAngle, + (startAngle + endAngle) / 2 + ]); } protected _getAngleValueStartWithoutPadAngle(datum: Datum) { diff --git a/packages/vchart/src/util/math.ts b/packages/vchart/src/util/math.ts index 56fa6ae439..dd706559f2 100644 --- a/packages/vchart/src/util/math.ts +++ b/packages/vchart/src/util/math.ts @@ -278,3 +278,12 @@ export function getPercentValue(valueList: number[], precision = 2) { return seats.map(entry => entry / digits); } + +export function valueInRange(v: number, range?: number[]) { + if (!range) { + return v; + } + const min = Math.min(range[0], range[range.length - 1]); + const max = Math.max(range[0], range[range.length - 1]); + return Math.min(Math.max(min, v), max); +} From 0122a8e8ba6fcc50630278314353fb5f5ca3de5c Mon Sep 17 00:00:00 2001 From: skie1997 Date: Wed, 14 Aug 2024 03:43:21 +0800 Subject: [PATCH 31/35] chore: rush change log --- .../vchart/fix-gauge-angle_2024-08-13-19-43.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json diff --git a/common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json b/common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json new file mode 100644 index 0000000000..8a3e05efcd --- /dev/null +++ b/common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": " git push --set-upstream origin fix/gauge-angle", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file From fa52d91cdd38b3ab2cb93ea3959b3957771f1639 Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Wed, 14 Aug 2024 10:59:02 +0800 Subject: [PATCH 32/35] docs: update richtext docs path --- .../tutorial_docs/{ => extend}/Richtext_and_Dom.md | 0 docs/assets/guide/menu.json | 14 +++++++------- .../tutorial_docs/{ => extend}/Richtext_and_Dom.md | 0 .../option/en/component/axis-common/axis-label.md | 2 +- .../en/component/indicator/indicator-item.md | 2 +- docs/assets/option/en/component/label.md | 2 +- docs/assets/option/en/component/legend-discrete.md | 11 ++++++----- .../option/zh/component/axis-common/axis-label.md | 2 +- .../zh/component/indicator/indicator-item.md | 2 +- docs/assets/option/zh/component/label.md | 4 ++-- docs/assets/option/zh/component/legend-discrete.md | 2 +- 11 files changed, 21 insertions(+), 20 deletions(-) rename docs/assets/guide/en/tutorial_docs/{ => extend}/Richtext_and_Dom.md (100%) rename docs/assets/guide/zh/tutorial_docs/{ => extend}/Richtext_and_Dom.md (100%) diff --git a/docs/assets/guide/en/tutorial_docs/Richtext_and_Dom.md b/docs/assets/guide/en/tutorial_docs/extend/Richtext_and_Dom.md similarity index 100% rename from docs/assets/guide/en/tutorial_docs/Richtext_and_Dom.md rename to docs/assets/guide/en/tutorial_docs/extend/Richtext_and_Dom.md diff --git a/docs/assets/guide/menu.json b/docs/assets/guide/menu.json index 99778a5557..a328238b9b 100644 --- a/docs/assets/guide/menu.json +++ b/docs/assets/guide/menu.json @@ -548,6 +548,13 @@ "zh": "自定义 mark", "en": "Custom Mark" } + }, + { + "path": "Richtext_and_Dom", + "title": { + "zh": "富文本和 Dom 扩展", + "en": "Richtext and dom extension" + } } ] }, @@ -827,13 +834,6 @@ "en": "Function" } }, - { - "path": "Richtext_and_Dom", - "title": { - "zh": "富文本和 Dom 扩展", - "en": "Richtext and dom extension" - } - }, { "path": "Chart_Plugins", "title": { diff --git a/docs/assets/guide/zh/tutorial_docs/Richtext_and_Dom.md b/docs/assets/guide/zh/tutorial_docs/extend/Richtext_and_Dom.md similarity index 100% rename from docs/assets/guide/zh/tutorial_docs/Richtext_and_Dom.md rename to docs/assets/guide/zh/tutorial_docs/extend/Richtext_and_Dom.md diff --git a/docs/assets/option/en/component/axis-common/axis-label.md b/docs/assets/option/en/component/axis-common/axis-label.md index 4c6828039a..f4432f7892 100644 --- a/docs/assets/option/en/component/axis-common/axis-label.md +++ b/docs/assets/option/en/component/axis-common/axis-label.md @@ -57,7 +57,7 @@ formatMethod: text => { }; ``` -For specific usage of rich text, please refer to the[Rich Text Tutorial Document](/vchart/guide/tutorial_docs/Richtext_and_Dom) +For specific usage of rich text, please refer to the[Rich Text Tutorial Document](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #${prefix} formatter(string | string[]) diff --git a/docs/assets/option/en/component/indicator/indicator-item.md b/docs/assets/option/en/component/indicator/indicator-item.md index 348a708b45..1701a499ba 100644 --- a/docs/assets/option/en/component/indicator/indicator-item.md +++ b/docs/assets/option/en/component/indicator/indicator-item.md @@ -51,7 +51,7 @@ Strategies employed in adaptive text computing. Options: IFormatMethod<[activeDatum: Datum]> | ITextMarkSpec['text'] | ReturnType>; ``` -支持返回富文本配置,html 配置、react 配置,更详细的使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/Richtext_and_Dom) +支持返回富文本配置,html 配置、react 配置,更详细的使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #${prefix} style(Object) diff --git a/docs/assets/option/en/component/label.md b/docs/assets/option/en/component/label.md index 175a25e9e2..06dc8240dd 100644 --- a/docs/assets/option/en/component/label.md +++ b/docs/assets/option/en/component/label.md @@ -58,7 +58,7 @@ formatMethod: text => { }; ``` -For specific usage of rich text, please refer to the[Rich Text Tutorial Document](/vchart/guide/tutorial_docs/Richtext_and_Dom) +For specific usage of rich text, please refer to the[Rich Text Tutorial Document](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #${prefix} formatter(string) diff --git a/docs/assets/option/en/component/legend-discrete.md b/docs/assets/option/en/component/legend-discrete.md index a90098c9d5..ff8fbb4fae 100644 --- a/docs/assets/option/en/component/legend-discrete.md +++ b/docs/assets/option/en/component/legend-discrete.md @@ -24,10 +24,11 @@ Whether or not to enable the checking of the legend, the default is on. ### selectMode(string) = 'multiple' -The check mode of the legend, with optional values: -* `'multiple'` multiple selection mode -* `'single'` single selection mode -* `'focus'` focus selection mode +The check mode of the legend, with optional values: + +- `'multiple'` multiple selection mode +- `'single'` single selection mode +- `'focus'` focus selection mode ### scale(string) @@ -465,7 +466,7 @@ formatMethod: text => { }; ``` -For specific usage of rich text, please refer to the[Rich Text Tutorial Document](/vchart/guide/tutorial_docs/Richtext_and_Dom) +For specific usage of rich text, please refer to the[Rich Text Tutorial Document](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #### formatter(string | string[]) diff --git a/docs/assets/option/zh/component/axis-common/axis-label.md b/docs/assets/option/zh/component/axis-common/axis-label.md index ec815e0671..05a1f300f5 100644 --- a/docs/assets/option/zh/component/axis-common/axis-label.md +++ b/docs/assets/option/zh/component/axis-common/axis-label.md @@ -56,7 +56,7 @@ formatMethod: text => { }; ``` -更详细的富文本使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/Richtext_and_Dom) +更详细的富文本使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #${prefix} formatter(string|string[]) diff --git a/docs/assets/option/zh/component/indicator/indicator-item.md b/docs/assets/option/zh/component/indicator/indicator-item.md index 1ceaccd36d..e273c6e703 100644 --- a/docs/assets/option/zh/component/indicator/indicator-item.md +++ b/docs/assets/option/zh/component/indicator/indicator-item.md @@ -51,7 +51,7 @@ IFormatMethod<[activeDatum: Datum]> | ITextMarkSpec['text'] | ReturnType>; ``` -支持返回富文本配置,html 配置、react 配置,更详细的使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/Richtext_and_Dom) +支持返回富文本配置,html 配置、react 配置,更详细的使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #${prefix} style(Object) diff --git a/docs/assets/option/zh/component/label.md b/docs/assets/option/zh/component/label.md index 19eaea81fc..15a1475125 100644 --- a/docs/assets/option/zh/component/label.md +++ b/docs/assets/option/zh/component/label.md @@ -12,7 +12,7 @@ 自 1.7.0 版本支持,文本类型。`1.10.0`版本后,建议使用 `formatMethod` 配置富文本。 -富文本的具体使用方式,请参考[富文本教程文档](/vchart/guide/tutorial_docs/Richtext_and_Dom) +富文本的具体使用方式,请参考[富文本教程文档](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) 可选: @@ -58,7 +58,7 @@ formatMethod: text => { }; ``` -更详细的富文本使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/Richtext_and_Dom) +更详细的富文本使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) #${prefix} formatter(string) diff --git a/docs/assets/option/zh/component/legend-discrete.md b/docs/assets/option/zh/component/legend-discrete.md index d09e9df81d..c753c266f5 100644 --- a/docs/assets/option/zh/component/legend-discrete.md +++ b/docs/assets/option/zh/component/legend-discrete.md @@ -459,7 +459,7 @@ formatMethod: text => { }; ``` -更详细的富文本使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/Richtext_and_Dom) +更详细的富文本使用方式请参考[富文本教程](/vchart/guide/tutorial_docs/extend/Richtext_and_Dom) ##### style(Object|Function) From d00da3cc36163ce58f07415e1b07010552621d33 Mon Sep 17 00:00:00 2001 From: xile611 Date: Wed, 14 Aug 2024 14:44:26 +0800 Subject: [PATCH 33/35] fix: rename to _computeLayoutRadius --- packages/vchart/src/component/axis/polar/axis.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vchart/src/component/axis/polar/axis.ts b/packages/vchart/src/component/axis/polar/axis.ts index 44923b14af..b04ac6df54 100644 --- a/packages/vchart/src/component/axis/polar/axis.ts +++ b/packages/vchart/src/component/axis/polar/axis.ts @@ -314,7 +314,7 @@ export abstract class PolarAxis this.id, getSpec: () => this._spec @@ -518,7 +518,7 @@ export abstract class PolarAxis { From 8d856236e25c608ffab03dbc8567c2de15782cf7 Mon Sep 17 00:00:00 2001 From: skie1997 Date: Wed, 14 Aug 2024 15:01:58 +0800 Subject: [PATCH 34/35] fix: use vutil clamp to replace valueInrange method --- packages/vchart/src/series/gauge/gauge.ts | 11 +++++------ packages/vchart/src/util/math.ts | 9 --------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/vchart/src/series/gauge/gauge.ts b/packages/vchart/src/series/gauge/gauge.ts index 0397e5629d..6791db5630 100644 --- a/packages/vchart/src/series/gauge/gauge.ts +++ b/packages/vchart/src/series/gauge/gauge.ts @@ -9,14 +9,13 @@ import type { Datum } from '@visactor/vgrammar-core'; import type { IStateAnimateSpec } from '../../animation/spec'; import { animationConfig, userAnimationConfig } from '../../animation/utils'; import { gaugeSeriesMark } from './constant'; -import { degreeToRadian, isValid } from '@visactor/vutils'; +import { clamper, degreeToRadian, isValid } from '@visactor/vutils'; import { Factory } from '../../core/factory'; import { registerProgressLikeAnimation } from '../polar/progress-like'; import type { IMark } from '../../mark/interface'; import { GaugeSeriesSpecTransformer } from './gauge-transformer'; import { registerArcMark, type IArcMark } from '../../mark/arc'; import { registerPolarLinearAxis } from '../../component/axis/polar'; -import { valueInRange } from '../../util'; export class GaugeSeries extends ProgressLikeSeries { static readonly type: string = SeriesTypeEnum.gauge; @@ -134,19 +133,19 @@ export class GaugeSeries extends protected _getAngleValueStartWithoutMask(datum: Datum) { const startAngle = this._getAngleValueStartWithoutPadAngle(datum); const endAngle = this._getAngleValueEndWithoutPadAngle(datum); - return valueInRange(startAngle + (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2), [ + return clamper( startAngle, (startAngle + endAngle) / 2 - ]); + )(startAngle + (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2)); } protected _getAngleValueEndWithoutMask(datum: Datum) { const startAngle = this._getAngleValueStartWithoutPadAngle(datum); const endAngle = this._getAngleValueEndWithoutPadAngle(datum); - return valueInRange(endAngle - (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2), [ + return clamper( endAngle, (startAngle + endAngle) / 2 - ]); + )(endAngle - (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2)); } protected _getAngleValueStartWithoutPadAngle(datum: Datum) { diff --git a/packages/vchart/src/util/math.ts b/packages/vchart/src/util/math.ts index dd706559f2..56fa6ae439 100644 --- a/packages/vchart/src/util/math.ts +++ b/packages/vchart/src/util/math.ts @@ -278,12 +278,3 @@ export function getPercentValue(valueList: number[], precision = 2) { return seats.map(entry => entry / digits); } - -export function valueInRange(v: number, range?: number[]) { - if (!range) { - return v; - } - const min = Math.min(range[0], range[range.length - 1]); - const max = Math.max(range[0], range[range.length - 1]); - return Math.min(Math.max(min, v), max); -} From a874103fb6a751113afca7a75987b193ef814caa Mon Sep 17 00:00:00 2001 From: xile611 Date: Wed, 14 Aug 2024 15:14:48 +0000 Subject: [PATCH 35/35] build: release version 1.11.12 --- .../vchart/develop_2024-08-08-14-10.json | 11 - ...at-pie-layout-radius_2024-08-09-04-21.json | 11 - .../feat-region-padding_2024-08-09-05-30.json | 11 - .../fix-brush-error_2024-08-09-07-07.json | 10 - ...x-funnel-seriesField_2024-08-12-10-52.json | 10 - .../fix-gauge-angle_2024-08-13-19-43.json | 10 - .../fix-harmony-event_2024-08-12-02-50.json | 10 - ...x-react-vchart-types_2024-08-12-01-34.json | 11 - ...ltip-of-multi-region_2024-08-08-14-06.json | 11 - ...ix-update-spec-cases_2024-08-09-01-40.json | 11 - ...ix-update-spec-cases_2024-08-09-02-15.json | 11 - ...ix-update-spec-cases_2024-08-09-02-48.json | 11 - common/config/rush/pnpm-lock.yaml | 20 +- common/config/rush/version-policies.json | 2 +- docs/package.json | 6 +- packages/block-vchart/block/vchart/index.js | 2 +- .../harmony_vchart/library/oh-package.json5 | 2 +- .../library/src/main/ets/vchart_dist.js | 387 ++++++++++-------- packages/lark-vchart/package.json | 2 +- packages/lark-vchart/src/vchart/index.js | 2 +- packages/openinula-vchart/package.json | 4 +- packages/react-vchart/package.json | 4 +- packages/taro-vchart/package.json | 4 +- packages/tt-vchart/src/vchart/index.js | 2 +- packages/vchart-extension/package.json | 2 +- packages/vchart-schema/package.json | 2 +- packages/vchart-schema/vchart.json | 108 +++-- packages/vchart-types/package.json | 2 +- .../types/chart/polar/interface.d.ts | 5 +- .../types/component/axis/polar/axis.d.ts | 4 +- .../component/axis/polar/interface/spec.d.ts | 5 +- .../component/axis/polar/util/common.d.ts | 3 + .../vchart-types/types/core/interface.d.ts | 18 +- .../types/data/transforms/pie.d.ts | 8 +- .../vchart-types/types/model/interface.d.ts | 1 + .../types/series/pie/interface.d.ts | 3 + .../vchart-types/types/series/pie/pie.d.ts | 3 +- packages/vchart/CHANGELOG.json | 45 ++ packages/vchart/CHANGELOG.md | 36 +- packages/vchart/dist/index-wx-simple.min.js | 2 +- packages/vchart/package.json | 4 +- packages/vutils-extension/package.json | 2 +- .../wx-vchart/miniprogram/src/vchart/index.js | 2 +- packages/wx-vchart/package.json | 2 +- tools/story-player/package.json | 2 +- 45 files changed, 451 insertions(+), 373 deletions(-) delete mode 100644 common/changes/@visactor/vchart/develop_2024-08-08-14-10.json delete mode 100644 common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json delete mode 100644 common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json delete mode 100644 common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json delete mode 100644 common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json delete mode 100644 common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json delete mode 100644 common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json delete mode 100644 common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json delete mode 100644 common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json delete mode 100644 common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json delete mode 100644 common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json delete mode 100644 common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json diff --git a/common/changes/@visactor/vchart/develop_2024-08-08-14-10.json b/common/changes/@visactor/vchart/develop_2024-08-08-14-10.json deleted file mode 100644 index 9afcfc5619..0000000000 --- a/common/changes/@visactor/vchart/develop_2024-08-08-14-10.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix params of tickCount in linear-axis-mixin, fix #3053\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json b/common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json deleted file mode 100644 index 1609b555d9..0000000000 --- a/common/changes/@visactor/vchart/feat-pie-layout-radius_2024-08-09-04-21.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: support `layoutRadius` of pie\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json b/common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json deleted file mode 100644 index 79cee72f5c..0000000000 --- a/common/changes/@visactor/vchart/feat-region-padding_2024-08-09-05-30.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix `padding` of region not work\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json b/common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json deleted file mode 100644 index 5f498c5a76..0000000000 --- a/common/changes/@visactor/vchart/fix-brush-error_2024-08-09-07-07.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: brush error after legend filter. fix#3061", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json b/common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json deleted file mode 100644 index 8dc09ca3b7..0000000000 --- a/common/changes/@visactor/vchart/fix-funnel-seriesField_2024-08-12-10-52.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: fix funnel chart color bug with different category and series fields", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json b/common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json deleted file mode 100644 index 8a3e05efcd..0000000000 --- a/common/changes/@visactor/vchart/fix-gauge-angle_2024-08-13-19-43.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": " git push --set-upstream origin fix/gauge-angle", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json b/common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json deleted file mode 100644 index 1bb8efa1aa..0000000000 --- a/common/changes/@visactor/vchart/fix-harmony-event_2024-08-12-02-50.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: fix issue with harmony event", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json b/common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json deleted file mode 100644 index 0f6f75d35a..0000000000 --- a/common/changes/@visactor/vchart/fix-react-vchart-types_2024-08-12-01-34.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix type error of react vchart, fix #3065\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json b/common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json deleted file mode 100644 index d3e12e25d3..0000000000 --- a/common/changes/@visactor/vchart/fix-tooltip-of-multi-region_2024-08-08-14-06.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: tooltip should show when chart has multiple regions\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json deleted file mode 100644 index 104a584929..0000000000 --- a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-01-40.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix the issue background of chart not updated, fix #3054\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json deleted file mode 100644 index 711a47c7c8..0000000000 --- a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-15.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix the update of `startAngle` and `endAngle` in pie chart, fix #3059\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json b/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json deleted file mode 100644 index 1760bd0419..0000000000 --- a/common/changes/@visactor/vchart/fix-update-spec-cases_2024-08-09-02-48.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix switch `visible` of legend, fix #3060\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "dingling112@gmail.com" -} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 63c7a98554..4818b1ec94 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -16,9 +16,9 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/openinula-vchart': workspace:1.11.11 - '@visactor/react-vchart': workspace:1.11.11 - '@visactor/vchart': workspace:1.11.11 + '@visactor/openinula-vchart': workspace:1.11.12 + '@visactor/react-vchart': workspace:1.11.12 + '@visactor/vchart': workspace:1.11.12 '@visactor/vchart-theme': ~1.6.6 '@visactor/vgrammar': 0.13.20 '@visactor/vmind': 1.2.4-alpha.5 @@ -135,7 +135,7 @@ importers: '@types/node': '*' '@types/offscreencanvas': 2019.6.4 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.11.11 + '@visactor/vchart': workspace:1.11.12 '@visactor/vgrammar-core': 0.13.20 '@visactor/vrender-core': 0.19.24 '@visactor/vrender-kits': 0.19.24 @@ -200,7 +200,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.11.11 + '@visactor/vchart': workspace:1.11.12 '@visactor/vgrammar-core': 0.13.20 '@visactor/vrender-core': 0.19.24 '@visactor/vrender-kits': 0.19.24 @@ -282,7 +282,7 @@ importers: '@types/webpack-env': ^1.13.6 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.11.11 + '@visactor/vchart': workspace:1.11.12 '@vitejs/plugin-react': 3.1.0 babel-preset-taro: 3.3.17 eslint: ~8.18.0 @@ -373,7 +373,7 @@ importers: '@visactor/vrender-kits': 0.19.24 '@visactor/vscale': ~0.18.10 '@visactor/vutils': ~0.18.10 - '@visactor/vutils-extension': workspace:1.11.11 + '@visactor/vutils-extension': workspace:1.11.12 canvas: 2.11.2 cross-env: ^7.0.3 d3-array: ^1.2.4 @@ -477,7 +477,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': workspace:1.11.11 + '@visactor/vchart': workspace:1.11.12 '@visactor/vrender-core': 0.19.24 '@visactor/vrender-kits': 0.19.24 '@visactor/vutils': ~0.18.10 @@ -838,7 +838,7 @@ importers: '@types/node': '*' '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.11.11 + '@visactor/vchart': workspace:1.11.12 '@visactor/vrender': 0.19.24 '@visactor/vrender-core': 0.19.24 '@visactor/vrender-kits': 0.19.24 @@ -5005,7 +5005,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.24.7_@babel+core@7.20.12 magic-string: 0.27.0 react-refresh: 0.14.2 - vite: 3.2.6 + vite: 3.2.6_@types+node@20.14.11 transitivePeerDependencies: - supports-color dev: true diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 8b7e54c4b7..aa9518473f 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.11.11","mainProject":"@visactor/vchart","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.11.12","mainProject":"@visactor/vchart","nextBump":"patch"}] diff --git a/docs/package.json b/docs/package.json index 5bd139cead..96e318fb21 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,9 +12,9 @@ }, "dependencies": { "@arco-design/web-react": "2.46.1", - "@visactor/openinula-vchart": "workspace:1.11.11", - "@visactor/react-vchart": "workspace:1.11.11", - "@visactor/vchart": "workspace:1.11.11", + "@visactor/openinula-vchart": "workspace:1.11.12", + "@visactor/react-vchart": "workspace:1.11.12", + "@visactor/vchart": "workspace:1.11.12", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~0.18.10", diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index a57ced9648..1c51451f12 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(Mt.source,"g");function wt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Lt=Math.abs,Ot=Math.atan2,It=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Vt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Yt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Kt(t,e){return Ut(t+e,10**Math.max(Yt(t),Yt(e)))}function Xt(t,e){return Ut(t-e,10**Math.max(Yt(t),Yt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class qt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Zt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Jt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Jt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Qt extends Jt{}function te(t){return t*(Math.PI/180)}function ee(t){return 180*t/Math.PI}const ie=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function se(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ne(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function re(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ae(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=re(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new oe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new oe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new oe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ee(r.rotateDeg),r}}class le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function he(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ce(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const de=/^#([0-9a-f]{3,8})$/,ue={transparent:4294967040},pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return S(t)?new ye(t>>16,t>>8&255,255&t,1):y(t)?new ye(t[0],t[1],t[2]):new ye(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ve(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class _e{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof _e?t:new _e(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(ue[t]))return function(t){return S(t)?new ye(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ye(t[0],t[1],t[2],t[3]):new ye(255,255,255,1)}(ue[t]);if(p(pe[t]))return me(pe[t]);const e=`${t}`.trim().toLowerCase(),i=de.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ye((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=he(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ye(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=_e.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ye(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=ce(this.color.r,this.color.g,this.color.b),r=he(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ye(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=de.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new ye((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?me(s):8===n?new ye(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=pe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _e(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ve(t.color.r),this.color.g=ve(t.color.g),this.color.b=ve(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ye{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${ge(this.r)+ge(this.g)+ge(this.b)+(1===this.opacity?"":ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ye(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ce});function Se(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ae,ke,Me,Te,we,Ce,Ee,Pe;function Be(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Le(t,e,i){return null===t?e:null===e?t:(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,i&&(Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>=Ce||ke<=we||Me>=Pe||Te<=Ee?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ae,we),y1:Math.max(Me,Ee),x2:Math.min(ke,Ce),y2:Math.min(Te,Pe)})}var Oe;function Ie(t,e,i){return!(t&&e&&(i?(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee]),Ae>Ce||kePe||Tee.x2||t.x2e.y2||t.y2ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),t.x>=Ae&&t.x<=ke&&t.y>=Me&&t.y<=Te):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Fe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function je(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function ze(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function He(t,e){const i=e?t.angle:te(t.angle),s=ze(t);return[je({x:t.x1,y:t.y1},i,s),je({x:t.x2,y:t.y1},i,s),je({x:t.x2,y:t.y2},i,s),je({x:t.x1,y:t.y2},i,s)]}let Ne,Ve,Ge,We;function Ue(t){return Ne=1/0,Ve=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ne>t.x&&(Ne=t.x),Get.y&&(Ve=t.y),Wee&&r>s||rn?o:0}function qe(t,e){return Math.abs(t-e)0&&Ke(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Je=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";const ti=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ei(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ii(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function si(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const ni=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ri=6371008.8,ai={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ri,kilometers:6371.0088,kilometres:6371.0088,meters:ri,metres:ri,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ri/1852,radians:1,yards:6967335.223679999};function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function hi(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===De(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ci(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=te(t[0]),r=te(t[1]),a=te(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ai[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:ee(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:ee(l)}}class di{static getInstance(){return di.instance||(di.instance=new di),di.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let pi;function gi(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class mi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vi(t){let e;if(e=fi.exec(t))return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const _i=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class yi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}newFormat(t){const e=vi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):bi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=bi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?_i[8+pi/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=vi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=ui(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=_i[8+n/3];return function(t){return s(r*t)+a}}}const bi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gi(100*t,e),r:gi,s:function(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(pi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+ui(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function xi(){return new Si}function Si(){this.reset()}Si.prototype={constructor:Si,reset:function(){this.s=this.t=0},add:function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},valueOf:function(){return this.s}};var Ai=new Si;function ki(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Mi=1e-6,Ti=Math.PI,wi=Ti/2,Ci=Ti/4,Ei=2*Ti,Pi=180/Ti,Bi=Ti/180,Ri=Math.abs,Li=Math.atan,Oi=Math.atan2,Ii=Math.cos,Di=Math.exp,Fi=Math.log,ji=Math.pow,zi=Math.sin,Hi=Math.sign||function(t){return t>0?1:t<0?-1:0},Ni=Math.sqrt,Vi=Math.tan;function Gi(t){return t>1?0:t<-1?Ti:Math.acos(t)}function Wi(t){return t>1?wi:t<-1?-wi:Math.asin(t)}function Ui(){}function Yi(t,e){t&&Xi.hasOwnProperty(t.type)&&Xi[t.type](t,e)}var Ki={Feature:function(t,e){Yi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sTi?t+Math.round(-t/Ei)*Ei:t,e]}function os(t,e,i){return(t%=Ei)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Ti?e-Ei:e<-Ti?e+Ei:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Ii(t),s=zi(t),n=Ii(e),r=zi(e);function a(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*i+o*s;return[Oi(l*n-c*r,o*i-h*s),Wi(c*n+l*r)]}return a.invert=function(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*n-l*r;return[Oi(l*n+h*r,o*i+c*s),Wi(c*i-o*s)]},a}function ds(t,e){(e=Qi(e))[0]-=t,ns(e);var i=Gi(-e[1]);return((-e[2]<0?-i:i)+Ei-Mi)%Ei}function us(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ui,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return Ri(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function fs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ss(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function As(t,e,i,s){return function(n){var r,a,o,l=e(n),h=us(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=Ss(a);var t=function(t,e){var i=bs(e),s=e[1],n=zi(s),r=[zi(i),-Ii(i),0],a=0,o=0;ys.reset(),1===n?s=wi+Mi:-1===n&&(s=-wi-Mi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Ti,w=m*x;if(ys.add(Oi(w*k*zi(M),f*S+w*Ii(M))),a+=T?A+k*Ei:A,T^p>=i^y>=i){var C=es(Qi(u),Qi(_));ns(C);var E=es(r,C);ns(E);var P=(T^A>=0?-1:1)*Wi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Mi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ks))}return u}}function ks(t){return t.length>1}function Ms(t,e){return((t=t.x)[0]<0?t[1]-wi-Mi:wi-t[1])-((e=e.x)[0]<0?e[1]-wi-Mi:wi-e[1])}1===(vs=xs).length&&(_s=vs,vs=function(t,e){return xs(_s(t),e)});var Ts=As((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ti:-Ti,l=Ri(r-i);Ri(l-Ti)0?wi:-wi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ti&&(Ri(i-n)Mi?Li((zi(e)*(r=Ii(s))*zi(i)-zi(s)*(n=Ii(e))*zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*wi,s.point(-Ti,n),s.point(0,n),s.point(Ti,n),s.point(Ti,0),s.point(Ti,-n),s.point(0,-n),s.point(-Ti,-n),s.point(-Ti,0),s.point(-Ti,n);else if(Ri(t[0]-e[0])>Mi){var r=t[0]0,n=Ri(e)>Mi;function r(t,i){return Ii(t)*Ii(i)>e}function a(t,i,s){var n=[1,0,0],r=es(Qi(t),Qi(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=es(n,r),u=ss(n,h);is(u,ss(r,c));var p=d,g=ts(u,p),m=ts(p,p),f=g*g-m*(ts(u,u)-1);if(!(f<0)){var v=Ni(f),_=ss(p,(-g-v)/m);if(is(_,u),_=Ji(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ri(_[0]-b)Ti^(b<=_[0]&&_[0]<=x)){var T=ss(p,(-g+v)/m);return is(T,u),[_,Ji(T)]}}}function o(e,i){var n=s?t:Ti-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return As(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Ti:-Ti),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ps(e,p)||ps(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Ii(e),o=zi(e),l=s*i;null==n?(n=e+s*Ei,r=e-l/2):(n=ds(a,n),r=ds(a,r),(s>0?nr)&&(n+=s*Ei));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ri(s[0]-t)0?0:3:Ri(s[0]-i)0?2:1:Ri(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=us(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Ss(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ms(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Es,Math.min(Cs,g)),m=Math.max(Es,Math.min(Cs,m))],b=[r=Math.max(Es,Math.min(Cs,r)),a=Math.max(Es,Math.min(Cs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Bs(t){return t}var Rs,Ls,Os,Is,Ds=xi(),Fs=xi(),js={point:Ui,lineStart:Ui,lineEnd:Ui,polygonStart:function(){js.lineStart=zs,js.lineEnd=Vs},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=Ui,Ds.add(Ri(Fs)),Fs.reset()},result:function(){var t=Ds/2;return Ds.reset(),t}};function zs(){js.point=Hs}function Hs(t,e){js.point=Ns,Rs=Os=t,Ls=Is=e}function Ns(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Vs(){Ns(Rs,Ls)}var Gs=js,Ws=1/0,Us=Ws,Ys=-Ws,Ks=Ys;var Xs,$s,qs,Zs,Js={point:function(t,e){tYs&&(Ys=t);eKs&&(Ks=e)},lineStart:Ui,lineEnd:Ui,polygonStart:Ui,polygonEnd:Ui,result:function(){var t=[[Ws,Us],[Ys,Ks]];return Ys=Ks=-(Us=Ws=1/0),t}},Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln=0,hn={point:cn,lineStart:dn,lineEnd:gn,polygonStart:function(){hn.lineStart=mn,hn.lineEnd=fn},polygonEnd:function(){hn.point=cn,hn.lineStart=dn,hn.lineEnd=gn},result:function(){var t=ln?[an/ln,on/ln]:rn?[sn/rn,nn/rn]:en?[Qs/en,tn/en]:[NaN,NaN];return Qs=tn=en=sn=nn=rn=an=on=ln=0,t}};function cn(t,e){Qs+=t,tn+=e,++en}function dn(){hn.point=un}function un(t,e){hn.point=pn,cn(qs=t,Zs=e)}function pn(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,cn(qs=t,Zs=e)}function gn(){hn.point=cn}function mn(){hn.point=vn}function fn(){_n(Xs,$s)}function vn(t,e){hn.point=_n,cn(Xs=qs=t,$s=Zs=e)}function _n(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,an+=(n=Zs*t-qs*e)*(qs+t),on+=n*(Zs+e),ln+=3*n,cn(qs=t,Zs=e)}var yn=hn;function bn(t){this._context=t}bn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ei)}},result:Ui};var xn,Sn,An,kn,Mn,Tn=xi(),wn={point:Ui,lineStart:function(){wn.point=Cn},lineEnd:function(){xn&&En(Sn,An),wn.point=Ui},polygonStart:function(){xn=!0},polygonEnd:function(){xn=null},result:function(){var t=+Tn;return Tn.reset(),t}};function Cn(t,e){wn.point=En,Sn=kn=t,An=Mn=e}function En(t,e){kn-=t,Mn-=e,Tn.add(Ni(kn*kn+Mn*Mn)),kn=t,Mn=e}var Pn=wn;function Bn(){this._string=[]}function Rn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ln(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Zi(t,i(s))),s.result()}return r.area=function(t){return Zi(t,i(Gs)),Gs.result()},r.measure=function(t){return Zi(t,i(Pn)),Pn.result()},r.bounds=function(t){return Zi(t,i(Js)),Js.result()},r.centroid=function(t){return Zi(t,i(yn)),yn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Bs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Bn):new bn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function On(t){return function(e){var i=new In;for(var s in t)i[s]=t[s];return i.stream=e,i}}function In(){}function Dn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Zi(i,t.stream(Js)),e(Js.result()),null!=s&&t.clipExtent(s),t}function Fn(t,e,i){return Dn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function jn(t,e,i){return Fn(t,[[0,0],e],i)}function zn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Hn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Bn.prototype={_radius:4.5,_circle:Rn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Rn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},In.prototype={constructor:In,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Nn=16,Vn=Ii(30*Bi);function Gn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Ni(b*b+x*x+S*S),k=Wi(S/=A),M=Ri(Ri(S)-1)e||Ri((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Bi:0,E()):[f*Pi,v*Pi,_*Pi]},w.angle=function(t){return arguments.length?(y=t%360*Bi,E()):y*Pi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Gn(o,T=t*t),P()):Ni(T)},w.fitExtent=function(t,e){return Fn(w,t,e)},w.fitSize=function(t,e){return jn(w,t,e)},w.fitWidth=function(t,e){return zn(w,t,e)},w.fitHeight=function(t,e){return Hn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function $n(t){var e=0,i=Ti/3,s=Xn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Bi,i=t[1]*Bi):[e*Pi,i*Pi]},n}function qn(t,e){var i=zi(t),s=(i+zi(e))/2;if(Ri(s)2?t[2]*Bi:0),e.invert=function(e){return(e=t.invert(e[0]*Bi,e[1]*Bi))[0]*=Pi,e[1]*=Pi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===sr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function rr(t){return Vi((wi+t)/2)}function ar(t,e){var i=Ii(t),s=t===e?zi(t):Fi(i/Ii(e))/Fi(rr(e)/rr(t)),n=i*ji(rr(t),s)/s;if(!s)return sr;function r(t,e){n>0?e<-wi+Mi&&(e=-wi+Mi):e>wi-Mi&&(e=wi-Mi);var i=n/ji(rr(e),s);return[i*zi(s*t),n-i*Ii(s*t)]}return r.invert=function(t,e){var i=n-e,r=Hi(s)*Ni(t*t+i*i),a=Oi(t,Ri(i))*Hi(i);return i*s<0&&(a-=Ti*Hi(t)*Hi(i)),[a/s,2*Li(ji(n/r,1/s))-wi]},r}function or(t,e){return[t,e]}function lr(t,e){var i=Ii(t),s=t===e?zi(t):(i-Ii(e))/(e-t),n=i/s+t;if(Ri(s)Mi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},vr.invert=tr(Wi),_r.invert=tr((function(t){return 2*Li(t)})),yr.invert=function(t,e){return[-e,2*Li(Di(t))-wi]};var Sr={exports:{}},Ar=function(t,e){this.p1=t,this.p2=e};Ar.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ar.prototype.run=function(){return this.p2[0]-this.p1[0]},Ar.prototype.slope=function(){return this.rise()/this.run()},Ar.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ar.prototype.isVertical=function(){return!isFinite(this.slope())},Ar.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ar.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ar.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ar.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ar.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var kr=Ar,Mr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new kr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Mr(t.slice(0,s),e),o=Mr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Tr=Mr;!function(t){var e=Tr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Cr(Br,e),{tolerance:s}=i;return wr(t,s)};var Lr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Lr||(Lr={}));const Or=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+zr(e,6):zr(e,4))+"-"+zr(t.getUTCMonth()+1,2)+"-"+zr(t.getUTCDate(),2)+(r?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"."+zr(r,3)+"Z":n?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"Z":s||i?"T"+zr(i,2)+":"+zr(s,2)+"Z":"")}function Nr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Dr;if(h)return h=!1,Ir;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.DSV;const i=Cr(Wr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Nr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Vr(t)},Kr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Gr(t)};function Xr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return $r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return $r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zr(t);default:throw new Error("unknown GeoJSON type")}}function $r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qr(t.properties),e.geometry=Zr(t.geometry),e}function qr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=qr(s):e[i]=s})),e):e}function Zr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Zr(t)})),e):(e.coordinates=Jr(t.coordinates),e)}function Jr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Jr(t)}))}function Qr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ta(t){for(var e,i,s=Qr(t),n=0,r=1;r0}function ea(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Xr(t));var r=[];switch(t.type){case"GeometryCollection":return ia(t,(function(t){na(t,s)})),t;case"FeatureCollection":return ea(t,(function(t){ea(na(t,s),(function(t){r.push(t)}))})),li(r)}return na(t,s)}function na(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ia(t,(function(t){na(t,e)})),t;case"LineString":return ra(Qr(t),e),t;case"Polygon":return aa(Qr(t),e),t;case"MultiLineString":return Qr(t).forEach((function(t){ra(t,e)})),t;case"MultiPolygon":return Qr(t).forEach((function(t){aa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ra(t,e){ta(t)===e&&t.reverse()}function aa(t,e){ta(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=oa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},da=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.GEO;const i=Cr(ha,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ca(t))})):e.push(ca(t))})),e})(t);let o=t.features;return a&&(o=sa(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=la.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=la.bounds(t);t.bbox=e}})),t.features=o,t},ua={},pa=(t,e,i)=>{i.type=Lr.GEO;const s=Cr(ha,ua,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return xr(a,t)}))}:xr(a,o));var a,o;return da(r,s,i)},ga=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ma=0;function fa(){return ma>1e8&&(ma=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ma++}class va{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:fa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const _a="_data-view-diff-rank";class ya{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:fa("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[_a]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[_a]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[_a]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Or),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ba{static GenAutoIncrementId(){return ba.auto_increment_id++}}ba.auto_increment_id=0;class xa{constructor(t){this.id=ba.GenAutoIncrementId(),this.registry=t}}const Sa="named",Aa="inject",ka="multi_inject",Ma="inversify:tagged",Ta="inversify:paramtypes";class wa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Sa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ca=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ea(e,0,s,t)}}function Ba(t){return e=>(i,s,n)=>Pa(new wa(t,e))(i,s,n)}const Ra=Ba(Aa),La=Ba(ka);function Oa(){return function(t){return Ca.defineMetadata(Ta,null,t),t}}function Ia(t){return Pa(new wa(Sa,t))}const Da="Singleton",Fa="Transient",ja="ConstantValue",za="DynamicValue",Ha="Factory",Na="Function",Va="Instance",Ga="Invalid";class Wa{constructor(t,e){this.id=ba.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ga,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wa(this.serviceIdentifier,this.scope);return t.activated=t.scope===Da&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ua{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ca.getMetadata(Ta,t),userGeneratedMetadata:Ca.getMetadata(Ma,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ya=(Ka=Sa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ka&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const qa=Symbol("ContributionProvider");class Za{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ja(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).inSingletonScope().whenTargetNamed(e)}class Qa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class to extends Qa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const eo=Symbol.for("EnvContribution"),io=Symbol.for("VGlobal");var so=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},no=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ro=function(t,e){return function(i,s){e(i,s,t)}};let ao=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ba.GenAutoIncrementId(),this.hooks={onSetEnv:new to(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ao=so([Oa(),ro(0,Ra(qa)),ro(0,Ia(eo)),no("design:paramtypes",[Object])],ao);const oo=Bt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,mo,fo,vo,_o,yo;var bo,xo,So,Ao,ko,Mo,To,wo,Co;function Eo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Po(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=te(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Lo(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Go extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Wo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Uo(t,e,i){const s=null!=e?e:Lt(i[i.length-1].x-i[0].x)>Lt(i[i.length-1].y-i[0].y)?To.ROW:To.COLUMN;return"monotoneY"===t?new Go(t,s):new Vo(t,s)}class Yo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ko(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new Yo(n,s),t),n}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("basis",i,t);return function(t,e){Wo(t,e)}(new $o(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneX",i,t);return function(t,e){Wo(t,e)}(new el(n,s),t),n}function nl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneY",i,t);return function(t,e){Wo(t,e)}(new il(n,s),t),n}let rl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function al(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Lt(t[t.length-1].x-t[0].x)>Lt(t[t.length-1].y-t[0].y)?To.ROW:To.COLUMN);return function(t,e){Wo(t,e)}(new rl(r,e,n),t),r}class ol extends Yo{lineEnd(){this.context.closePath()}}function ll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new ol(n,s),t),n}function hl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function cl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Ko(i,n);const o=Uo(t,r,i);return Wo(new e(o,s,a),i),o}}const dl=cl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ul=cl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function pl(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}class gl extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[];Bo(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Lo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===To.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.y-e.p1.y)}if(this.direction===To.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const ml=["l",0,0,0,0,0,0,0];function fl(t,e,i){const s=ml[0]=t[0];if("a"===s||"A"===s)ml[1]=e*t[1],ml[2]=i*t[2],ml[3]=t[3],ml[4]=t[4],ml[5]=t[5],ml[6]=e*t[6],ml[7]=i*t[7];else if("h"===s||"H"===s)ml[1]=e*t[1];else if("v"===s||"V"===s)ml[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Rl=Object.assign(Object.assign({},kl),{points:[],cornerRadius:0,closePath:!0}),Ll=Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ol=Object.assign(Object.assign({},kl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},kl),xl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dl=Object.assign(Object.assign(Object.assign({},kl),xl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kl),{fill:!0,cornerRadius:0}),jl=Object.assign(Object.assign({},Fl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const zl=new class{},Hl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Nl=!0,Vl=!1,Gl=/\w|\(|\)|-/,Wl=/[.?!,;:/,。?!、;:]/,Ul=/\S/;function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=zl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Kl(t,a)),a}function Kl(t,e){let i=e;for(;Gl.test(t[i-1])&&Gl.test(t[i])||Wl.test(t[i]);)if(i--,i<=0)return e;return i}function Xl(t,e){const i=zl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var $l=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Il.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Kl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Kl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=$l([Oa()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Oa()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Fa,this.options=e,this.id=ba.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ua}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Sa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wa(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new $a(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Aa],multiInject:s[ka]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case ja:case Na:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Da&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,zl.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-xh&&txh||t<-xh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Rt)<0&&(t+=Rt),t}function fh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Ah=[-1,-1,-1],kh=[-1,-1];function Mh(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Th(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Ah);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Ah);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ah[0]=-l,Ah[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=Ah[0]+t&&a<=Ah[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=Ah[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=fh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Bh[0]=S,Bh[1]=A,Ph(Bh,Boolean(a[6])),S=Bh[0],A=Bh[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case po.M:u=f,p=v,c=u,d=p;break;case po.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=fh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case po.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=fh(c,d,o,l,s,n),i){if(yh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ch(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case po.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=fh(o,p,o,l,s,n),h+=fh(u,l,u,p,s,n);break;case po.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=fh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new to(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=zl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Oh([Oa(),Ih("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=zl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Lh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:xl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Qe(Object.assign({defaultFontParams:{fontFamily:xl.fontFamily,fontSize:xl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Oa(),Nh(0,Ra(qa)),Nh(0,Ia(Jl)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new oe;let Uh=class{constructor(){this.matrix=new oe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Oa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:Ml,area:Tl,circle:wl,line:Pl,path:Bl,symbol:Ol,text:Il,rect:Ll,polygon:Rl,richtext:Dl,richtextIcon:jl,image:Fl,group:Cl,glyph:El},Kh=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const $h={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Kh.forEach((t=>{this._defaultTheme[t]=Object.create($h[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Kh.forEach((s=>{const n=Object.create($h[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Kh.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ba.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class uc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{static Avaliable(){return!!zl.global.getRequestAnimationFrame()}avaliable(){return gc.Avaliable()}tick(t,e){zl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var mc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(mc||(mc={}));class fc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-fc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*fc.bounceIn(2*t):.5*fc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}fc.quadIn=fc.getPowIn(2),fc.quadOut=fc.getPowOut(2),fc.quadInOut=fc.getPowInOut(2),fc.cubicIn=fc.getPowIn(3),fc.cubicOut=fc.getPowOut(3),fc.cubicInOut=fc.getPowInOut(3),fc.quartIn=fc.getPowIn(4),fc.quartOut=fc.getPowOut(4),fc.quartInOut=fc.getPowInOut(4),fc.quintIn=fc.getPowIn(5),fc.quintOut=fc.getPowOut(5),fc.quintInOut=fc.getPowInOut(5),fc.backIn=fc.getBackIn(1.7),fc.backOut=fc.getBackOut(1.7),fc.backInOut=fc.getBackInOut(1.7),fc.elasticIn=fc.getElasticIn(1,.3),fc.elasticOut=fc.getElasticOut(1,.3),fc.elasticInOut=fc.getElasticInOut(1,.3*1.5);class vc{constructor(){this.id=ba.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ao.END?this.removeAnimate(e):e.status===Ao.RUNNING||e.status===Ao.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ao.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const _c=new vc;class yc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class bc extends yc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let xc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ba.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new Sc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&ko.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:So.ANIMATE_PLAY})}runCb(t){const e=new bc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===Ao.RUNNING&&(this.status=Ao.PAUSED)}resume(){this.status===Ao.PAUSED&&(this.status=Ao.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Sc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ao.RUNNING&&(this.status=Ao.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ao.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};xc.mode=ko.NORMAL,xc.interpolateMap=new Map;class Sc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Ac(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?fc[i]:i,n=this._addStep(e,null,s);return n.type=Mo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?fc[i]:i,r=this._addStep(e,null,n);return r.type=Mo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=Mo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Mo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Ac(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Ac{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Mc="cubicOut",Tc=1e3,wc="quadInOut";var Cc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Cc||(Cc={}));const Ec=[!1,!1,!1,!1],Pc=[0,0,0,0],Bc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Pc[0]=t[0],Pc[2]=t[0],Pc[1]=t[1],Pc[3]=t[1],Pc):t:t:0,Rc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Lc=[1,2,3,0,1,2,3,0];function Oc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Rc[0].x=i,Rc[1].y=i,Rc[2].x=-i,Rc[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(It(t)*i,jt(t)*i),s.add(It(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:zc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}zc.TimeOut=1e3/60;const Hc=new zc,Nc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Vc extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Yt(this.fromNumber),Yt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Gc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Gc||(Gc={}));class Wc extends yc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Ic(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Uc extends yc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:So.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:So.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Yc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=zl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Kc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=zl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Xc extends yc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class $c extends yc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?fc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function qc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Zc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{pt(e,s)&&pt(i,n)||t.push(e,i,s,n,s,n)};function sd(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function nd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function od(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),cd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},dd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Jt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return cd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return cd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);dd(n[0],s,i),dd(n[1],e-s,i)}};var ud;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ud||(ud={}));class pd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ud.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ud.Color1){const e=pd.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=_e.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];pd.store1[t]=e,pd.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=pd.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=_e.parseColorString(t);return n&&(pd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],pd.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===ud.Color1){if(pd.store1[t])return;pd.store1[t]=i,pd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(pd.store255[t])return;pd.store255[t]=i,pd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function gd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function md(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>fd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):fd(t,e,i,s,n)}function fd(t,e,i,s,n){if(!t||!e)return t&&gd(t)||e&&gd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=pd.Get(t,ud.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=pd.Get(e,ud.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:gd(a)})))});return o?md(r,l,i,s,n):md(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),gd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}pd.store255={},pd.store1={};const vd=[0,0,0,0],_d=[0,0,0,0];function yd(t,e,i){return pd.Get(t,ud.Color255,vd),pd.Get(e,ud.Color255,_d),`rgba(${Math.round(vd[0]+(_d[0]-vd[0])*i)},${Math.round(vd[1]+(_d[1]-vd[1])*i)},${Math.round(vd[2]+(_d[2]-vd[2])*i)},${vd[3]+(_d[3]-vd[3])*i})`}const bd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=md(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},xd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?sd(t):[],n=sd(e);i&&s&&(i.fromTransform&&nd(s,i.fromTransform.clone().getInverse()),nd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Ad=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],kd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Ad.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?pd.Get(t[n],ud.Color255):t[n],to:"string"==typeof r?pd.Get(r,ud.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class Md extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;xd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&bd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Td=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Sd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=kd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new Md({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Tc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wc)),c};class wd extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;xd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&bd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Cd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Fc.includes(t))(i)||(e[i]=t[i])})),e},Ed=(t,e,i)=>{const s=Cd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=zl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Pd=(t,e,i)=>{const s=[],n=i?null:Cd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Cd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ad(t.attribute),n=od(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(zl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=od(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=od(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ld(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ld(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(zl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:hd(i)}];const s=[];return dd(i,e,s),s})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return dd(r,e,h),h})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=sd(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(zl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Ed(t,s,e),s};class Rd{static GetImage(t,e){var i;const s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Rd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Rd.cache.set(t,s),s.dataPromise=zl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Rd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Rd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=zl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=zl.global.loadBlob(t):"json"===e&&(i.dataPromise=zl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Rd.isLoading&&Rd.toLoadAueue.length){Rd.isLoading=!0;const t=Rd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Rd.cache.set(i,n),n.dataPromise=zl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()})).catch((t=>{console.error(t),Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()}))}}),0)}static loadImage(t,e){const i=Ld(t,Rd.toLoadAueue);if(-1!==i)return Rd.toLoadAueue[i].marks.push(e),void Rd.loading();Rd.toLoadAueue.push({url:t,marks:[e]}),Rd.loading()}static improveImageLoading(t){const e=Ld(t,Rd.toLoadAueue);if(-1!==e){const t=Rd.toLoadAueue.splice(e,1);Rd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ld(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Qt,this._updateTag=bo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Hd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Hd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Hd.x=n,Hd.y=r;return Hd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new oe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(zl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Mc),c&&this.setAttributes(c,!1,{type:So.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:So.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bo.UPDATE_SHAPE_AND_BOUNDS)===bo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=bo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=bo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&bo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,scaleX:i=vl.scaleX,scaleY:s=vl.scaleY,angle:n=vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=It(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),zl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Od.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:So.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=md(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Jh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:zl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new gl).fromString(t):this.pathProxy=new gl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",zl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Vd.mixin(hc);class Gd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Wd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Yd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Kd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Wd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Gd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Xd(t,e){return $d(t)}function $d(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let eu=0;function iu(){return eu++}var su;function nu(t){const e=[];let i=0,s="";for(let n=0;nru.set(t,!0)));const au=new Map;function ou(t){if(ru.has(t))return!0;if(au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>au.set(t,!0)));const lu=iu(),hu=iu(),cu=iu(),du=iu(),uu=iu(),pu=iu(),gu=iu(),mu=iu(),fu=iu(),vu=iu();iu();const _u=iu();iu();const yu=iu(),bu=iu(),xu=iu(),Su=Symbol.for("GraphicService"),Au=Symbol.for("GraphicCreator"),ku={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Mu=Object.keys(ku);var Tu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tu||(Tu={}));let wu=class t extends Vd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=pu,this._childUpdateTag=bo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,dx:i=vl.dx,dy:s=vl.dy,scaleX:n=vl.scaleX,scaleY:r=vl.scaleY,angle:a=vl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Jh(this).group;this._AABBBounds.clear();const i=zl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Bc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),zl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),zl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,zl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{zl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=zl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cu(t){return new wu(t)}wu.NOWORK_ANIMATE_ATTR=Nd;class Eu extends wu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Pu=Symbol.for("TransformUtil"),Bu=Symbol.for("GraphicUtil"),Ru=Symbol.for("LayerService"),Lu=Symbol.for("StaticLayerHandlerContribution"),Ou=Symbol.for("DynamicLayerHandlerContribution"),Iu=Symbol.for("VirtualLayerHandlerContribution");var Du,Fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zu=Du=class{static GenerateLayerId(){return`${Du.idprefix}_${Du.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=zl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(Lu):"dynamic"===t?th.get(Ou):th.get(Iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Eu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Du.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};zu.idprefix="visactor_layer",zu.prefix_count=0,zu=Du=Fu([Oa(),ju("design:paramtypes",[])],zu);var Hu=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Dh).to(jh),t(Bu).to(Vh).inSingletonScope(),t(Pu).to(Uh).inSingletonScope(),t(Ru).to(zu).inSingletonScope()}));function Nu(t,e){return!(!t&&!e)}function Vu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Gu(t,e,i){return i&&t*e>0}function Wu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Uu(t,e){return t*e>0}function Yu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Ku(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $u(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Lt(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*It(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*It(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*It(f),P=n*jt(f),B=r*It(_),R=r*jt(_);let L,O,I,D;if((T>Ct||M>Ct)&&(L=n*It(v),O=n*jt(v),I=r*It(b),D=r*jt(b),hCt){const t=Ft(x,w),r=Ft(S,w),o=Xu(I,D,E,P,n,t,Number(c)),l=Xu(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,n,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*It(Ot(l.y01,l.x01)),s+l.cy+r*jt(Ot(l.y01,l.x01))):e.moveTo(i+L,s+n*jt(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*It(v),s+n*jt(v));if(!(r>Ct)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>Ct){const t=Ft(k,C),n=Ft(A,C),o=Xu(B,R,L,O,r,-n,Number(c)),l=Xu(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,r,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*It(Ot(l.y01,l.x01)),s+l.cy+t*jt(Ot(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*It(b),s+r*jt(b))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class qu{static GetCanvas(){try{return qu.canvas||(qu.canvas=zl.global.createCanvas({})),qu.canvas}catch(t){return null}}static GetCtx(){if(!qu.ctx){const t=qu.GetCanvas();qu.ctx=t.getContext("2d")}return qu.ctx}}class Zu extends le{static getInstance(){return Zu._instance||(Zu._instance=new Zu),Zu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=qu.GetCanvas(),s=qu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Zu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ju{static GetSize(t){for(let e=0;e=t)return Ju.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ju.GenKey(t,e,i,s,n),l=Ju.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ju.GenKey(t,e,i,s,n);Ju.cache[l]?Ju.cache[l].push({width:a,height:o,pattern:r}):Ju.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ju.cache={},Ju.ImageSize=[20,40,80,160,320,640,1280,2560];const Qu=Symbol.for("ArcRenderContribution"),tp=Symbol.for("AreaRenderContribution"),ep=Symbol.for("CircleRenderContribution"),ip=Symbol.for("GroupRenderContribution"),sp=Symbol.for("ImageRenderContribution"),np=Symbol.for("PathRenderContribution"),rp=Symbol.for("PolygonRenderContribution"),ap=Symbol.for("RectRenderContribution"),op=Symbol.for("SymbolRenderContribution"),lp=Symbol.for("TextRenderContribution"),hp=Symbol.for("InteractiveSubRenderContribution"),cp=["radius","startAngle","endAngle",...Dd];class dp extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=du}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Jh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateCircleAABBBounds(i,Jh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,cp)}needUpdateTag(t){return super.needUpdateTag(t,cp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new gl;return o.arc(0,0,n,r,a),o}clone(){return new dp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function up(t){return new dp(t)}function pp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function gp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}dp.NOWORK_ANIMATE_ATTR=Nd;class fp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=xu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Jh(this).text;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Jh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Nc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=zl.graphicUtil.textMeasure,k=new fp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===su.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=gp(x,o),M=mp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Jh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Nc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=zl.graphicUtil.textMeasure,y=new fp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Jh(this).text,a=zl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Nc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=gp(x,o),e=this.cache.verticalList.length*b,i=mp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>nu(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===su.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const k=gp(x,o),M=this.cache.verticalList.length*b,T=mp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yp(t){return new _p(t)}_p.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Nd),_p.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_p.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class bp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function xp(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Sp=new class extends bp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return xp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return xp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Ap=new class extends bp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function kp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Mp=new class extends bp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return kp(t,e/2+n,i,s,r)}};function Tp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var wp=new class extends bp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Tp(t,e/2+n,i,s)}};class Cp extends bp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Ep=new Cp;var Pp=new class extends Cp{constructor(){super(...arguments),this.type="triangle"}};const Bp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Rp=Math.sin(Bt/10)*Bp,Lp=-Math.cos(Bt/10)*Bp;function Op(t,e,i,s){const n=Rp*e,r=Lp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ip=new class extends bp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};const Dp=zt(3);function Fp(t,e,i,s){const n=e,r=n/Dp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var jp=new class extends bp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Fp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Fp(t,e/2+n,i,s)}};function zp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Hp=new class extends bp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return zp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return zp(t,e/2+n,i,s)}};function Np(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Vp=new class extends bp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};const Gp=-.5,Wp=zt(3)/2,Up=1/zt(12);function Yp(t,e,i,s){const n=e/2,r=e*Up,a=n,o=e*Up+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Gp*n-Wp*r+i,Wp*n+Gp*r+s),t.lineTo(Gp*a-Wp*o+i,Wp*a+Gp*o+s),t.lineTo(Gp*l-Wp*h+i,Wp*l+Gp*h+s),t.lineTo(Gp*n+Wp*r+i,Gp*r-Wp*n+s),t.lineTo(Gp*a+Wp*o+i,Gp*o-Wp*a+s),t.lineTo(Gp*l+Wp*h+i,Gp*h-Wp*l+s),t.closePath(),!1}var Kp=new class extends bp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Yp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Yp(t,e/2+n,i,s)}};var Xp=new class extends bp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends bp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var qp=new class extends bp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Zp=zt(3);function Jp(t,e,i,s){const n=e*Zp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Qp=new class extends Cp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Jp(t,e/2/Zp,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/2/Zp+n,i,s)}};function tg(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var eg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return tg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return tg(t,e/4+n,i,s)}};function ig(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var sg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return ig(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ig(t,e/4+n,i,s)}};function ng(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var rg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return ng(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ng(t,e/4+n,i,s)}};function ag(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var og=new class extends bp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ag(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ag(t,e/4+n,i,s)}};function lg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var hg=new class extends bp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return lg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return lg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function cg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var dg=new class extends bp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return cg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return cg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ug(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var pg=new class extends bp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return ug(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ug(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function mg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var fg=new class extends bp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?mg(t,e,i,s):gg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?mg(t,e+2*n,i,s):gg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const vg=new Qt;class _g{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;vg.x1=s.bounds.x1*t,vg.y1=s.bounds.y1*t,vg.x2=s.bounds.x2*t,vg.y2=s.bounds.y2*t,e.union(vg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const yg={};[Sp,Ap,Mp,wp,Qp,Pp,Ip,jp,Hp,Vp,Kp,Xp,$p,Ep,qp,eg,sg,rg,og,fg,hg,dg,pg].forEach((t=>{yg[t.type]=t}));const bg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},xg=new Qt,Sg=["symbolType","size",...Dd];let Ag=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Jh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=yg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=bg[i]||i,!0===((n=i).startsWith("{const e=(new gl).fromString(t.d),i={};Mu.forEach((e=>{t[e]&&(i[ku[e]]=t[e])})),r.push({path:e,attribute:i}),xg.union(e.bounds)}));const a=xg.width(),o=xg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new _g(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new gl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new _g(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Jh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateSymbolAABBBounds(i,Jh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new gl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new gl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.userSymbolMap={},Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Nd);const Mg=["segments","points","curveType","curveTension",...Dd];let Tg=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=mu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}doUpdateAABBBounds(){const t=Jh(this).line;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateLineAABBBounds(e,Jh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.attribute,e=new gl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const Cg=["width","x1","y1","height","cornerRadius",...Dd];class Eg extends Vd{constructor(t){super(t),this.type="rect",this.numberType=_u}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Jh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRectAABBBounds(e,Jh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ad(t),r=new gl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Nd;class Bg extends Vd{constructor(t){super(t),this.type="glyph",this.numberType=uu,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=zl.graphicService.updateGlyphAABBBounds(this.attribute,Jh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Bg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Nd;class Lg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Hl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Og{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Nc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Vl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Nl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Ig=["width","height","image",...Dd];class Dg extends Vd{constructor(t){super(t),this.type="image",this.numberType=gu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Jh(this).image;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateImageAABBBounds(e,Jh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Fl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ig)}needUpdateTag(t){return super.needUpdateTag(t,Ig)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Nd);class jg extends Dg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Bc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Bc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fl.width,height:e=Fl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class zg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Hl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Ul.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof jg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Xl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof jg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Hl[this.direction]}store(t){if(t instanceof jg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new zg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof jg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,s=Yl(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==s){const[e,i]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character),new Og(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Dd];class Vg extends Vd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Jh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRichTextAABBBounds(e,Jh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Lg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Hg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i,n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s)})),n}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Nd);const Wg=["path","customPath",...Dd];class Ug extends Vd{constructor(t){super(t),this.type="path",this.numberType=fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Jh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof gl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof gl?this.cache:t.path)}doUpdateAABBBounds(){const t=Jh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePathAABBBounds(e,Jh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new gl).fromString(t.path):t.customPath&&(this.cache=new gl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}toCustomPath(){return(new gl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Nd);const Kg=["segments","points","curveType","curveTension",...Dd];class Xg extends Vd{constructor(t){super(t),this.type="area",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Jh(this).area;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateAreaAABBBounds(e,Jh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){const t=new gl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Dd];class Zg extends Vd{constructor(t){super(t),this.type="arc",this.numberType=lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Jh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Jh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ie(e),i=e+r,s&&Lt(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Jh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Lt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Vt(Number(l)/o*jt(g)),n=Vt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Jh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateArcAABBBounds(i,Jh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}getDefaultAttribute(t){return Jh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Lt(i-e),a=i>e;if(n=Rt-Ct)o.moveTo(0+n*It(e),0+n*jt(e)),o.arc(0,0,n,e,i,!a),s>Ct&&(o.moveTo(0+s*It(i),0+s*jt(i)),o.arc(0,0,s,i,e,a));else{const t=n*It(e),r=n*jt(e),l=s*It(i),h=s*jt(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Nd);const Qg=["points","cornerRadius",...Dd];class tm extends Vd{constructor(t){super(t),this.type="polygon",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Jh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePolygonAABBBounds(e,Jh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){const t=this.attribute.points,e=new gl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new tm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tm.NOWORK_ANIMATE_ATTR}}function em(t){return new tm(t)}tm.NOWORK_ANIMATE_ATTR=Nd;class im extends wu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function sm(t){return new im(t)}class nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class rm extends nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;tu(i,s+(r+o)/2,!0,a)}return i}}class am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};function um(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function pm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function gm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),um(t,t,[n+o,r+l,a+h]),um(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),um(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=lm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}um(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),um(i,i,[-s[0],-s[1],0]),gm(t,t,i)}}let fm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new to(["graphic"]),onSetStage:new to(["graphic","stage"]),onRemove:new to(["graphic"]),onRelease:new to(["graphic"]),onAddIncremental:new to(["graphic","group","stage"]),onClearIncremental:new to(["graphic","group","stage"]),beforeUpdateAABBBounds:new to(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new to(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Qt,this.tempAABBBounds2=new Qt,this._rectBoundsContribitions=[new nm],this._symbolBoundsContribitions=[new rm],this._imageBoundsContribitions=[new nm],this._circleBoundsContribitions=[new nm],this._arcBoundsContribitions=[new nm],this._pathBoundsContribitions=[new nm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new lo(t);return Lo(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=mp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=gp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){tu(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Zt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Rt-Ct?i.set(-a,-a,a,a):Oc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=Ct?i.set(0,0,0,0):Math.abs(l-h)>Rt-Ct?i.set(-n,-n,n,n):(Oc(h,l,n,i),Oc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){tu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;tu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Zt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};fm=hm([Oa(),dm(0,Ra(Au)),cm("design:paramtypes",[Object])],fm);const vm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let _m,ym;function bm(t){return _m||(_m=vm.CreateGraphic("text",{})),_m.initAttributes(t),_m.AABBBounds}const xm={x:0,y:0,z:0,lastModelMatrix:null};class Sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Gu(o,l,n),p=Uu(o,c),g=Nu(n,r),m=Vu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;xm.x=n,xm.y=r,xm.z=a,xm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=lm.allocate(),n=lm.allocate();mm(n,t,e),gm(s,d||s,n),xm.x=0,xm.y=0,xm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),lm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,xm.z=a,i.setTransformForCurrent()}else if(p)xm.x=0,xm.y=0,xm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,this.transformWithoutTranslate(i,xm.x,xm.y,xm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),xm.x=0,xm.y=0,xm.z=0;return xm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Gu(d,u,h),y=Uu(d,g),b=Nu(h),x=Vu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Lo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&lm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Am=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class km{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(km.IsGradientStr(t))try{const e=Am(t)[0];if(e){if("linear"===e.type)return km.ParseLinear(e);if("radial"===e.type)return km.ParseRadial(e);if("conic"===e.type)return km.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Mm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};class Pm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Lh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Lh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Bm=new Pm;let Rm=class{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Rm=wm([Oa(),Em(0,Ra(qa)),Em(0,Ia(hp)),Cm("design:paramtypes",[Object])],Rm);class Lm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Lh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Lh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Om=new Lm;const Im=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),$u(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),$u(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Dm=Om,Fm=Bm;const jm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},zm=Om,Hm=Bm;const Nm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vm=Et/2;function Gm(t,e,i,s,n,r){let a;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))a=[r=Lt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Lt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Lt(t[0]),i=Lt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Lt(a[0]),a[1]=Lt(a[1]),a[2]=Lt(a[2]),a[3]=Lt(a[3])}}else a=[0,0,0,0];if(s<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,s,n);const[o,l,h,c]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],d=Math.min(s/2,n/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],m=[l[0]-u[1],l[1]],f=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],y=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(m[0],m[1]),!q(m,f)){const e=m[0],i=m[1]+u[1];t.arc(e,i,u[1],-Vm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Vm,!1)}if(t.lineTo(y[0],y[1]),!q(y,b)){const e=y[0],i=y[1]-u[3];t.arc(e,i,u[3],Vm,Et,!1)}if(t.lineTo(g[0],g[1]),!q(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],Et,Et+Vm,!1)}return t.closePath(),t}var Wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Um{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Gm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Gm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Ym=class{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ym=Wm([Oa()],Ym);let Km=class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke}=t.attribute;let{width:v,height:_}=t.attribute;if(v=(null!=v?v:u-g)||0,_=(null!=_?_:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+v,s):e.moveTo(i+v,s),f[1]?e.lineTo(i+v,s+_):e.moveTo(i+v,s+_),f[2]?e.lineTo(i,s+_):e.moveTo(i,s+_),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Km=Wm([Oa()],Km);const Xm=new Um,$m=Om,qm=Bm;const Zm=new class extends Um{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Bc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Gm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Qm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},tf=Om,ef=Bm;var sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rf=function(t,e){return function(i,s){e(i,s,t)}};let af=class extends Sm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=lu,this.builtinContributions=[Im,Fm,Dm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Lt(d-c),p=d>c;let g=!1;if(nCt||C>Ct)&&(D=n*It(x),F=n*jt(x),j=r*It(A),z=r*jt(A),uCt){const t=Ft(k,P),r=Ft(M,P),a=Xu(j,z,R,L,n,t,Number(p)),o=Xu(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>Ct)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>Ct){const t=Ft(w,B),n=Ft(T,B),a=Xu(O,I,D,F,r,-n,Number(p)),o=Xu(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Ot(a.y01,a.x01),Ot(a.y11,a.x11),!p);const t=Ot(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*It(A),s+r*jt(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Lt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Ec[s]=t,i&&(i=!(null!==(e=Ec[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ec[e]=!!t[e],i&&(i=!!Ec[e]);else Ec[0]=!1,Ec[1]=!1,Ec[2]=!1,Ec[3]=!1;return{isFullStroke:i,stroke:Ec}})(d);if((v||C)&&(e.beginPath(),$u(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),$u(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Lt(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),md(o.color,l.color,h,!1)}(0,0,h,n);a||Gu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};af=sf([Oa(),rf(0,Ra(qa)),rf(0,Ia(Qu)),nf("design:paramtypes",[Object])],af);var of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(i,s){e(i,s,t)}};let cf=class extends Sm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=du,this.builtinContributions=[jm,Hm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function df(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function uf(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),df(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=To.ROW:"y"===s?m=To.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gf=class extends Sm{constructor(){super(...arguments),this.numberType=mu}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=pl(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function mf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function ff(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),df(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),df(t,l,1,s),o=!1):o=!0}t.closePath()}gf=pf([Oa()],gf);const vf=new class extends Lm{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:jc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:jc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_f=Bm;var yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xf=function(t,e){return function(i,s){e(i,s,t)}};function Sf(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}let Af=class extends Sm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=cu,this.builtinContributions=[vf,_f],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S,doStroke:A}=x,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Sf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Sf(e,C,{curveTension:b}),n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=To.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Lt(E.x-P.x),L=Lt(E.y-P.y);B=null==E.x1?To.ROW:null==E.y1?To.COLUMN:Number.isFinite(R+L)?R>L?To.ROW:To.COLUMN:To.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),mf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),mf(t,e,i,s),e.length=0,i.length=0)}n=o})),mf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?To.ROW:To.COLUMN,Number.isFinite(u)||(h=To.COLUMN),Number.isFinite(p)||(h=To.ROW);const g=i*(h===To.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Sm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Mf,kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Lo(t.pathShape.commandList,e,i,s,1,1,g);else{Lo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(np)),wf("design:paramtypes",[Object])],Ef);var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rf=function(t,e){return function(i,s){e(i,s,t)}};let Lf=class extends Sm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=_u,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Wu(g,m,k,M,c),w=Yu(g,v,k,M),C=Nu(c,d),E=Vu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Gm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(ap)),Bf("design:paramtypes",[Object])],Lf);var Of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Df=function(t,e){return function(i,s){e(i,s,t)}};let Ff=class extends Sm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bu,this.builtinContributions=[Qm,ef,tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Ff=Of([Oa(),Df(0,Ra(qa)),Df(0,Ia(op)),If("design:paramtypes",[Object])],Ff);const jf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Qt)}allocate(t,e,i,s){if(!this.pools.length)return(new Qt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Qt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const zf=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=jf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=bm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Gm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&jf.free(C),w()}};var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Sm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xu,this.builtinContributions=[zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Nc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=om.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),om.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=gp(l,f),_=mp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Wf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Sm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=vu,this.builtinContributions=[Xf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Wf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Uf(d,u),b=Uf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Yf(h,_,y,d,u),A=Yf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Uf(k,M),w=Yf(h,Uf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(rp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=pu}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Wu(u,f,p,g,h),k=Yu(u,v,p,g),M=Nu(h,c),T=Vu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Gm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Nm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave(),n.baseGlobalAlpha*=a;const o=Jh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=lm.allocate(),i=lm.allocate();mm(i,t,o),gm(e,l||e,i),n.modelMatrix=e,lm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&n.translate(h,c),s&&s.drawingCb&&(d=s.drawingCb()),n.modelMatrix!==l&&lm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};iv=Qf([Oa(),ev(0,Ra(qa)),ev(0,Ia(ip)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];let ov=class extends Sm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=gu,this.builtinContributions=[Zm,Jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Gm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,av[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Rd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};ov=sv([Oa(),rv(0,Ra(qa)),rv(0,Ia(sp)),nv("design:paramtypes",[Object])],ov);const lv=Symbol.for("IncrementalDrawContribution"),hv=Symbol.for("ArcRender"),cv=Symbol.for("AreaRender"),dv=Symbol.for("CircleRender"),uv=Symbol.for("GraphicRender"),pv=Symbol.for("GroupRender"),gv=Symbol.for("LineRender"),mv=Symbol.for("PathRender"),fv=Symbol.for("PolygonRender"),vv=Symbol.for("RectRender"),_v=Symbol.for("SymbolRender"),yv=Symbol.for("TextRender"),bv=Symbol.for("RichTextRender"),xv=Symbol.for("GlyphRender"),Sv=Symbol.for("ImageRender"),Av=Symbol.for("DrawContribution");var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tv=Symbol.for("DrawItemInterceptor"),wv=new Qt,Cv=new Qt;class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){wv.copy(s.dirtyBounds),Cv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(wv),s.backupDirtyBounds.copy(Cv)),!0}}class Pv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Bv=class{constructor(){this.order=1,this.interceptors=[new Ev,new Lv,new Rv,new Pv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===hu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&lm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};const Fv=Symbol.for("RenderService");let jv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jv=Ov([Oa(),Dv(0,Ra(Av)),Iv("design:paramtypes",[Object])],jv);var zv=new xa((t=>{t(Fv).to(jv)}));const Hv=Symbol.for("PickerService"),Nv=Symbol.for("GlobalPickerService");var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Gv=Symbol.for("PickItemInterceptor");let Wv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=om.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Wv=Vv([Oa()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Uv=Vv([Oa()],Uv);let Yv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===hu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Yv=Vv([Oa()],Yv);var Kv=new xa(((t,e,i)=>{i(Hv)||(t(Nv).toSelf(),t(Hv).toService(Nv)),t(Yv).toSelf().inSingletonScope(),t(Gv).toService(Yv),t(Wv).toSelf().inSingletonScope(),t(Gv).toService(Wv),t(Uv).toSelf().inSingletonScope(),t(Gv).toService(Uv),Ja(t,Gv)})),Xv=new xa((t=>{t(Su).to(fm).inSingletonScope(),t(Au).toConstantValue(vm)}));const $v=Symbol.for("AutoEnablePlugins"),qv=Symbol.for("PluginService");var Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qv=function(t,e){return function(i,s){e(i,s,t)}};let t_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound($v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};t_=Zv([Oa(),Qv(0,Ra(qa)),Qv(0,Ia($v)),Jv("design:paramtypes",[Object])],t_);var e_=new xa((t=>{t(qv).to(t_),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,$v)})),i_=new xa((t=>{Ja(t,eo)})),s_=new xa((t=>{t(Jl).to(Ql).inSingletonScope(),Ja(t,Jl)})),n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let a_=class{constructor(){this.type="static",this.offscreen=!1,this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};a_=n_([Oa(),r_("design:paramtypes",[])],a_);var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let h_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=zl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};h_=o_([Oa(),l_("design:paramtypes",[])],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=sh({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};u_=c_([Oa(),d_("design:paramtypes",[])],u_);var p_=new xa((t=>{t(a_).toSelf(),t(u_).toSelf(),t(h_).toSelf(),t(Lu).toService(a_),t(Ou).toService(u_),t(Iu).toService(h_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function m_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return g_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function v_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Jt,this.backupDirtyBounds=new Jt,this.global=zl.global,this.layerService=zl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,om.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,kl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ie(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=jf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=om.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):m_(t,kl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jf.free(n),om.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(lv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends gf{constructor(){super(...arguments),this.numberType=mu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Gu(u,p,c),_=Uu(u,g),y=Nu(c),b=Vu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Oa()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Af{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Gu(u,d,c),m=Nu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Oa()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let B_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new to([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,kl.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield f_(t,kl.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};B_=w_([Oa(),E_(0,La(uv)),E_(1,Ra(A_)),E_(2,Ra(M_)),E_(3,Ra(qa)),E_(3,Ia(Tv)),C_("design:paramtypes",[Array,Object,Object,Object])],B_);var R_=new xa((t=>{t(Pm).toSelf().inSingletonScope(),t(Lm).toSelf().inSingletonScope(),t(Av).to(x_),t(lv).to(B_),t(pv).to(iv).inSingletonScope(),t(uv).toService(pv),Ja(t,ip),t(Rm).toSelf().inSingletonScope(),Ja(t,hp),Ja(t,uv),t(Bv).toSelf().inSingletonScope(),t(Tv).toService(Bv),Ja(t,Tv)}));function L_(){L_.__loaded||(L_.__loaded=!0,th.load(Hu),th.load(Xv),th.load(zv),th.load(Kv),th.load(e_),function(t){t.load(i_),t.load(s_),t.load(p_)}(th),function(t){t.load(R_)}(th))}L_.__loaded=!1,L_();const O_=th.get(io);zl.global=O_;const I_=th.get(Bu);zl.graphicUtil=I_;const D_=th.get(Pu);zl.transformUtil=D_;const F_=th.get(Su);zl.graphicService=F_;const j_=th.get(Ru);zl.layerService=j_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),zl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class H_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),zl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){zl.graphicService.hooks.onAddIncremental.taps=zl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onClearIncremental.taps=zl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,zl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class V_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.unTap(this.key),zl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?zl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:zl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=ni(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Jh(t).text)}getTransformOfText(t){const e=Jh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=ti(h,c);o=t.x,l=t.y}const p=zl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));zl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===zl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&zl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===zl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const G_=new Qt;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(G_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(G_,t.parent&&t.parent.globalTransMatrix)))})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),zl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.taps=zl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const U_=new Qt;class Y_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ba.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Qt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Jh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&U_.copy(s)})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(U_.equals(i)||this.tryLayout(t,!1))})),zl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const K_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===mc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=mc.INITIAL,zl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),zl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:gc},{mode:"timeout",cons:pc},{mode:"manual",cons:uc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==mc.INITIAL&&(this.status=mc.PAUSE,!0)}resume(){return this.status!==mc.INITIAL&&(this.status=mc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===mc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===mc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=mc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=mc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};K_.addTimeline(_c),K_.setFPS(60);class X_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=pd.Get(e,ud.Color1),this.ambient=i;const s=zt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Ft(Dt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?pd.Get(e,ud.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function $_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function q_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Z_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&zl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ey="white";class iy extends wu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ey}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=zl.global,!this.global.env&&Q_()&&this.global.setEnv("browser"),this.window=th.get(Dh),this.renderService=th.get(Fv),this.pluginService=th.get(qv),this.layerService=th.get(Ru),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ey,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||K_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new vc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new X_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Z_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new H_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Jt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Y_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new V_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new ty))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=th.get(Hv));const i=this.pickerService.pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry=new oe(1,0,0,1,0,0),ay={x:0,y:0};let oy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this.path=new gl,this._clearMatrix=new oe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ay),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,ay.x,ay.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ay);const i=Mm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,ay.x,ay.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ry,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};oy=sy([Oa(),ny("design:paramtypes",[Object,Number])],oy);var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cy={WIDTH:500,HEIGHT:500,DPR:1};let dy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=cy.WIDTH,height:n=cy.HEIGHT,dpr:r=cy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};dy.env="browser",dy=ly([Oa(),hy("design:paramtypes",[Object])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let py=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Qt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};py=uy([Oa()],py);var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fy=class{constructor(){this._uid=ba.GenAutoIncrementId(),this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};fy=gy([Oa(),my("design:paramtypes",[])],fy);var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yy=function(t,e){return function(i,s){e(i,s,t)}};let by=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=zl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Qt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new oe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=lm.allocate();if(pm(i,e),a){if(i){const t=lm.allocate();r.modelMatrix=gm(t,a,i),lm.free(i)}}else pm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&lm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),om.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function xy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&xy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&xy(t,a,i,s,n))}function Sy(t,e){const i=t.length-1,s=[t[0]];return xy(t,0,i,e,s),s.push(t[i]),s}by=vy([Oa(),yy(0,Ra(qa)),yy(0,Ia(Gv)),_y("design:paramtypes",[Object])],by);let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(af).toSelf().inSingletonScope(),t(hv).to(af).inSingletonScope(),t(uv).toService(hv),t(Qu).toService(Rm),Ja(t,Qu))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(Lf).toSelf().inSingletonScope(),t(vv).to(Lf).inSingletonScope(),t(uv).toService(vv),t(Km).toSelf(),t(Ym).toSelf(),t(ap).toService(Km),t(ap).toService(Ym),t(ap).toService(Rm),Ja(t,ap))}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(gf).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(gv).to(gf).inSingletonScope(),t(uv).toService(gv))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(Af).toSelf().inSingletonScope(),t(cv).to(Af).inSingletonScope(),t(uv).toService(cv),t(tp).toService(Rm),Ja(t,tp),t(M_).toSelf().inSingletonScope())}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(Ff).toSelf().inSingletonScope(),t(_v).to(Ff).inSingletonScope(),t(uv).toService(_v),t(op).toService(Rm),Ja(t,op))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(cf).toSelf().inSingletonScope(),t(dv).to(cf).inSingletonScope(),t(uv).toService(dv),t(ep).toService(Rm),Ja(t,ep))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(yv).to(Gf).inSingletonScope(),t(uv).toService(yv),t(lp).toService(Rm),Ja(t,lp))}));let Fy=!1;const jy=new xa((t=>{Fy||(Fy=!0,t(Ef).toSelf().inSingletonScope(),t(mv).to(Ef).inSingletonScope(),t(uv).toService(mv),t(np).toService(Rm),Ja(t,np))}));let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(fv).to(Jf).inSingletonScope(),t(uv).toService(fv),t(rp).toService(Rm),Ja(t,rp))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vy=class{constructor(){this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Vy=Ny([Oa()],Vy);let Gy=!1;const Wy=new xa((t=>{Gy||(Gy=!0,t(xv).to(Vy).inSingletonScope(),t(uv).toService(xv))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=class extends Sm{constructor(){super(),this.numberType=yu,this.builtinContributions=[zf],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Gu(o,l,!0),d=Gu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Gm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};Ky=Uy([Oa(),Yy("design:paramtypes",[])],Ky);let Xy=!1;const $y=new xa((t=>{Xy||(Xy=!0,t(bv).to(Ky).inSingletonScope(),t(uv).toService(bv))}));let qy=!1;const Zy=new xa((t=>{qy||(qy=!0,t(Sv).to(ov).inSingletonScope(),t(uv).toService(Sv),t(sp).toService(Rm),Ja(t,sp))}));const Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Q_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),db=t=>e=>R(e,t),ub=t=>{at.getInstance().error(t)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ub("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ub("Access path missing closing bracket: "+t),a&&ub("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return cb((i&&i.get||db)(s),[n],e||n)},gb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>pb(t,e,i)));return t=>s.map((e=>e(t)))}return pb(t,e,i)};gb("id");const mb=cb((function(t){return t}),[],"identity"),fb=cb((function(){return 0}),[],"zero");cb((function(){return 1}),[],"one"),cb((function(){return!0}),[],"true"),cb((function(){return!1}),[],"false"),cb((function(){return{}}),[],"emptyObject");const vb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>_b(t,r,n)))))},yb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function bb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function xb(t,e,i,s,n){let r=0,a=0;return bb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Sb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;bb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xb(t,e,i,n,h)}}function Ab(t){return"horizontal"===t}function kb(t){return"vertical"===t}const Mb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Tb extends wu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,Mb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Mb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const tx=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},ex=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ix extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||tx(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=ex(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=ex(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=tx(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ac.now()-i>this.config.press.time&&ex(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rx=[0,0,0];let ax=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},_l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},xl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this._clearMatrix=new oe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new oe(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ju.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=zl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:xl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:xl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=Tm(this,l,t,i,s)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=Mm(this,l,this.dpr),r.strokeStyle=Tm(this,h,t,i,s),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=pp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=pp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};ax.env="browser",ax=sx([Oa(),nx("design:paramtypes",[Object,Number])],ax);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hx=class extends dy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=zl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ax(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function cx(t,e){return new xa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}hx.env="browser",hx=ox([Oa(),lx("design:paramtypes",[Object])],hx);const dx=cx(hx,ax);var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let mx=class extends by{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Lh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vx=class{constructor(){this.type="group",this.numberType=pu}contains(t,e,i){return!1}};vx=fx([Oa()],vx);const _x=new xa(((t,e,i,s)=>{_x.__vloaded||(_x.__vloaded=!0,t(Zb).to(vx).inSingletonScope(),t(Jb).toService(Zb),Ja(t,Jb))}));_x.__vloaded=!1;var yx=_x;const bx=new xa(((t,e,i,s)=>{i(mx)||t(mx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(mx):t(Hv).toService(mx)}));var xx,Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=xx=class extends fy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${xx.idprefix}_${xx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=zl.global,this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:xx.GenerateCanvasId(),canvasControled:!0};this.canvas=new hx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new hx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};kx.env="browser",kx.idprefix="visactor_window",kx.prefix_count=0,kx=xx=Sx([Oa(),Ax("design:paramtypes",[])],kx);const Mx=new xa((t=>{t(kx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(kx))).whenTargetNamed(kx.env)}));var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends py{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Qt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ba.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Tx([Oa(),wx("design:paramtypes",[])],Px);const Bx=new xa((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(eo).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(dx),t.load(Mx),e&&function(t){t.load(yx),t.load(bx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ox=class extends ax{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};Ox.env="feishu",Ox=Lx([Oa()],Ox);var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fx=class extends dy{constructor(t){super(t)}init(){this._context=new Ox(this,this._dpr)}release(){}};Fx.env="feishu",Fx=Ix([Oa(),Dx("design:paramtypes",[Object])],Fx);const jx=cx(Fx,Ox);var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};class Vx{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Gx=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new Vx}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Fx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Gx.env="feishu",Gx=zx([Oa(),Nx(0,Ra(io)),Hx("design:paramtypes",[Object])],Gx);const Wx=new xa((t=>{t(Gx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Gx))).whenTargetNamed(Gx.env)}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends by{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new oy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xx=Ux([Oa(),Kx(0,Ra(qa)),Kx(0,Ia(wb)),Kx(1,Ra(qa)),Kx(1,Ia(Gv)),Yx("design:paramtypes",[Object,Object])],Xx);const $x=new xa((t=>{$x.__vloaded||($x.__vloaded=!0,Ja(t,wb))}));$x.__vloaded=!1;var qx=$x,Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([Oa(),Qx(0,Ra(hv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new xa(((t,e,i,s)=>{eS||(eS=!0,t(Cb).to(tS).inSingletonScope(),t(wb).toService(Cb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};aS=sS([Oa(),rS(0,Ra(cv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new xa(((t,e,i,s)=>{oS||(oS=!0,t(Eb).to(aS).inSingletonScope(),t(wb).toService(Eb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([Oa(),dS(0,Ra(dv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new xa(((t,e,i,s)=>{pS||(pS=!0,t(Pb).to(uS).inSingletonScope(),t(wb).toService(Pb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};_S=mS([Oa(),vS(0,Ra(xv)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(jb).to(_S).inSingletonScope(),t(_S).toService(jb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};SS=xS([Oa()],SS);let AS=!1;const kS=new xa(((t,e,i,s)=>{AS||(AS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([Oa(),wS(0,Ra(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new xa(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(wb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OS=BS([Oa(),LS(0,Ra(fv)),RS("design:paramtypes",[Object])],OS);let IS=!1;const DS=new xa(((t,e,i,s)=>{IS||(IS=!0,t(Fb).to(OS).inSingletonScope(),t(wb).toService(Fb))}));var FS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zS=function(t,e){return function(i,s){e(i,s,t)}};let HS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};HS=FS([Oa(),zS(0,Ra(mv)),jS("design:paramtypes",[Object])],HS);let NS=!1;const VS=new xa(((t,e,i,s)=>{NS||(NS=!0,t(Lb).to(HS).inSingletonScope(),t(wb).toService(Lb))}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},US=function(t,e){return function(i,s){e(i,s,t)}};const YS=new Qt;let KS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;YS.setValue(i.x1,i.y1,i.x2,i.y2),YS.expand(-r/2),h=!YS.containsPoint(e)}}return s.highPerformanceRestore(),h}};KS=GS([Oa(),US(0,Ra(vv)),WS("design:paramtypes",[Object])],KS);let XS=!1;const $S=new xa(((t,e,i,s)=>{XS||(XS=!0,t(Ob).to(KS).inSingletonScope(),t(wb).toService(Ob))}));let qS=!1;const ZS=new xa(((t,e,i,s)=>{qS||(qS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};eA=JS([Oa(),tA(0,Ra(_v)),QS("design:paramtypes",[Object])],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Ib).to(eA).inSingletonScope(),t(wb).toService(Ib))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class{constructor(){this.type="text",this.numberType=xu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};rA=nA([Oa()],rA);let aA=!1;const oA=new xa(((t,e,i,s)=>{aA||(aA=!0,t(Db).to(rA).inSingletonScope(),t(wb).toService(Db))})),lA=new xa(((t,e,i,s)=>{i(Xx)||t(Xx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(Xx):t(Hv).toService(Xx)}));class hA{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uA=class extends py{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new hA(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};uA=cA([Oa(),dA("design:paramtypes",[])],uA);const pA=new xa((t=>{pA.isFeishuBound||(pA.isFeishuBound=!0,t(uA).toSelf().inSingletonScope(),t(eo).toService(uA))}));function gA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];gA.__loaded||(gA.__loaded=!0,t.load(pA),t.load(jx),t.load(Wx),e&&function(t){t.load(qx),t.load(lA),t.load(iS),t.load(lS),t.load(gS),t.load(bS),t.load(kS),t.load(PS),t.load(DS),t.load(VS),t.load($S),t.load(ZS),t.load(sA),t.load(oA)}(t))}pA.isFeishuBound=!1,gA.__loaded=!1;var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends ax{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vA.env="node",vA=mA([Oa(),fA("design:paramtypes",[Object,Number])],vA);var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bA=class extends dy{constructor(t){super(t)}init(){this._context=new vA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bA.env="node",bA=_A([Oa(),yA("design:paramtypes",[Object])],bA);const xA=cx(bA,vA);var SA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,s){e(i,s,t)}};let MA=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new bA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};MA.env="node",MA=SA([Oa(),kA(0,Ra(io)),AA("design:paramtypes",[Object])],MA);const TA=new xa((t=>{t(MA).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(MA))).whenTargetNamed(MA.env)}));var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CA=class extends py{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};CA=wA([Oa()],CA);const EA=new xa((t=>{EA.isNodeBound||(EA.isNodeBound=!0,t(CA).toSelf().inSingletonScope(),t(eo).toService(CA))}));function PA(t){PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(xA),t.load(TA))}EA.isNodeBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([Oa(),LA(0,Ra(hv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new xa(((t,e,i,s)=>{IA||(IA=!0,t(zb).to(OA).inSingletonScope(),t(Jb).toService(zb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Qt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([Oa(),zA(0,Ra(vv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new xa(((t,e,i,s)=>{VA||(VA=!0,t(Ub).to(NA).inSingletonScope(),t(Jb).toService(Ub))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends Sm{};UA=WA([Oa()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Jh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([Oa(),XA(0,Ra(gv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new xa(((t,e,i,s)=>{qA||(qA=!0,t(Gb).to($A).inSingletonScope(),t(Jb).toService(Gb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([Oa(),tk(0,Ra(cv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new xa(((t,e,i,s)=>{ik||(ik=!0,t(Hb).to(ek).inSingletonScope(),t(Jb).toService(Hb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Jh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&lm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([Oa(),ak(0,Ra(_v)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new xa(((t,e,i,s)=>{lk||(lk=!0,t(Yb).to(ok).inSingletonScope(),t(Jb).toService(Yb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([Oa(),uk(0,Ra(dv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new xa(((t,e,i,s)=>{gk||(gk=!0,t(Nb).to(pk).inSingletonScope(),t(Jb).toService(Nb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Jh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=mp(a,u,n),v=gp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&lm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([Oa(),_k(0,Ra(yv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new xa(((t,e,i,s)=>{bk||(bk=!0,t(Kb).to(yk).inSingletonScope(),t(Jb).toService(Kb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([Oa(),kk(0,Ra(mv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new xa(((t,e,i,s)=>{Tk||(Tk=!0,t(Wb).to(Mk).inSingletonScope(),t(Jb).toService(Wb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([Oa(),Pk(0,Ra(fv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new xa(((t,e,i,s)=>{Rk||(Rk=!0,t(Xb).to(Bk).inSingletonScope(),t(Jb).toService(Xb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([Oa(),Dk(0,Ra(xv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new xa(((t,e,i,s)=>{jk||(jk=!0,t(qb).to(Fk).inSingletonScope(),t(Jb).toService(qb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([Oa(),Vk(0,Ra(bv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t($b).to(Gk).inSingletonScope(),t(Jb).toService($b))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([Oa()],Kk);let Xk=!1;const $k=new xa(((t,e,i,s)=>{Xk||(Xk=!0,t(Vb).to(Kk).inSingletonScope(),t(Jb).toService(Vb))})),qk=Q_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,vm.RegisterGraphicCreator("arc",Jg),th.load(ky),th.load(qk?DA:iS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,vm.RegisterGraphicCreator("area",$g),th.load(Py),th.load(qk?sk:lS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,vm.RegisterGraphicCreator("circle",up),th.load(Oy),th.load(qk?mk:gS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,vm.RegisterGraphicCreator("glyph",Rg),th.load(Wy),th.load(qk?zk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,vm.RegisterGraphicCreator("group",Cu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,vm.RegisterGraphicCreator("image",Fg),th.load(Zy),th.load(qk?$k:kS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,vm.RegisterGraphicCreator("line",wg),th.load(Cy),th.load(qk?ZA:PS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,vm.RegisterGraphicCreator("path",Yg),th.load(jy),th.load(qk?wk:VS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,vm.RegisterGraphicCreator("polygon",em),th.load(Hy),th.load(qk?Lk:DS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,vm.RegisterGraphicCreator("rect",Pg),th.load(Ty),th.load(qk?GA:$S))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,vm.RegisterGraphicCreator("richtext",Gg),th.load($y),th.load(qk?Uk:ZS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,vm.RegisterGraphicCreator("shadowRoot",sm))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,vm.RegisterGraphicCreator("symbol",kg),th.load(Ry),th.load(qk?hk:sA))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,vm.RegisterGraphicCreator("text",yp),th.load(Dy),th.load(qk?xk:oA))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:xt,throttle:St};MM();let LM=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===O_.env?(O_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===O_.env?(O_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ei(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ei(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new _e(t).toHex(),o=new _e(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=_e.getColorBrightness(new _e(e));return _e.getColorBrightness(new _e(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:bm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=bm({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?vm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),vm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:Gke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>we&&keEe&&TeAe&&CeMe&&PeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([Oa()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([Oa()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([Oa()],uT);const pT=new xa(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(hp).toService(hT)),i(dT)||(t(dT).toSelf(),t($v).toService(dT)),i(uT)||(t(uT).toSelf(),t($v).toService(uT))}));class gT extends Tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=se(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Vc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Tb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Ie(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=vm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new gl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==So.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===So.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,xo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=ti(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,l+c)||gt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new gl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Tb{getStartAngle(){return re(this._startAngle)}getEndAngle(){return re(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=vm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=vm.line;Y(i)[0].cornerRadius&&(t=vm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=vm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=vm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function lw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function hw(t,e,i,s){const n=bm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const pw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},gw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,mw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class fw extends Tb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=pw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=vm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=vm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=vm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=vm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=vm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=vm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=vm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Lt(s[0])>Lt(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function vw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function _w(t,e){return Ie(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=He(t,i),r=He(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=ze(t),l=ze(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:te(t.angle);let m=i?t.angle+Pt:te(90-t.angle);const f=i?e.angle:te(e.angle);let v=i?e.angle+Pt:te(90-e.angle);m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Fe(n,i)+Fe(n,s))/2>Fe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const yw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&bw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function bw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function xw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Aw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Tw(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},ww(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),vw(e)}function Mw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Tw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function ww(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Cw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Ew(){aM(),cM(),_M(),kM()}var Pw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Tw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return ww(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=te(e)})),kw(i,t),!Aw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(Sw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),vw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:yw[n]||yw.parity;if(s.length>=3&&xw(s,r)){do{s=a(s,r)}while(s.length>=3&&xw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&bw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=vm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ei(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Bw.defaultAttributes=aw,U(Bw,Cw);class Rw{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return se(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Lw,Ow=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=vm.circle(c);d.name=sw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},rw,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Ow(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Iw.defaultAttributes=aw,U(Iw,Rw);class Dw extends yc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=Tt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=Tt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:At(i,s)})),r=Tt.lastIndex;return r{jw[t]=!0}));const Gw=t=>-Math.log(-t),Ww=t=>-Math.exp(-t),Uw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Yw=t=>10===t?Uw:t===Math.E?Math.exp:e=>Math.pow(t,e),Kw=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Xw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$w=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function qw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Zw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Jw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Qw(t,e,i,s){return 1===i&&(i=0),Jw(t,i,s)*(e/(1-i))}function tC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function eC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class nC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=tC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const rC=Symbol("implicit");class aC extends nC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Lw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=rC}clone(){const t=(new aC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==rC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class lC extends aC{constructor(t){super(),this.type=Lw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Qw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:oC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return oC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new lC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:hC}=xe;function cC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=_e.parseColorString(e)){const e=hC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?hC(t,e):e instanceof _e?hC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class dC extends nC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Vw,this._piecewise=Zw,this._interpolate=cC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?eC:Zw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Vw),this.rescale(i)):this._clamp!==Vw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const uC=Math.sqrt(50),pC=Math.sqrt(10),gC=Math.sqrt(2),mC=[1,2,5,10],fC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=bC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?_C(0,-(e-1)/s,s):_C((e-1)/s,0,s)},vC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return fC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return fC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=_C(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=_C(t,e,l);return n&&r.reverse(),r})),bC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=mC[0];return i>=uC?s=mC[3]:i>=pC?s=mC[2]:i>=gC&&(s=mC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function xC(t,e,i){const s=(e-t)/Math.max(0,i);return bC(s)}function SC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=xC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function kC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const MC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),TC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),wC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=yC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?MC(t,e,n):MC(t,e,sC(n)),h=MC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),CC=ft(((t,e,i,s,n)=>SC(s(t),s(e),i).map((t=>sC(n(t))))));class EC extends dC{constructor(){super(...arguments),this.type=Lw.Linear}clone(){return(new EC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return vC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=yC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return SC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=kC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=AC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=AC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=AC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function PC(t){return e=>-t(-e)}function BC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class RC extends dC{constructor(){super(Kw(10),Yw(10)),this.type=Lw.Log,this._limit=BC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new RC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Kw(this._base),s=Yw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=PC(i),this._pows=PC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Gw,this.untransformer=Ww):(this._logs=i,this._pows=s,this._limit=BC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Vw}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return TC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class LC extends EC{constructor(){super(Xw(1),$w(1)),this.type=Lw.Symlog,this._const=1}clone(){return(new LC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Xw(t),this.untransformer=$w(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return TC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class OC{constructor(){this.type=Lw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new OC).domain(this._domain).range(this._range).unknown(this._unknown)}}const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Qt(t).expand(i/2),n=new Qt(e).expand(i/2);return s.intersects(n)};function FC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function jC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=te(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=zC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=zC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=zC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=zC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Qt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},NC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=se({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Qt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},VC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&FC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},GC=(t,e,i,s)=>HC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),WC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},UC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!WC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?UC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},XC=(t,e)=>{if(zw(t.type))return((t,e)=>{if(!zw(t.type))return IC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return IC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=HC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&jC(n,i);)n=VC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return IC(h)})(t,e);if(Nw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=GC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=YC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=GC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=NC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)})(t,e)}return IC(t.domain())};function $C(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function qC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=qt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function ZC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=$C(t,!!n),o=$C(r,!!n);const h=qt.distancePP(s,l),c=qt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=qC(e,t,!1,!!n),o=qC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=$C(t,!!n),o=$C(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class JC extends Tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=$C(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=qC(t,o,!1,!!a)}const u=vm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=$C(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=vm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(QC,Cw);var tE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(eE,Rw);const iE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",sE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},nE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var rE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(rE||(rE={}));var aE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=rE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=rE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=rE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===O_.env&&(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===rE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===rE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=rE.endHandler):h+=l:this._activeTag===rE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===rE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===O_.env&&(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=aE(i,["formatMethod"]),{formatMethod:a}=s,o=aE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Jt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},nE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},nE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},nE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},nE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Sy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var hE,cE,dE,uE;function pE(){aM(),tT()}function gE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function mE(t,e){const{dx:i,dy:s}=gE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}lE.defaultAttributes=sE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(hE||(hE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(cE||(cE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(dE||(dE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(uE||(uE={}));class fE extends Tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=pw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=vm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=vm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=vm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function vE(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function _E(t,e,i,s){t&&(vE(t.startSymbol,e,i,s),t.lines.forEach((t=>vE(t,e,i,s))),vE(t.line,e,i,s),vE(t.endSymbol,e,i,s))}function yE(t,e,i,s){t&&(vE(t.getTextShape(),e,i,s),vE(t.getBgRect(),e,i,s))}function bE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function xE(t,e,i,s){t&&(bE(t.startSymbol,e,i,s),t.lines.forEach((t=>bE(t,e,i,s))),bE(t.line,e,i,s),bE(t.endSymbol,e,i,s))}function SE(t,e,i,s){t&&(bE(t.getTextShape(),e,i,s),bE(t.getBgRect(),e,i,s))}function AE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;vE(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),vE(t.endSymbol,s+r+a,o,n),vE(e.getTextShape(),s+r+a+o,l,n),vE(e.getBgRect(),s+r+a+o,l,n)}function kE(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}function ME(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function TE(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function wE(t,e,i,s,n,r){var a;_E(t,n,s,r),vE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?yE(i,n,s,r):vE(i,n,s,r)}function CE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;vE(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),vE(e,n+o+l,h,r),vE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(vE(i.getTextShape(),n+o+l+h+c,d,r),vE(i.getBgRect(),n+o+l+c,d,r)):vE(i,n+o+l+c,d,r)}function EE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?AE(t,e,s,r,a):"fadeIn"===i&&kE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?AE(t,e,s,n,a):"fadeIn"===i&&kE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?wE(n,r,e,i,s,o):"callIn"===t&&CE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?wE(n,r,e,i,s,a):"callIn"===t&&CE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;xE(t,n,s,r),bE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?SE(i,n,s,r):bE(i,n,s,r)}(n,r,e,t,i,s)}}const LE={type:"clipIn",duration:500,easing:"linear",delay:0},OE={type:"fadeIn",duration:500,easing:"linear",delay:0},IE={type:"callIn",duration:500,easing:"linear",delay:0},DE={type:"fadeOut",duration:500,easing:"linear",delay:0};class FE extends fE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=LE,this.defaultExitAnimation=DE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;mE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const jE=.001,zE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:hE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},NE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:dE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},VE={interactive:!0,label:{position:cE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},GE={interactive:!0,label:{position:dE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},UE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},YE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function KE(){XE._animate=EE}pE(),QT();class XE extends FE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,jE)||FM(Math.abs(e),3*Math.PI/2,jE)?jM(i,e,t):DM(e)?HE.postiveXAxis[t]:HE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function $E(){qE._animate=PE}XE.defaultAttributes=zE,pE(),gM();class qE extends fE{markerAnimate(t){qE._animate&&this._animationConfig&&qE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=vm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}qE.defaultAttributes=VE,pE(),tw();class ZE extends FE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case dE.arcInnerStart:l=s;case dE.arcOuterStart:l=s;break;case dE.arcInnerEnd:l=n;case dE.arcOuterEnd:l=n;break;case dE.center:case dE.arcInnerMiddle:case dE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return WE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}ZE.defaultAttributes=NE,pE(),Jk();class JE extends fE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case dE.center:h=(i+s)/2,c=(n+r)/2;break;case dE.arcInnerStart:h=i,c=n;break;case dE.arcOuterStart:h=s,c=n;break;case dE.arcInnerEnd:h=i,c=r;break;case dE.arcOuterEnd:h=s,c=r;break;case dE.arcInnerMiddle:h=i,c=(n+r)/2;break;case dE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},WE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=vm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function QE(){tP._animate=RE}JE.defaultAttributes=GE,pE(),QT(),tw(),SM(),lM(),cM();class tP extends fE{markerAnimate(t){tP._animate&&this._animationConfig&&tP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=DE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,jE)||FM(Math.abs(s),3*Math.PI/2,jE)?jM(t,s,n):DM(s)?YE.postiveXAxis[n]:YE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=uE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=vm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=vm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=vm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,jE)||FM(d,0,jE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(hP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(hP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===hP.focus||"focus"===o){const s=a.hasState(oP.focus);a.toggleState(oP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover,oP.focus],t),this._setLegendItemState(e,oP.selected,t)})):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover,oP.focus],t),this._setLegendItemState(e,oP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(oP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(oP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(lP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[oP.selected,oP.selectedHover],t),this._setLegendItemState(a,oP.unSelected,t)):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t))}else this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover],t),this._setLegendItemState(e,oP.unSelected,t))}))}this._dispatchLegendEvent(lP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,oP.selected),this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover])):(this._removeLegendItemState(e,[oP.selected,oP.selectedHover]),this._setLegendItemState(e,oP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=nP,spaceRow:h=rP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ei(c);let w;!1===x.visible?(w=vm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,hP.item,t,w)):(w=vm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,hP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?oP.selected:oP.unSelected);const C=vm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=vm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,hP.itemShape,t,w,S.state),s.addState(e?oP.selected:oP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=vm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,hP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,hP.itemLabel,t,w,A.state),D.addState(e?oP.selected:oP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,hP.itemValue,t,w,k.state),r.addState(e?oP.selected:oP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute;return this._itemContext.isHorizontal?new sP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new sP(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=vm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=nP,spaceRow:a=rP}=s,o=this._itemsContainer,{space:l=aP,defaultCurrent:h=1}=n,c=pP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=vm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(oP.selected)?this._setLegendItemState(t,oP.selectedHover,e):this._setLegendItemState(t,oP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===hP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(lP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(oP.unSelectedHover)||t.hasState(oP.selectedHover))&&(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(oP.unSelectedHover)&&!t.hasState(oP.selectedHover)||(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===hP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(lP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(oP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},gP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(oP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var fP;function vP(t){return y(t)?t:[t,t]}function _P(t){return t?"ew-resize":"ns-resize"}mP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:nP,spaceRow:rP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:aP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(fP||(fP={})),dP();class yP extends Tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:vP(d)[0],endValue:vP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=vm.group({x:0,y:0});m.name=fP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=vm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=fP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=vm.group({x:g?v:0,y:g?0:v});m.add(_);const y=vm.group({x:0,y:0});let b;if(y.name=fP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=vm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=fP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=vm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=fP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=vP(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(v.name=fP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=fP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(i.name=fP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=fP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=vm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=fP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":_P(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=vm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=fP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return vm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":_P(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),vm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=vm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=vm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===fP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===fP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===fP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===fP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}yP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},uP(),dP();class bP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function xP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}bP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},uP(),dP(),uM();class SP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=vm.group({x:0,y:0});this._innerView.add(x);const S=new yP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:xP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=vm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}SP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let AP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ei(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};AP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const kP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let MP=class extends Tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(kP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class TP extends Ag{constructor(t){super(t)}}var wP,CP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(wP||(wP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(CP||(CP={}));class EP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},EP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},EP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new TP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new TP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new TP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(wP.OnPlay)},this.pause=()=>{this._dispatchEvent(wP.OnPause)},this.forward=()=>{this._dispatchEvent(wP.OnForward)},this.backward=()=>{this._dispatchEvent(wP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}EP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},EP.defaultAttributes={[CP.Start]:{},[CP.Pause]:{},[CP.Backward]:{},[CP.Forward]:{}};const PP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},BP=[200,10];var RP,LP;!function(t){t.Default="default",t.Reverse="reverse"}(RP||(RP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(LP||(LP={}));const OP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},DP=t=>"top"===t||"bottom"===t;class FP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(DP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:BP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:BP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new yP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return DP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new EP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=DP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:BP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(DP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:DP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:DP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function jP(){dP(),aM(),SM()}FP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},PP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},PP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},PP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},PP),{key:"backward",position:"start"})}},jP();class zP extends FP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:RP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(LP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(OP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===RP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(LP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(LP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(LP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(LP.change),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var HP,NP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};jP();class VP extends FP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(LP.change))},this.play=()=>NP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(LP.play),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(LP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(HP||(HP={}));const GP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},WP=5;const UP={debounce:xt,throttle:St};aM(),gM();let YP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:UP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(HP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(HP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(HP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=GP.trigger,updateTrigger:e=GP.updateTrigger,endTrigger:i=GP.endTrigger,resetTrigger:s=GP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Xe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(HP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(HP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=WP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=vm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},XP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},$P={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Qt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},qP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let ZP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ei(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Nc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>qP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&yg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return KP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return KP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};ZP.defaultAttributes=$P;const JP=pt;function QP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function eB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function iB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function sB(t,e){const i=iB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function nB(t,e){const i=rB(t),s=rB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function rB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function aB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function oB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const lB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var cB,dB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(cB||(cB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dB||(dB={}));const uB="__VCHART",pB=500,gB=500,mB=`${uB}_LABEL_LIMIT`,fB=`${uB}_LABEL_ALIGN`,vB=`${uB}_LABEL_TEXT`,_B=`${uB}_LABEL_VISIBLE`,yB=`${uB}_LABEL_X`,bB=`${uB}_LABEL_Y`,xB=`${uB}_ARC_TRANSFORM_VALUE`,SB=`${uB}_ARC_RATIO`,AB=`${uB}_ARC_START_ANGLE`,kB=`${uB}_ARC_END_ANGLE`,MB=`${uB}_ARC_K`,TB=`${uB}_ARC_MIDDLE_ANGLE`,wB=`${uB}_ARC_QUADRANT`,CB=`${uB}_ARC_RADIAN`,EB=-Math.PI/2,PB=3*Math.PI/2,BB=-90,RB=.6;var LB,OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(LB||(LB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(OB||(OB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(IB||(IB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(DB||(DB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(FB||(FB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(jB||(jB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(zB||(zB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(HB||(HB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(NB||(NB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(VB||(VB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(GB||(GB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WB||(WB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(UB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",UB.AFTER_EVALUATE_DATA="afterEvaluateData",UB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",UB.AFTER_EVALUATE_SCALE="afterEvaluateScale",UB.BEFORE_PARSE_VIEW="beforeParseView",UB.AFTER_PARSE_VIEW="afterParseView",UB.BEFORE_TRANSFORM="beforeTransform",UB.AFTER_TRANSFORM="afterTransform",UB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",UB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",UB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",UB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",UB.BEFORE_STAGE_RESIZE="beforeStageResize",UB.AFTER_STAGE_RESIZE="afterStageResize",UB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",UB.AFTER_VRENDER_DRAW="afterVRenderDraw",UB.BEFORE_MARK_JOIN="beforeMarkJoin",UB.AFTER_MARK_JOIN="afterMarkJoin",UB.BEFORE_MARK_UPDATE="beforeMarkUpdate",UB.AFTER_MARK_UPDATE="afterMarkUpdate",UB.BEFORE_MARK_STATE="beforeMarkState",UB.AFTER_MARK_STATE="afterMarkState",UB.BEFORE_MARK_ENCODE="beforeMarkEncode",UB.AFTER_MARK_ENCODE="afterMarkEncode",UB.BEFORE_DO_LAYOUT="beforeDoLayout",UB.AFTER_DO_LAYOUT="afterDoLayout",UB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",UB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",UB.BEFORE_DO_RENDER="beforeDoRender",UB.AFTER_DO_RENDER="afterDoRender",UB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",UB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",UB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",UB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",UB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",UB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",UB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",UB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",UB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",UB.BEFORE_ELEMENT_STATE="beforeElementState",UB.AFTER_ELEMENT_STATE="afterElementState",UB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",UB.AFTER_ELEMENT_ENCODE="afterElementEncode",UB.ANIMATION_START="animationStart",UB.ANIMATION_END="animationEnd",UB.ELEMENT_ANIMATION_START="elementAnimationStart",UB.ELEMENT_ANIMATION_END="elementAnimationEnd",UB.ALL_ANIMATION_START="allAnimationStart",UB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(YB||(YB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(KB||(KB={}));const XB="__vgrammar_scene_item__",$B=[IB.line,IB.area],qB=[IB.arc3d,IB.rect3d,IB.pyramid3d],ZB="key",JB=[{}],QB=["key"],tR=!0,eR=!0,iR=!1,sR=!0,nR="VGRAMMAR_IMMEDIATE_ANIMATION",rR=0,aR=1e3,oR=0,lR=0,hR=!1,cR=!1,dR="quintInOut",uR={stopWhenStateChange:!1,immediatelyApply:!0},pR="_mo_hide_";function gR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function mR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return gR(t.dependency,e);var i;return[]}function fR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function vR(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function _R(t,e){return yR(t)?t.output():e[t]}const yR=t=>t&&!u(t.grammarType),bR=t=>d(t)?t:e=>e[t];function xR(t){return!!(null==t?void 0:t.scale)}function SR(t){return!!(null==t?void 0:t.field)}function AR(t,e){if(!t)return[];let i=[];return t.scale&&(i=yR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(mR(t,e))}function kR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function MR(t,e,i,s,n){i&&(fR(i)?e.forEach((e=>{const n=vR(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case IB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case IB.group:case IB.rect:case IB.image:return["width","height","y1"].includes(e);case IB.path:case IB.shape:return["path","customPath"].includes(e);case IB.line:return"defined"===e;case IB.area:return["x1","y1","defined"].includes(e);case IB.rule:return["x1","y1"].includes(e);case IB.symbol:return"size"===e;case IB.polygon:return"points"===e;case IB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(xR(l)){const t=_R(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?gb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(SR(l)){const t=gb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=vR(l,s,e.datum,t)}))})))}function TR(t,e,i,s){if(!t)return null;if(fR(t))return vR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(xR(h)){const t=_R(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?gb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(SR(h)){const t=gb(h.field);n[r]=t(e)}else n[r]=vR(h,s,e,i)})),n}class wR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let CR=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};CR._plotMarks={},CR._marks={},CR._components={},CR._graphicComponents={},CR._transforms={},CR._grammars={},CR._glyphs={},CR._animations={},CR._interactions={},CR._graphics={},CR.registerGlyph=(t,e,i,s,n)=>(CR._glyphs[t]=new wR(e,i,s,n),CR._glyphs[t]),CR.registerAnimationType=(t,e)=>{CR._animations[t]=e},CR.getAnimationType=t=>CR._animations[t],CR.registerInteraction=(t,e)=>{CR._interactions[t]=e},CR.registerGraphic=(t,e)=>{CR._graphics[t]=e},CR.getGraphicType=t=>CR._graphics[t],CR.createGraphic=(t,e)=>{const i=CR._graphics[t];return i?i(e):null};const ER=t=>!!IB[t];function PR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=CR.getGraphicType(e)?CR.createGraphic(e,i):CR.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const BR=t=>{t&&(t[XB]=null,t.release(),t.parent&&t.parent.removeChild(t))},RR=["fillOpacity"],LR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const OR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[IB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[IB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[IB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const IR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?OR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(RR.includes(r)?LR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{RR.includes(t)?LR(n,t,e):n[t]=e[t]}));return n},DR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),FR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],jR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(FR);function zR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?jR:FR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>DR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=HR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function HR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let NR=class{constructor(t){this.data=null,this.states=[],this.diffState=OB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));MR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?IR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[XB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?IR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===OB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(BR(this.graphicItem),this.graphicItem[XB]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=bR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(vR(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===OB.unChange&&(this.diffState=OB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,pR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[pR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||this.useStates(this.states),this.mark.markType===IB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new gl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[LB.update],a=e[LB.enter],o=e[LB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===OB.enter?(a&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.update?((n&&a||i)&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.exit&&o&&(i&&MR(this,t,a,s,l),MR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)_b(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[IB.line,IB.area,IB.largeRects,IB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||kR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[LB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=HR(h),e===IB.line||e===IB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>kR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===IB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=zR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=HR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?zR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=TR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=zR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===IB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===IB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(BR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class VR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const GR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class WR extends VR{constructor(t,e){super(t,e),this.type=WR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},WR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}WR.type="element-select",WR.defaultOptions={state:KB.selected,trigger:"click"};class UR extends VR{constructor(t,e){super(t,e),this.type=UR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function YR(t){if(t)return t.type===Lw.Band?t.bandwidth():t.type===Lw.Point?t.step():void 0}UR.type="element-highlight",UR.defaultOptions={highlightState:KB.highlight,blurState:KB.blur,trigger:"pointerover",triggerOff:"pointerout"};class KR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const XR=()=>{U(WR,KR),CR.registerInteraction(WR.type,WR)},$R=()=>{U(UR,KR),CR.registerInteraction(UR.type,UR)},qR=(t,e)=>yR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,ZR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=qR(n,e),i}),{}):t.map((t=>qR(t,e))):t;let JR=-1;class QR extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++JR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(mR(this.spec[e],this.view)),this.spec[e]=t,this.attach(mR(t,this.view)),this.commit(),this}}const tL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=mR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},eL=(t,e)=>{const i=CR.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(gR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>tL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return tL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},iL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=eL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},sL={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class nL extends QR{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!sL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return sL[e.type](t,i,new ya(new va))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?mR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=mR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=mR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=yR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=iL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const rL="window",aL="view",oL={trap:!1},lL="width",hL="height",cL="viewWidth",dL="viewHeight",uL="padding",pL="viewBox",gL="autoFit";function mL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function fL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,mL(t,e,n,s)}class vL{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}return this.nodes.push(t),mL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,fL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class _L{constructor(t){this.list=[],this.ids={},this.idFunc=t||mb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class yL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new _L((t=>t.uid)),this._heap=new vL(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new _L((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const bL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===IB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class xL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Qd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{zl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new iy(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Qb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ix(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function SL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function AL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function kL(t,e,i,s,n){if(n===rL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{AL(t,SL(t),!1)}))}));const e=SL(t);AL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class ML extends QR{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?vR(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},EL=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class PL extends NR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return MR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[XB]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?IR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===OB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=IR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=OR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===IB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return $B.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)_b(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[XB]=null})),this.glyphGraphicItems=null),super.release()}}const BL=t=>t.markType===IB.glyph?new PL(t):new NR(t);function RL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(ZB,i?t.slice().sort(i):t.slice()),{keys:QB,data:s};const n=bR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class LL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?RL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const OL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const IL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class DL extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class FL extends yc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Nd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}xc.mode|=ko.SET_ATTR_IMMEDIATELY;let jL=0;const zL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof yc||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class HL{constructor(t,e,i){this.id=jL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!CR.getAnimationType(e.type))return null;const r=CR.getAnimationType(e.type)(t,n,i);return OL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?IL(t,0,n[i].from,0,s):void 0,e.to[i]=l?IL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),OL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=zL(o);return u(o)||zL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new FL(r.from,r.to,a,t.easing):void 0:new DL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new $c(a,e))}r>0&&t.wait(r)}}function NL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(VL(i,t[i]))})),e}function VL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:rR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:cR,loop:null!==(s=h.loop)&&void 0!==s?s:hR,controlOptions:z({},uR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:aR,delay:null!==(a=h.delay)&&void 0!==a?a:oR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:lR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:dR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:rR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:cR,loop:null!==(d=t.loop)&&void 0!==d?d:hR,controlOptions:z({},uR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:oR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:lR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:dR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function GL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class WL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class UL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=NL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=NL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==OB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=VL(nR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===OB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new HL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===OB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=vR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=GL(t.startTime,e,n),o=GL(t.totalTime,e,n),l=GL(t.oneByOne,e,n),h=GL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=GL(t.delay,e,n),l=GL(t.delayAfter,e,n),h=null!==(i=GL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:GL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===OB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===OB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===nR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===OB.exit&&0===o[OB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class YL extends QR{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new UL(this,{}),this.differ=new LL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===OB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===WB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:JB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===IB.group)return;const e=RL(null!=t?t:JB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(OB.update,t,e,i)}encodeState(t,e,i,s){if(t===OB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(fR(n))this.detach(AR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(AR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(AR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(AR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(AR(i,this.view))):fR(e)?(this.spec.encode[t]=e,this.attach(AR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(AR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=iL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return $B.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==OB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===YB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!fR(n)&&Object.keys(n).forEach((t=>{xR(n[t])&&(e[t]=_R(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];fR(s)||Object.keys(s).forEach((t=>{SR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB];if((null==s?void 0:s.mark)===this){const i=kL(this.view,t,s,0,aL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new UL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=_R(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==IB.group){if(!this.graphicItem){const t=PR(this,IB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||qB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==IB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=bR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>ZB),a=bR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>ZB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===OB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=OB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):BL(this),n.diffState===OB.exit&&(n.diffState=OB.enter,this.animate.getElementAnimators(n,OB.exit).forEach((t=>t.stop("start")))),n.diffState=OB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=OB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:JB;l||this.differ.setCurrentData(RL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=TR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{this.markType===IB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:PR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==IB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=bR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>ZB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=BL(this);e.diffState=OB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=BL(this);i.diffState=OB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==IB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=PR(this,IB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==OB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:OR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=OB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&BR(this.graphicItem),this.detachAll(),super.release()}}let KL=class extends YL{constructor(t,e){super(t,IB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===IB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return OR.rect}evaluateJoin(t){if(!this.elements.length){const t=BL(this);t.updateData(ZB,JB,(()=>""),this.view),this.elements=[t],this.elementMap.set(ZB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return MR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:PR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function XL(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function $L(t,e){return Math.min(t<0?t+e:t-1,e)}function qL(t,e,i){let s=$L(t,i),n=$L(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=$L(Math.max(0,n-1),i)):n=$L(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const ZL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>XL(t,i))),u=l.map((t=>XL(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=qL(e,i,r),{start:h,end:c}=qL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Jt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},JL={[DB.axis]:0,[DB.legend]:1,[DB.slider]:2,[DB.player]:3,[DB.datazoom]:4},QL=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=JL[t.componentType])&&void 0!==s?s:1/0},tO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=yb(r.maxChildWidth,n.width()),o=yb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=CL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dQL(t)-QL(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==IB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=tO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(cL,o),i.updateSignal(dL,l),i.updateSignal(uL,h)}else tO(t,n,a,e);else"grid"===r.display&&ZL(t,n,a);eO(n,e,i)}}))};class iO extends YL{constructor(t,e,i){super(t,IB.glyph,i),this.glyphType=e,this.glyphMeta=CR.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!CR.getGraphicType(IB.glyph))return;const s=CR.createGraphic(IB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(CR.getGraphicType(n[t])){const e=CR.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const sO=Symbol.for("key");class nO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=RL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=RL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=bR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:sO})),r=RL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:sO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==sO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=vR(i.animation.delay,n,o,l),d=vR(i.animation.duration,n,o,l),u=vR(i.animation.oneByOne,n,o,l),p=vR(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Td(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Sd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>kd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Md({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Tc,null!==(l=i.easing)&&void 0!==l?l:wc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new wd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Tc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Td(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class rO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class aO extends rO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===IB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===IB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===IB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===IB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class lO extends YL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=PR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?IB.richtext:IB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}lO.markType=IB.text;const hO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},cO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},dO=Object.assign({},hO);dO.axis=Object.assign({},dO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.circleAxis=Object.assign({},dO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.grid=Object.assign({},dO.grid,{style:{stroke:"#404349"}}),dO.circleGrid=Object.assign({},dO.circleGrid,{style:{stroke:"#404349"}}),dO.rectLabel=Object.assign({},dO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.lineLabel=Object.assign({},dO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.symbolLabel=Object.assign({},dO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.title=Object.assign({},dO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const uO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:cO,components:dO},pO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:cO,components:hO};let gO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};gO._themes=new Map,gO.registerTheme("default",pO),gO.registerTheme("dark",uO);class mO extends YL{constructor(t,e,i,s){super(t,IB.component,i),this._componentDatum={[ZB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:CR.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,ZB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[ZB]+=1}evaluateJoin(t){return this.spec.key=ZB,t?(t[ZB]=this._componentDatum[ZB],this._componentDatum=t):this._componentDatum={[ZB]:this._componentDatum[ZB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class fO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB],n=kL(0,t,s,0,aL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(yR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):ER(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ML(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new nL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=CR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=CR.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case IB.group:n=new KL(this,s);break;case IB.glyph:n=new iO(this,null==i?void 0:i.glyphType,s);break;case IB.component:n=CR.hasComponent(null==i?void 0:i.componentType)?CR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new mO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case IB.text:n=new lO(this,t,s);break;default:n=CR.hasMark(t)?CR.createMark(t,this,s):new YL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(IB.group,t)}glyph(t,e){return this.mark(IB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(IB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.grid,mode:e})}legend(t){return this.mark(IB.component,t,{componentType:DB.legend})}slider(t){return this.mark(IB.component,t,{componentType:DB.slider})}label(t){return this.mark(IB.component,t,{componentType:DB.label})}datazoom(t){return this.mark(IB.component,t,{componentType:DB.datazoom})}player(t){return this.mark(IB.component,t,{componentType:DB.player})}title(t){return this.mark(IB.component,t,{componentType:DB.title})}scrollbar(t){return this.mark(IB.component,t,{componentType:DB.scrollbar})}customized(t,e){const i=CR.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&wL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(BR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++TL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(gO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(lL,t.width),this.updateSignal(hL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=CR.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:lL,value:null!==(s=t[lL])&&void 0!==s?s:0},{id:hL,value:null!==(n=t[hL])&&void 0!==n?n:0},{id:uL,value:CL(null!==(a=null!==(r=t[uL])&&void 0!==r?r:e[uL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:cL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[lL]-i.left-i.right},dependency:[lL,uL]}},{id:dL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[hL]-i.top-i.bottom},dependency:[hL,uL]}},{id:pL,update:{callback:(t,e)=>{const i=CL(e[uL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[cL],i.top+e[dL])},dependency:[cL,dL,uL]}},{id:gL,value:null!==(o=t[gL])&&void 0!==o?o:e[gL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===IB.glyph?{glyphType:t.glyphType}:t.type===IB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=gO.getTheme(t))&&void 0!==e?e:gO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(lL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(hL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(cL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(uL);if(arguments.length){const i=CL(t);return this.updateSignal(e,i),i}return CL(e.output())}autoFit(t){const e=this.getSignalById(gL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(pL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=WB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===IB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||eO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{bL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),bL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=tR,morph:o=eR,morphAll:l=iR,animation:h={},enableExitAnimation:c=sR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:dR,delay:null!==(i=h.delay)&&void 0!==i?i:oR,duration:null!==(s=h.duration)&&void 0!==s?s:aR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:cR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=WB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=WB.reevaluate,this._dataflow.evaluate()),this._layoutState=WB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!wL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return bL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ii(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(lL,t)),e!==this.height()&&(s=!0,this.updateSignal(hL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):ER(t)?(i.markType=t,i.source=e):i.source=t===rL?rL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=gR(l,this),v=EL(((t,e)=>{const s=c===aL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===rL&&(t=kL(0,t,e,0,rL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===aL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,aL,d))return this.addEventListener(d,v,oL),()=>{this.removeEventListener(d,v)}}else if(c===rL)return O_.addEventListener(d,v),this._eventListeners.push({type:d,source:O_,handler:v}),()=>{O_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===O_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=CR.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new xL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new rO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aO((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new yL,this.animate=new oO(this),this._morph=new nO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[aL,rL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:gO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&O_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==IB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&O_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),CR.unregisterRuntimeTransforms(),at.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const vO=()=>{bM(),uM(),CR.registerGraphic(IB.path,Yg)},_O=()=>{bM(),fM(),CR.registerGraphic(IB.rect,Pg)},yO=()=>{bM(),cM(),CR.registerGraphic(IB.rule,wg)},bO=()=>{bM(),SM(),CR.registerGraphic(IB.symbol,kg)},xO=()=>{bM(),kM(),_M(),CR.registerGraphic(IB.text,yp)},SO=()=>{bM(),nM(),CR.registerGraphic(IB.glyph,Rg)},AO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},MO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Ab(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},TO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ab(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},wO=AO(MO),CO=kO(MO);const EO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ab(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},PO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ab(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},BO=AO(EO),RO=kO(EO);const LO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},IO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?OO:LO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},DO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},jO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class zO extends mO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const HO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class NO extends zO{constructor(t,e,i){super(t,DB.axis,e),this.spec.componentType=DB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=TR(n,e,i,s);const h=vR(this.spec.inside,s,e,i),c=vR(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(HO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=vR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case jB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case jB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?jB.circleAxis:jB.lineAxis,this._axisComponentType}}NO.componentType=DB.axis;let VO=class extends mO{constructor(t,e){super(t,DB.label,e),this.spec.componentType=DB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=vR(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=vR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case IB.line:case IB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case IB.rect:case IB.rect3d:case IB.interval:g=p.rectLabel;break;case IB.symbol:case IB.circle:case IB.cell:g=p.symbolLabel;break;case IB.arc:case IB.arc3d:g=p.arcLabel;break;case IB.polygon:case IB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=TR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=TR(i,t,e,d);m.push(z({},f,s))}));else{const t=TR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};VO.componentType=DB.label;const GO=()=>{CR.registerGraphicComponent(DB.label,(t=>new JT(t))),CR.registerComponent(DB.label,VO)};class WO extends zO{constructor(t,e,i){super(t,DB.grid,e),this.spec.componentType=DB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=TR(s,t,e,i);const d=vR(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case zB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case zB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=vR(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(HO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===zB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=vR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case zB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case zB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=zB.circleAxisGrid:this._gridComponentType=zB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case jB.circleAxis:this._gridComponentType=zB.circleAxisGrid;break;case jB.lineAxis:default:this._gridComponentType=zB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?zB.lineAxisGrid:zB.circleAxisGrid:zB.lineAxisGrid}else this._gridComponentType=zB.lineAxisGrid;return this._gridComponentType}}WO.componentType=DB.grid;const UO=(t,e,i)=>e.filter((e=>t.callback(e,i))),YO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function KO(t){return t.reduce(((t,e)=>t+e),0)}const XO={min:$,max:X,average:function(t){return 0===t.length?0:KO(t)/t.length},sum:KO};function $O(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function qO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function ZO(t,e,i,s){return qO(t,e,i,"min",s)}function JO(t,e,i,s){return qO(t,e,i,"max",s)}function QO(t,e,i,s){return qO(t,e,i,"average",s)}function tI(t,e,i,s){return qO(t,e,i,"sum",s)}const eI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$O;if("min"===n?l=ZO:"max"===n?l=JO:"average"===n?l=QO:"sum"===n&&(l=tI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const iI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(pR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(pR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(pR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},sI=()=>{CR.registerTransform("filter",{transform:UO,markPhase:"beforeJoin"},!0)},nI=()=>{CR.registerTransform("map",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{CR.registerTransform("sampling",{transform:eI,markPhase:"afterEncode"},!0)},aI=()=>{CR.registerTransform("markoverlap",{transform:iI,markPhase:"afterEncode"},!0)},oI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},hI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},cI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},dI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const pI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},xI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},SI=(t,e,i)=>({from:{points:xI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e)}}),kI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),MI=(t,e,i)=>({from:{points:kI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),TI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:kI(t,e,i)}}),wI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),CI=(t,e,i)=>({from:{points:wI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),EI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:wI(t,e,i)}}),PI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},LI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},OI={symbol:["_mo_hide_","visible"]},II=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=OI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{_b(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},DI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},jI=()=>{CR.registerAnimationType("clipIn",oI)},zI=()=>{CR.registerAnimationType("clipOut",lI)},HI=()=>{CR.registerAnimationType("fadeIn",hI)},NI=()=>{CR.registerAnimationType("fadeOut",cI)},VI=()=>{CR.registerAnimationType("growCenterIn",dI)},GI=()=>{CR.registerAnimationType("growCenterOut",uI)},WI=()=>{CR.registerAnimationType("growHeightIn",mI)},UI=()=>{CR.registerAnimationType("growHeightOut",fI)},YI=()=>{CR.registerAnimationType("growWidthIn",pI)},KI=()=>{CR.registerAnimationType("growWidthOut",gI)},XI=()=>{CR.registerAnimationType("growPointsIn",SI)},$I=()=>{CR.registerAnimationType("growPointsOut",AI)},qI=()=>{CR.registerAnimationType("growPointsXIn",MI)},ZI=()=>{CR.registerAnimationType("growPointsXOut",TI)},JI=()=>{CR.registerAnimationType("growPointsYIn",CI)},QI=()=>{CR.registerAnimationType("growPointsYOut",EI)},tD=()=>{CR.registerAnimationType("growAngleIn",vI)},eD=()=>{CR.registerAnimationType("growAngleOut",_I)},iD=()=>{CR.registerAnimationType("growRadiusIn",yI)},sD=()=>{CR.registerAnimationType("growRadiusOut",bI)},nD=()=>{CR.registerAnimationType("moveIn",PI)},rD=()=>{CR.registerAnimationType("moveOut",BI)},aD=()=>{CR.registerAnimationType("scaleIn",RI)},oD=()=>{CR.registerAnimationType("scaleOut",LI)},lD=()=>{CR.registerAnimationType("rotateIn",DI)},hD=()=>{CR.registerAnimationType("rotateOut",FI)},cD=()=>{CR.registerAnimationType("update",II)};class dD extends YL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=fR(e)?null:Object.keys(e).reduce(((t,s)=>(xR(e[s])&&(t[s]=_R(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=TR(e,t,i,n);if(u(r.size)){const t=s.x?YR(s.x):void 0,e=s.y?YR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(OR.symbol)}release(){super.release(),this._encoders=null}}dD.markType=IB.cell;const uD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var pD,gD,mD;t.ChartEvent=void 0,(pD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",pD.rendered="rendered",pD.renderFinished="renderFinished",pD.animationFinished="animationFinished",pD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",pD.afterInitData="afterInitData",pD.afterInitEvent="afterInitEvent",pD.afterInitMark="afterInitMark",pD.rawDataUpdate="rawDataUpdate",pD.viewDataFilterOver="viewDataFilterOver",pD.viewDataUpdate="viewDataUpdate",pD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",pD.markDeltaYUpdate="markDeltaYUpdate",pD.viewDataLabelUpdate="viewDataLabelUpdate",pD.scaleDomainUpdate="scaleDomainUpdate",pD.scaleUpdate="scaleUpdate",pD.dataZoomChange="dataZoomChange",pD.drill="drill",pD.layoutStart="layoutStart",pD.layoutEnd="layoutEnd",pD.layoutRectUpdate="layoutRectUpdate",pD.playerPlay="playerPlay",pD.playerPause="playerPause",pD.playerEnd="playerEnd",pD.playerChange="playerChange",pD.playerForward="playerForward",pD.playerBackward="playerBackward",pD.scrollBarChange="scrollBarChange",pD.brushStart="brushStart",pD.brushChange="brushChange",pD.brushEnd="brushEnd",pD.brushClear="brushClear",pD.legendSelectedDataChange="legendSelectedDataChange",pD.legendFilter="legendFilter",pD.legendItemClick="legendItemClick",pD.legendItemHover="legendItemHover",pD.legendItemUnHover="legendItemUnHover",pD.tooltipShow="tooltipShow",pD.tooltipHide="tooltipHide",pD.tooltipRelease="tooltipRelease",pD.afterResize="afterResize",pD.afterRender="afterRender",pD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(gD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",gD.window="window",gD.canvas="canvas",t.Event_Bubble_Level=void 0,(mD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",mD.chart="chart",mD.model="model",mD.mark="mark";const fD=`${uB}_waterfall_default_seriesField`,vD=`${uB}_CORRELATION_X`,_D=`${uB}_CORRELATION_Y`,yD=`${uB}_CORRELATION_SIZE`,bD=`${uB}_MEASURE_CANVAS_ID`,xD=`${uB}_DEFAULT_DATA_INDEX`,SD=`${uB}_DEFAULT_DATA_KEY`,AD=`${uB}_DEFAULT_DATA_SERIES_FIELD`,kD=`${uB}_DEFAULT_SERIES_STYLE_NAME`;var MD;t.AttributeLevel=void 0,(MD=t.AttributeLevel||(t.AttributeLevel={}))[MD.Default=0]="Default",MD[MD.Theme=1]="Theme",MD[MD.Chart=2]="Chart",MD[MD.Base_Series=3]="Base_Series",MD[MD.Series=4]="Series",MD[MD.Mark=5]="Mark",MD[MD.User_Chart=6]="User_Chart",MD[MD.User_Series=7]="User_Series",MD[MD.User_Mark=8]="User_Mark",MD[MD.User_SeriesStyle=9]="User_SeriesStyle",MD[MD.Built_In=99]="Built_In";const TD=`${uB}_STACK_KEY`,wD=`${uB}_STACK_START`,CD=`${uB}_STACK_END`,ED=`${uB}_STACK_START_PERCENT`,PD=`${uB}_STACK_END_PERCENT`,BD=`${uB}_STACK_START_OffsetSilhouette`,RD=`${uB}_STACK_END_OffsetSilhouette`,LD=`${uB}_STACK_TOTAL`,OD=`${uB}_STACK_TOTAL_PERCENT`,ID=`${uB}_STACK_TOTAL_TOP`,DD=`${uB}_SEGMENT_START`,FD=`${uB}_SEGMENT_END`;var jD,zD;t.LayoutZIndex=void 0,(jD=t.LayoutZIndex||(t.LayoutZIndex={}))[jD.Axis_Grid=50]="Axis_Grid",jD[jD.CrossHair_Grid=100]="CrossHair_Grid",jD[jD.Region=450]="Region",jD[jD.Mark=300]="Mark",jD[jD.Node=400]="Node",jD[jD.Axis=100]="Axis",jD[jD.MarkLine=500]="MarkLine",jD[jD.MarkArea=100]="MarkArea",jD[jD.MarkPoint=500]="MarkPoint",jD[jD.DataZoom=500]="DataZoom",jD[jD.ScrollBar=500]="ScrollBar",jD[jD.Player=500]="Player",jD[jD.Legend=500]="Legend",jD[jD.CrossHair=500]="CrossHair",jD[jD.Indicator=500]="Indicator",jD[jD.Title=500]="Title",jD[jD.Label=500]="Label",jD[jD.Brush=500]="Brush",jD[jD.CustomMark=500]="CustomMark",jD[jD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(zD=t.LayoutLevel||(t.LayoutLevel={}))[zD.Indicator=10]="Indicator",zD[zD.Region=20]="Region",zD[zD.Axis=30]="Axis",zD[zD.DataZoom=40]="DataZoom",zD[zD.Player=40]="Player",zD[zD.ScrollBar=40]="ScrollBar",zD[zD.Legend=50]="Legend",zD[zD.Title=70]="Title",zD[zD.CustomMark=70]="CustomMark";const HD=["linear","radial","conical"],ND={x0:0,y0:0,x1:1,y1:1},VD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},GD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},WD={linear:ND,radial:VD,conical:GD},UD={label:{name:"label",type:"text"}},YD=`${uB}_rect_x`,KD=`${uB}_rect_x1`,XD=`${uB}_rect_y`,$D=`${uB}_rect_y1`,qD={data:!0},ZD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},JD=Object.assign(Object.assign({},UD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),QD=Object.assign(Object.assign({},UD),{bar3d:{name:"bar3d",type:"rect3d"}}),tF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},eF=Object.assign(Object.assign({},UD),tF),iF=Object.assign(Object.assign({},UD),{point:{name:"point",type:"symbol"}}),sF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),nF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign({},UD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),aF=Object.assign(Object.assign({},UD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},UD),{rose:{name:"rose",type:"arc"}}),lF=Object.assign(Object.assign({},UD),{area:{name:"area",type:"path"}}),hF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"}}),cF=Object.assign(Object.assign({},hF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),dF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),uF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),pF=Object.assign(Object.assign({},UD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),gF=Object.assign(Object.assign({},UD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),mF=Object.assign(Object.assign({},UD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},UD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),vF=Object.assign(Object.assign({},JD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),_F=Object.assign(Object.assign({},UD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),yF=Object.assign(Object.assign({},UD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),bF=Object.assign(Object.assign({},UD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),xF=Object.assign(Object.assign({},hF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SF=Object.assign(Object.assign({},UD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AF=Object.assign(Object.assign({},UD),{sunburst:{name:"sunburst",type:"arc"}}),kF=Object.assign(Object.assign({},JD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},UD),{circlePacking:{name:"circlePacking",type:"arc"}}),wF=Object.assign(Object.assign({},UD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),CF=Object.assign(Object.assign({},UD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),EF=Object.assign({},sF),PF=Object.assign(Object.assign({},UD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),BF=Object.assign(Object.assign({},UD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var RF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(RF||(RF={}));const LF={[cB.bar]:JD,[cB.bar3d]:QD,[cB.line]:eF,[cB.scatter]:iF,[cB.area]:sF,[cB.radar]:nF,[cB.pie]:rF,[cB.pie3d]:aF,[cB.rose]:oF,[cB.geo]:UD,[cB.map]:lF,[cB.circularProgress]:cF,[cB.link]:dF,[cB.dot]:uF,[cB.wordCloud]:pF,[cB.wordCloud3d]:pF,[cB.funnel]:gF,[cB.funnel3d]:mF,[cB.linearProgress]:fF,[cB.waterfall]:vF,[cB.boxPlot]:_F,[cB.treemap]:yF,[cB.sankey]:bF,[cB.gauge]:xF,[cB.gaugePointer]:SF,[cB.sunburst]:AF,[cB.rangeColumn]:kF,[cB.rangeColumn3d]:MF,[cB.circlePacking]:TF,[cB.heatmap]:wF,[cB.correlation]:CF,[cB.rangeArea]:EF,[cB.liquid]:PF,[cB.venn]:BF};function OF(t){var e,i;const{type:s}=t;return s===cB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const IF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},DF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function FF(t,e){var i;if(!t)return[];const s=WF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?VF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>NF(i)?zF(t,i,e):i)).filter(p)}))):i.map((i=>NF(i)?zF(t,i,e):i)).filter(p):[]}return[]}function jF(t,e){var i,s;return VF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function zF(t,e,i){var s;const n=WF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=DF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new _e(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ce(t,i,s),a=he(n,r,e.l),l=new _e(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const HF=(t,e,i)=>{if(e&&NF(t)){const s=zF(e,t,i);if(s)return s}return t};function NF(t){return t&&"palette"===t.type&&!!t.key}function VF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function GF(t){return y(t)?{dataScheme:t}:t}function WF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=OF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class UF extends aC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!VF(this._range))return void super.range(this._range);const t=jF(this._range,this._domain);super.range(t)}}const YF={linear:EC,band:lC,point:class extends lC{constructor(t){super(!1),this.type=Lw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:aC,threshold:OC,colorOrdinal:UF};function KF(t){const e=YF[t];return e?new e:null}function XF(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function $F(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZF(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function JF(t,e,i,s=0){var n,r;return S(t)?t:ZF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QF(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JF(t[s],e.size,i)}))})),o}function tj(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||ZF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ej(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ij=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},sj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],nj={default:{dataScheme:sj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},rj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",aj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:rj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:rj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:BB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},oj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},lj=Object.assign(Object.assign({},oj),{label:{space:0}}),hj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},cj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",dj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},uj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},pj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},gj={horizontal:Object.assign(Object.assign({},uj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj}),vertical:Object.assign(Object.assign({},uj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj})},mj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},fj={horizontal:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj}),vertical:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj})},vj={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},_j={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function bj(t,e){return t&&e.key in t?t[e.key]:e.default}function xj(t){return t&&"token"===t.type&&!!t.key}const Sj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},Aj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:nj,token:Sj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:aj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:gj,sizeLegend:fj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:oj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:lj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:_j,markArea:vj,markPoint:yj,polarMarkLine:_j,polarMarkArea:vj,polarMarkPoint:yj,geoMarkPoint:yj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:dj,crosshair:hj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},kj={name:"dark",colorScheme:{default:{dataScheme:sj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Mj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Mj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Mj(t[i],e[i])))),Tj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),Tj(t[s],e.slice(1),i))};function wj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof ya||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=wj(n,e)}return s}function Cj(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Ej(t,e,r,i):Pj(t,r,s[r])}}}}function Ej(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Bj({},t[n][e.index],i):i):t[n]=s?Bj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Bj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Bj({},t[n],i):i)}))}function Lj(t,...e){return Bj(Oj(t),...e.map(Oj))}function Oj(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=GF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(LF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Ij(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Ij(t,e,i,s){if(!LF[e])return t;const n={};return Object.values(LF[e]).forEach((({type:e,name:r})=>{n[r]=Bj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Dj=["animationThreshold","colorScheme","name","padding"];function Fj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Dj.includes(r)?n[r]=a:f(a)?NF(a)?n[r]=HF(a,e,s):xj(a)?n[r]=bj(i,a):n[r]=Fj(a,e,i,s):n[r]=a})),n}const jj={[Aj.name]:Aj},zj=Aj.name,Hj=new Map(Object.keys(jj).map((t=>[t,jj[t]]))),Nj=new Map(Object.keys(jj).map((t=>[t,Fj(jj[t])]))),Vj=new Map(Object.keys(jj).map((t=>[t,t===zj]))),Gj=(t,e)=>{if(!t)return;const i=Kj(e);Hj.set(t,i),Nj.set(t,Fj(i)),Vj.set(t,!0)},Wj=(t=zj,e=!1)=>(Vj.has(t)&&!Vj.get(t)&&Gj(t,Hj.get(t)),e?Nj.get(t):Hj.get(t)),Uj=t=>Hj.delete(t)&&Nj.delete(t)&&Vj.delete(t),Yj=t=>!!_(t)&&Hj.has(t),Kj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:zj;return Lj({},Wj(i),t)};class Xj{static registerInstance(t){Xj.instances.set(t.id,t)}static unregisterInstance(t){Xj.instances.delete(t.id)}static getInstance(t){return Xj.instances.get(t)}static instanceExist(t){return Xj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Xj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Xj.instances=new Map;class $j{static registerTheme(t,e){Gj(t,e)}static getTheme(t,e=!1){return Wj(t,e)}static removeTheme(t){return Uj(t)}static themeExist(t){return Yj(t)}static getDefaultTheme(){return $j.themes.get(zj)}static setCurrentTheme(t){$j.themeExist(t)&&($j._currentThemeName=t,Xj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return $j.getTheme($j._currentThemeName,t)}static getCurrentThemeName(){return $j._currentThemeName}}function qj(t,e){return _(t)?$j.themeExist(t)?$j.getTheme(t,e):{}:g(t)?t:{}}function Zj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Zj(t[s],e)}return i}return y(t)?t.map((t=>Zj(t,e))):t}function Jj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}$j.themes=Hj,$j._currentThemeName=zj;function Qj(t,e){for(let i=0;it.key===e))}function ez(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function iz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},oz(t,a,n[o],l,e,r))})),s?sz(n):n}function sz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):sz(t[e].nodes);return t}function nz(t,e){if("values"in t&&t.values.length){const i=eB(t.values,e),s=tB(t.values,PD);t.values.forEach((t=>{t[LD]=i,t[OD]=s,delete t[ID]}));const n=t.values.reduce(((t,e)=>e[CD]>t[CD]?e:t));n[ID]=!0}else for(const i in t.nodes)nz(t.nodes[i],e)}function rz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][CD]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[wD]=s,s+=r[CD],r[CD]=s):(r[wD]=n,n+=r[CD],r[CD]=n),r[TD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[ED]=0===h?0:Math.min(1,l[wD]/h)*r,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r}}for(const s in t.nodes)az(t.nodes[s],e,i)}function oz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[CD]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),oz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const lz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=cz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function dz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>gz(t.style(e,i,s,n)):B(t.style)||(e.style=gz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>gz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=gz(t.state[e]))})),e.state=i}return e}function uz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e,s,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}function pz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),gz(i)}function gz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class mz{static registerChart(t,e){mz._charts[t]=e}static registerSeries(t,e){mz._series[t]=e}static registerComponent(t,e,i){mz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){mz._marks[t]=e}static registerRegion(t,e){mz._regions[t]=e}static registerTransform(t,e){mz.transforms[t]=e}static registerLayout(t,e){mz._layout[t]=e}static registerAnimation(t,e){mz._animations[t]=e}static registerImplement(t,e){mz._implements[t]=e}static registerChartPlugin(t,e){mz._chartPlugin[t]=e}static registerComponentPlugin(t,e){mz._componentPlugin[t]=e}static createChart(t,e,i){if(!mz._charts[t])return null;return new(0,mz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!mz._charts[t])return null;const i=mz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!mz._regions[t])return null;return new(0,mz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!mz._regions[t])return null;return new(0,mz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!mz._series[t])return null;return new(0,mz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!mz._series[t])return null;return new(0,mz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!mz._marks[t])return null;const s=new(0,mz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(mz._components)}static getComponentInKey(t){return mz._components[t].cmp}static getLayout(){return Object.values(mz._layout)}static getLayoutInKey(t){return mz._layout[t]}static getSeries(){return Object.values(mz._series)}static getSeriesInType(t){return mz._series[t]}static getRegionInType(t){return mz._regions[t]}static getAnimationInKey(t){return mz._animations[t]}static getImplementInKey(t){return mz._implements[t]}static getSeriesMarkMap(t){return mz._series[t]?mz._series[t].mark:{}}static getChartPlugins(){return Object.values(mz._chartPlugin)}static getComponentPlugins(){return Object.values(mz._componentPlugin)}static getComponentPluginInType(t){return mz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}mz._charts={},mz._series={},mz._components={},mz._marks={},mz._regions={},mz._animations={},mz._implements={},mz._chartPlugin={},mz._componentPlugin={},mz.transforms={fields:Or,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},mz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},mz._layout={};const fz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},vz=(t,e,i,s)=>{var n;const r=Nw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:_z(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,yz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},bz=(t,e)=>{if(!t)return null;if(!lB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=yz(t,(t=>"angle"===t.getOrient()),e),r=yz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Nw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=nB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=rB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=vz(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Nw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=nB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=rB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=vz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function xz(t){return"bottom"===t||"top"===t}function Sz(t){return"left"===t||"right"===t}function Az(t){return"z"===t}function kz(t,e){return qF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Mz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Tz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?xz(t)?"linear":"band":xz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const wz=t=>t.fieldX[0],Cz=t=>t.fieldY[0],Ez=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Pz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Bz=(t,e)=>t?e?wz:Ez:e?Cz:Pz,Rz=(t,e,i)=>{var s,n;if(!t)return null;if(!lB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=yz(t,(t=>xz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=yz(t,(t=>Sz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Nw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Lz(s,i,t,Bz(e,Nw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Lz(s,i,t,Bz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Lz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Oz(t,a,s)},Oz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=vz(e,t,"cartesian",null!=i?i:xz(t.getOrient())?wz:Cz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Iz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Rz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=bz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Nw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return xz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Oz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Dz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Dz||(Dz={}));const Fz={[Dz.dimensionHover]:class extends Iz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!fz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Dz.dimensionClick]:class extends Iz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let jz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(Fz[t]){const e=new Fz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(Fz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class zz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Hz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Nz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new zz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Hz[a]&&(a=Hz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=St(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=xt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return uD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteraction(e)}}function Vz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Gz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Wz=new Map;let Uz;function Yz(){Uz||(Uz=new va,Gz(Uz,"geojson",da),Gz(Uz,"topojson",pa),Vz(Uz,"simplify",Rr))}function Kz(t,e,i={type:"geojson",centroid:!0}){Wz.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),Yz();const s=new ya(Uz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Wz.set(t,s)}function Xz(t){Wz.has(t)?Wz.delete(t):Jy(`map type of '${t}' does not exists.`)}function $z(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const qz=(t,e)=>0===t.length?[]:1===t.length?$z(t[0],null==e?void 0:e.deep):t.map((t=>$z(t,null==e?void 0:e.deep)));function Zz(t,e,i){Vz(e=e instanceof va?e:t.dataSet,"copyDataView",qz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:tH.copyDataView}),s}function Jz(t,e,i=[],s={}){var n,r,a;if(t instanceof ya)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new ya(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Qy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Qy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Jy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function Qz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var tH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(tH||(tH={}));const eH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new fO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:aH(this._option.mode),autoFit:!1,eventConfig:{gesture:nb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(O_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=O_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function lH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function hH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Bj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function cH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ii(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function dH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme")}),t}function uH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(nH||(nH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(rH||(rH={}));class pH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},pH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}pH.defaultMarkInfo={};class gH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new pH,this._markReverse=new pH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(nH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(nH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[nH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[nH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Dz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const mH={};Object.values(nH).forEach((t=>{mH[t]=!0}));const fH={[nH.STATE_HOVER]:nH.STATE_HOVER_REVERSE,[nH.STATE_SELECTED]:nH.STATE_SELECTED_REVERSE,[nH.STATE_DIMENSION_HOVER]:nH.STATE_DIMENSION_HOVER_REVERSE};function vH(t){return fH[t]}class _H{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=vH(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=vH(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=vH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=vH(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class yH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class bH extends yH{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xH extends bH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=sH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class SH extends yH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class AH extends SH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class kH extends AH{constructor(){super(...arguments),this.id=ob(),this.stateKeyToSignalName=t=>`${uB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===iH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===iH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?iH.none:iH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?iH.exit:"update"===e.diffState?iH.update:iH.appear}}}}class MH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Bj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TH extends yH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=MH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new pH,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new jz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${uB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=mz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class wH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=QF(tj(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=JF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=JF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=JF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class CH extends TH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new wH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EH extends MH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class PH extends CH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=EH,this.modelType="region",this.specKey="region",this.type=PH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new _H,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new gH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in rH)B(t.stateStyle[rH[e]])||this.interaction.registerMark(rH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function BH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function RH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function LH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function OH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),LH(c,!0,u,o),s&&RH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function IH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),LH(c,!1,u,a),s&&RH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function FH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"left"),n.length&&OH(n,e,i,!0,"left"),r.length&&IH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"top"),n.length&&DH(n,e,i,!0,"top"),r.length&&FH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"right"),n.length&&OH(n,e,i,!0,"right"),r.length&&IH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"bottom"),n.length&&DH(n,e,i,!0,"bottom"),r.length&&FH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:s,height:n}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}jH.type="base";const zH=["line","area","trail"];function HH(t){return zH.includes(t)}class NH extends AH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(HH)?s:!t.mark||HH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!mH[t])).map((t=>[t,10])),s=!t.mark||HH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(zw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class VH extends bH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class GH extends VH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${uB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class WH extends bH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=sH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new NH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new jz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new GH(t)}stateKeyToSignalName(t){return`${uB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=nH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=nH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===iH.appear&&this.runAnimationByState(iH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(iH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class UH extends WH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,te)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Bj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=KF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):HD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Hw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},WD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=_e.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)HD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class YH extends UH{constructor(){super(...arguments),this.type=YH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}YH.type="group";const KH=()=>{bM(),aM(),CR.registerGraphic(IB.group,Cu),mz.registerMark(YH.type,YH)},XH={type:"fadeIn"};function $H(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return XH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const qH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},ZH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},JH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},QH=()=>{mz.registerAnimation("scaleInOut",(()=>ZH))},tN=()=>{mz.registerAnimation("fadeInOut",(()=>JH))},eN=(t,e)=>({appear:$H(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Wc,duration:qH.update.duration,easing:qH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),iN=()=>{mz.registerAnimation("line",eN)},sN=()=>{fO.useRegisters([XI,$I,qI,ZI,JI,QI,jI,zI])},nN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Sj.fontFamily,fontSize:Sj.fontSize}))(e,i,s).measure(t)};class rN{static instance(){return rN.instance_||(rN.instance_=new rN),rN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class aN{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class oN extends aN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class lN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>mz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>mz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>mz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return mz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>mz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){mz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}static getFunction(t){return t?rN.instance().getFunction(t):null}static getFunctionList(){return rN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=mz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=mz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Wz.get(e);var e}static hideTooltip(t=[]){Xj.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=xt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=sb(p);v?Rx(th):"node"===p&&PA(th),v&&d&&(this._container=_(d)?O_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=$j.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new oH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Nz(this,this._compiler),this._event=new jz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Xj.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Bj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Zj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;lN.getFunctionList()&&lN.getFunctionList().length&&(t=Jj(t,lN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=mz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return cH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:pB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:gB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof va?t:new va,Gz(this._dataSet,"dataview",ga),Gz(this._dataSet,"array",s),Vz(this._dataSet,"stackSplit",eH),Vz(this._dataSet,"copyDataView",qz);for(const t in mz.transforms)Vz(this._dataSet,t,mz.transforms[t]);for(const t in mz.dataParser)Gz(this._dataSet,t,mz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)),null===(n=this._compiler)||void 0===n||n.releaseGrammar(!1===(null===(r=this._option)||void 0===r?void 0:r.animation)||!1===(null===(a=this._spec)||void 0===a?void 0:a.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily)),t.reCompile&&(null===(l=this._compiler)||void 0===l||l.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(h=this._compiler)||void 0===h||h.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?iH.appear:iH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Xj.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof ya?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Jz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)||(a.changeTheme=!0);const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=dH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Bj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=qj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Lj({},qj(this._currentThemeName,!0),qj(s,!0),qj(n,!0));this._currentTheme=t}else{const t=Lj({},qj(this._currentThemeName),qj(s),qj(n));this._currentTheme=Fj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return qj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield lH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ej(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ej(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rN.instance().getFunction(t)}registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}getFunctionList(){return rN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=mz.getChartPlugins();t.length>0&&(this._chartPlugin=new oN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}lN.InstanceManager=Xj,lN.ThemeManager=$j,lN.globalConfig={uniqueTooltip:!0},lN.Utils=nN,lN.vglobal=O_;mz.registerRegion("region",PH),mz.registerLayout("base",jH),KH(),fO.useRegisters([sI,nI]),fO.useRegisters([aD,oD,HI,NI,nD,rD,lD,hD,cD]),$R(),XR(),Gj(kj.name,kj),at.getInstance(rt.Error);const hN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(cB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=mz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=mz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},cN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=hN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Mj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Bj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Bj(m,f),hasChanged:!0};const i=Bj({},t,f);Tj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class dN{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const uN=t=>{mz.registerChartPlugin(t.type,t)};class pN extends dN{constructor(){super(pN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[pN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[pN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=wj(this._option.globalInstance.getSpec(),["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=wj(this._baseChartSpec,["data",pN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=cN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=wj(i,["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}pN.pluginType="chart",pN.specKey="media",pN.type="MediaQueryPlugin";const gN=/\{([^}]+)\}/,mN=/\{([^}]+)\}/g,fN=/:/;class vN extends dN{constructor(){super(vN.type),this.type="formatterPlugin",this._timeModeFormat={utc:di.getInstance().timeUTCFormat,local:di.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=yi.getInstance().format,this._numericSpecifier=yi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[vN.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),mz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=gN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(mN,((t,i)=>{if(!fN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(fi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}vN.pluginType="chart",vN.specKey="formatter",vN.type="formatterPlugin";const _N=()=>{uN(vN)};function yN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function bN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function xN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function SN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function AN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function kN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const MN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return IC(v)};class TN extends dN{constructor(){super(TN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!zw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&yN(c)&&yN(d)))return;const u=bN(t,c),p=bN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!SN(u,p))return}else if(0===y&&0===b){if(!SN(p,u))return}else if(_||A)if(_&&!A){if(!xN(u,p))return}else if(A&&!_){if(!xN(p,u))return}else{if(m===b)return;if(m>b){if(!AN(u,p))return}else if(!AN(p,u))return}else{if(0===m&&0===y){if(!kN(u,p))return}else if(0===b&&0===g&&!kN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Vz(e.getOption().dataSet,"tickAlign",MN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}TN.pluginType="component",TN.type="AxisSyncPlugin";const wN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,CN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ym||(ym=vm.CreateGraphic("richtext",{})),ym.setAttributes(a),ym.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},EN="vchart-tooltip-container",PN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function BN(t,e){return R(e,`component.${t}`)}function RN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=mz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const LN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ON(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function IN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function DN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function FN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const jN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):["linear","log","symlog"].includes(e)?BN("axisLinear",i):{})&&void 0!==s?s:{},r=xz(t)?BN("axisX",i):Sz(t)?BN("axisY",i):BN("axisZ",i);return Bj({},BN("axis",i),n,r)},zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):"linear"===e?BN("axisLinear",i):{})&&void 0!==s?s:{},r=BN("angle"===t?"axisAngle":"axisRadius",i);return Bj({},BN("axis",i),n,r)},HN=t=>"band"===t||"ordinal"===t||"point"===t;function NN(t,e){return{id:t,label:t,value:e,rawValue:t}}function VN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function GN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const WN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Nw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(zw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=ON(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Nw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(zw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=ON(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&UN(t,"top",r.label),e.visible&&UN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&UN(t,"left",a.label),e.visible&&UN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},UN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=RN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},YN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},KN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=$N(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},XN=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=$N(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},$N=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},qN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},ZN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},JN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},QN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},tV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=WN(3,e,i,s,n,r,a);return o?KN(r,o,d,h):l?XN(a,l,u,c):void 0},eV={fontFamily:Sj.fontFamily,spacing:10,wordBreak:"break-word"};function iV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},nV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=lV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rV(i,s)(t)&&rV(n,r)(t)&&(u(a)||rV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(u.id),d}return"none"}const lV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=nV(c,t);let _=nV(d,t);const y=aV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rV(c,v));if(!y&&(_=nV(d,i),!aV(_)))return;const n=e.type===cB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Nw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(rV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nV(d,o),!aV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(rV(c,n));if(!y&&(_=nV(d,r),!aV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=nV(d,i),!aV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},hV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const cV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class dV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class uV extends dV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:gV(e.title,{seriesId:this.series.id},!0),content:mV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=hV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const pV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},gV=(t,e,i)=>p(t)?d(t)?(...s)=>pV(t(...s),e,i):pV(t,e,i):void 0,mV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>pV(t,e,i))):pV(t,e,i))):void 0;return s},fV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=cV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=cV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},vV=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=_V(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&hV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},_V=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),yV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},bV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=RN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},SV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class AV{}AV.dom=`${uB}_TOOLTIP_HANDLER_DOM`,AV.canvas=`${uB}_TOOLTIP_HANDLER_CANVAS`;const kV=20,MV={key:"其他",value:"..."},TV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=di.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},wV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=SV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==xV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:TV(xV(c,t,i,v),p,g),valueStyle:xV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=kV}=t,x=t.othersLine?Object.assign(Object.assign({},MV),t.othersLine):MV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=CV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=CV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},CV=(t,e,i)=>{const s=TV(xV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=TV(xV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==xV(e.visible,t,i)&&(p(s)||p(n)),a=xV(e.isKeyAdaptive,t,i),o=xV(e.spaceRow,t,i),l=xV(e.shapeType,t,i),h=xV(e.shapeColor,t,i),c=xV(e.shapeFill,t,i),d=xV(e.shapeStroke,t,i),u=xV(e.shapeLineWidth,t,i),g=xV(e.shapeHollow,t,i),m=xV(e.keyStyle,t,i),f=xV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class EV extends dN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=SV(x.position,b,e),M=null!==(n=SV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:pB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:gB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(sb(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=wN(t,e),j=wN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(JN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(QN(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=qN(t,c),N=qN(i,c),V=qN(e,c),G=qN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=qN(t,c):Y(t),S(e)||d(e)?N=qN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(JN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(QN(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,sb(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===JN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===JN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===QN(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===QN(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(JN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(QN(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,St(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},PN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:PN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:PN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ei(d.padding),x=tj(d.padding),S=iV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=iV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=iV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:sV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Bj({},A,iV(b,void 0,{})),{width:s,height:n,text:r}=CN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Bj({},k,iV(x,void 0,{})),{width:e,height:s,text:n}=CN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Bj({},S,iV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=CN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(sb(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=wN(t,s),u=wN(l,c)}return s*=d,n*=d,sb(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(De(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Xe([c,a,o],r.x,r.y)||Xe([c,l,h],r.x,r.y)||Xe([c,a,h],r.x,r.y)||Xe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}EV.specKey="tooltip";const PV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",BV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let RV;const LV=(t=document.body)=>{if(u(RV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),RV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return RV};function OV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Bj({},e,t),s={};return s.width=PV(i),s}(C),R=IV(E),L=IV(P),{bottom:O,left:I,right:D,top:F}=tj(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:PV(T+2*M),minHeight:PV(g+2*M),paddingBottom:PV(O),paddingLeft:PV(I),paddingRight:PV(D),paddingTop:PV(F),borderColor:k,borderWidth:PV(M),borderRadius:PV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?PV(null==r?void 0:r.spaceRow):"0px"},IV(Bj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return DV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=DV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==ib?void 0:ib.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(DV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}DV.type="tooltipModel";const FV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},jV={boxSizing:"border-box"},zV={display:"inline-block",verticalAlign:"top"},HV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},GV={lineHeight:"normal",boxSizing:"border-box"};class WV extends DV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=BV(u),y=t=>new Ag({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class UV extends DV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const YV={overflowWrap:"normal",wordWrap:"normal"};class KV extends DV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Bj({},zV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Bj({},o?NV:HV,Object.assign(Object.assign(Object.assign({height:PV(l)},YV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Bj({},VV,Object.assign(Object.assign(Object.assign({height:PV(s)},YV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Bj({},GV,Object.assign(Object.assign({height:PV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class XV extends DV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new KV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Bj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+BV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+LV(this._option.getContainer())}px`,maxHeight:PV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class $V extends DV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new WV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new UV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Bj({},FV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const qV="99999999999999";class ZV extends DV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:qV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new $V(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new XV(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Bj({},jV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const JV=t=>{mz.registerComponentPlugin(t.type,t)};class QV extends EV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(QV.type),this.type=AV.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(ib&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=OV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!si(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}QV.type=AV.dom;class tG extends EV{constructor(){super(tG.type),this.type=AV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ZP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}tG.type=AV.canvas;const eG=()=>{JV(tG)},iG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},nG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=Qj([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return rG(a,n,o)},rG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=sG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},aG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t};class oG extends VH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const lG=`${uB}_HIERARCHY_DEPTH`,hG=`${uB}_HIERARCHY_ROOT`,cG=`${uB}_HIERARCHY_ROOT_INDEX`;function dG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function uG(t,e,i){t&&(i.needDefaultSeriesField&&(t[AD]=i.defaultSeriesField),t[xD]=e,t[SD]=i.getKey(t,e,i))}function pG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function gG(t,e,i,s=0,n,r){void 0===r&&(r=e),uG(t,e,i),t[lG]=s,t[hG]=n||t[i.categoryField],t[cG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>gG(e,s,i,t[lG]+1,t[hG],r)))}const mG=["appear","enter","update","exit","disappear","normal"];function fG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Bj({},o[e],a);return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function vG(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),SG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function _G(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function yG(t,e){var i,s;return null!==(i=null==t?void 0:t[xD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function bG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function xG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function SG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),SG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),SG(t[i],e)}function AG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class kG extends MH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Ij(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Bj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Bj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Bj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class MG extends TH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${uB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=AG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"invalidTravel",aG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Jz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Zz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Zz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new oG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=rG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Vz(this._dataSet,"dimensionStatistics",nG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ya(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Qj(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Vz(this._dataSet,"dimensionStatistics",nG);const s=new ya(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=Qj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Qj(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ya(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Bj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Bj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:nH.STATE_HOVER_REVERSE,highlightState:nH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:nH.STATE_SELECTED_REVERSE,state:nH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:AD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:kD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,kD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new uV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},qD),ZD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>ZD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ya||Qz(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();AG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:AD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new UF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return FF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:AD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Bj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:SD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==CD&&t!==PD&&t!==wD&&t!==ED||(t=this.getStackValueField()),null!==(e=ez(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=LF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:AD]}}function TG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();zw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function wG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}MG.mark=UD,MG.transformerConstructor=kG;class CG extends MG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);zw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${uB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(CD),this.setFieldX2(wD)):(this.setFieldY(CD),this.setFieldY2(wD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(PD),this.setFieldX2(ED)):(this.setFieldY(PD),this.setFieldY2(ED))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(RD),this.setFieldX2(BD)):(this.setFieldY(RD),this.setFieldY2(BD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(TG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const EG="monotone",PG="linear";class BG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(tF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===EG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(tF.point,{morph:bG(this._spec,tF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new ya(this._option.dataSet,{name:`${uB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[tF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Bj({},this._spec[tF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class RG extends UH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Hw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class LG extends RG{constructor(){super(...arguments),this.type=LG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===cB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}LG.type="line";const OG=()=>{mz.registerMark(LG.type,LG),bM(),cM(),CR.registerGraphic(IB.line,wg),sN()};class IG extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class DG extends IG{constructor(){super(...arguments),this.type=DG.type}}DG.type="symbol";const FG=()=>{mz.registerMark(DG.type,DG),bO()};class jG extends kG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class zG extends aN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function HG(t,e,i,s){switch(t){case r.cartesianBandAxis:return jN(kz(i,["z"]),"band",e);case r.cartesianLinearAxis:return jN(kz(i,["z"]),"linear",e);case r.cartesianLogAxis:return jN(kz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return jN(kz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return jN(kz(i),void 0,e);case r.polarBandAxis:return zN(i.orient,"band",e);case r.polarLinearAxis:return zN(i.orient,"linear",e);case r.polarAxis:return zN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>xz(t.orient)));let d;d=p(c)?Bj({},HN(c.type)?a:o,l):l;const u=n.find((t=>Sz(t.orient)));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Bj({},HN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return NG(i,BN(t,e));default:return BN(t,e)}}const NG=(t,e)=>{var i;const s=Bj({},e,e[Mz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class VG extends MH{getTheme(t,e){return HG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},tj(e)),{[s]:0}))}}class GG extends CH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new zG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=VG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof rc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}GG.transformerConstructor=VG;class WG extends UH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(IB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WG.type="component";const UG=()=>{mz.registerMark(WG.type,WG)},YG=t=>t;class KG extends GG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?zB.circleAxisGrid:zB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fG(null===(o=mz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new VH(this._option,t)]}collectData(t,e){const i=[];return aB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?zw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return aB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(aB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=dz(s=t.domainLine)).startSymbol=dz(s.startSymbol),s.endSymbol=dz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return gz(Bj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:gz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:gz(t.tick.style)),t.tick.state&&(i.tick.state=uz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:gz(t.subTick.style)),t.subTick.state&&(i.subTick.state=uz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=LN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Bj({},d,gz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:gz(h.style)}),h.state&&(i.title.state.shape=uz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:gz(o.style)}),o.state&&(i.title.state.background=uz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=uz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=gz(t.background.style)),t.background.state&&(i.panel.state=uz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return gz(Bj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:gz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:gz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=RN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Gz(this._option.dataSet,"scale",YG),Vz(this._option.dataSet,"ticks",XC);return new ya(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}KG.specKey="axes";const XG=()=>{CR.registerGraphicComponent(jB.lineAxis,((t,e)=>new Bw(t,e))),CR.registerGraphicComponent(jB.circleAxis,(t=>new Iw(t))),CR.registerComponent(DB.axis,NO),CR.registerGraphicComponent(zB.lineAxisGrid,((t,e)=>new QC(t,e))),CR.registerGraphicComponent(zB.circleAxisGrid,((t,e)=>new eE(t,e))),CR.registerComponent(DB.grid,WO),UG(),mz.registerAnimation("axis",(()=>({appear:{custom:Fw},update:{custom:Dw},exit:{custom:Xc}})))},$G=[TN];class qG extends KG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{const e=this.getOrient();xz(e)?t.setXAxisHelper(this.axisHelper()):Sz(e)?t.setYAxisHelper(this.axisHelper()):Az(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Bj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Bj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=xz(this.getOrient()),n=t=>{var e;return(s?!xz(t.getOrient()):xz(t.getOrient()))&&zw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=kz(i,["z"]),Az(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!DN(e))return null;const{axisType:t,componentName:s}=Tz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Sz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!DN(t))return;const{axisType:s,componentName:n}=Tz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];xz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):Az(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load($G.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){xz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!xz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!Az(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Sz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=xz(this.getOrient())?t.fieldX:Az(this.getOrient())?t.fieldZ:t.fieldY,zw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(xz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=xz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return aB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:xz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Az(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();aB(this._regions,(e=>{xz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Sz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Az(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=xz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=xz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Bj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return NN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=IN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=ZG?10:n>=JG?5:n>=QG?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}eW.type=r.cartesianLinearAxis,eW.specKey="axes",U(eW,tW);const iW=()=>{XG(),mz.registerComponent(eW.type,eW)};class sW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=NN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class nW extends qG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Qw(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{XG(),mz.registerComponent(nW.type,nW)};class aW extends eW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{xz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Bj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=di.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}aW.type=r.cartesianTimeAxis,aW.specKey="axes";class oW extends eW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new RC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}oW.type=r.cartesianLogAxis,oW.specKey="axes",U(oW,tW);class lW extends eW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}lW.type=r.cartesianSymlogAxis,lW.specKey="axes",U(lW,tW);class hW extends CG{constructor(){super(...arguments),this.type=cB.line,this.transformerConstructor=jG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),vG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=cB.line,hW.mark=eF,hW.transformerConstructor=jG,U(hW,BG);class cW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{Qz(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ya)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Qj(e,[{key:t,operations:zw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&Qj(e,[{key:i.field,operations:zw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?KF("colorOrdinal"):KF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=zw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=zw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;zw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=zw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=iz(t,!0);for(const e in a)for(const i in a[e].nodes)az(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)rz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&nz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pW extends yH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pB,height:gB},this._viewRect={width:pB,height:gB},this._viewBox={x1:0,y1:0,x2:pB,y2:gB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=tj(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new jz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new uW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=mz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=mz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof UH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof UH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&Qz(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cH(this._spec,this._option,{width:pB,height:gB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=FF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){dH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=FF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{dH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,dH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):dH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];dH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=QF(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(nH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(nH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(nH.STATE_SELECTED)}clearHovered(){this.clearState(nH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Dz.dimensionHover||s===Dz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Nw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const gW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class mW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);Tj(t,r,l.spec),Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=mz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class fW extends mW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Bj(i,uH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class vW extends fW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class _W extends pW{constructor(){super(...arguments),this.transformerConstructor=vW,this.type="line",this.seriesType=cB.line,this._canStack=!0}}_W.type="line",_W.seriesType=cB.line,_W.transformerConstructor=vW;class yW extends RG{constructor(){super(...arguments),this.type=yW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}yW.type="area";const bW=()=>{mz.registerMark(yW.type,yW),bM(),tM(),CR.registerGraphic(IB.area,$g),sN()};class xW extends uV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const SW=()=>{mz.registerAnimation("area",eN),iN(),QH()};class AW extends jG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Bj({},m.style,g.style),l.state=Bj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class kW extends CG{constructor(){super(...arguments),this.type=cB.area,this.transformerConstructor=AW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(kW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===EG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XF(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XF(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),vG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),vG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new xW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}kW.type=cB.area,kW.mark=sF,kW.transformerConstructor=AW,U(kW,BG);class MW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class TW extends pW{constructor(){super(...arguments),this.transformerConstructor=MW,this.type="area",this.seriesType=cB.area,this._canStack=!0}}TW.type="area",TW.seriesType=cB.area,TW.transformerConstructor=MW;function wW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const CW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wW(t,e)}),EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wW(t,e)}),PW={type:"fadeIn"},BW={type:"growCenterIn"};function RW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return PW;case"scaleIn":return BW;default:return CW(t)}}class LW extends UH{constructor(){super(...arguments),this.type=LW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}LW.type="rect";const OW=()=>{mz.registerMark(LW.type,LW),_O(),fO.useRegisters([WI,UI,YI,KI,VI,GI])};function IW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[YD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):XF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):XF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):XF(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},jW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:bG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(jW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Vz(this._option.dataSet,"addVChartProperty",iG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Vz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ya(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new oG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=$D,s=XD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=KD,s=YD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=iz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)IW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=XF(this[n](t),o),d=XF(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[wD],n=t[CD],r=t[ED],h=t[PD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[wD]:i,[CD]:s}),a?{[ED]:o,[PD]:l}:void 0);t.push(Pg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>XF(this._dataToPosY(t),a),y1:t=>XF(this._dataToPosY1(t),a)}:{y:t=>XF(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>XF(this._dataToPosX(t),r),x1:t=>XF(this._dataToPosX1(t),r)}:{x:t=>XF(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=wG(this);this._barMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),vG(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=ij(this._spec.barWidth,a)),l&&(c=Math.max(c,ij(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ij(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ij(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=zw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}jW.type=cB.bar,jW.mark=JD,jW.transformerConstructor=FW;const zW=()=>{rI(),OW(),mz.registerAnimation("bar",((t,e)=>({appear:RW(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t)}))),rW(),iW(),mz.registerSeries(jW.type,jW)};class HW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),hH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class NW extends pW{constructor(){super(...arguments),this.transformerConstructor=HW,this.type="bar",this.seriesType=cB.bar,this._canStack=!0}}NW.type="bar",NW.seriesType=cB.bar,NW.transformerConstructor=HW;class VW extends UH{constructor(){super(...arguments),this.type=VW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}VW.type="rect3d";class GW extends jW{constructor(){super(...arguments),this.type=cB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}GW.type=cB.bar3d,GW.mark=QD;class WW extends HW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class UW extends NW{constructor(){super(...arguments),this.transformerConstructor=WW,this.type="bar3d",this.seriesType=cB.bar3d}}UW.type="bar3d",UW.seriesType=cB.bar3d,UW.transformerConstructor=WW;const YW=[10,20],KW=Lw.Linear,XW="circle",$W=Lw.Ordinal,qW=["circle","square","triangle","diamond","star"],ZW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class JW extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QW extends CG{constructor(){super(...arguments),this.type=cB.scatter,this.transformerConstructor=JW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${uB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${uB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KW,defaultRange:YW},"size")}getShapeAttribute(t,e){return u(e)?XW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:$W,defaultRange:qW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(QW.mark.point,{morph:bG(this._spec,QW.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=wG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),vG("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:XW},nH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},nH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QW.type=cB.scatter,QW.mark=iF,QW.transformerConstructor=JW;const tU=()=>{FG(),mz.registerAnimation("scatter",((t,e)=>Object.assign({appear:ZW(0,e)},ZH))),rW(),iW(),mz.registerSeries(QW.type,QW)};class eU extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class iU extends pW{constructor(){super(...arguments),this.transformerConstructor=eU,this.type="scatter",this.seriesType=cB.scatter,this._canStack=!0}}iU.type="scatter",iU.seriesType=cB.scatter,iU.transformerConstructor=eU;Ln();const sU={},nU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rU(t,e){t&&_(t)||ub("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(sU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ln().projection(s),s.copy=s.copy||function(){const t=i();return nU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),sU[i]||null}const aU={albers:Jn,albersusa:function(){var t,e,i,s,n,r,a=Jn(),o=Zn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Zn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(aU).forEach((t=>{rU(t,aU[t])}));const oU="Feature",lU="FeatureCollection";function hU(t){const e=Y(t);return 1===e.length?e[0]:{type:lU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===lU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===oU?t:{type:oU,geometry:t}))}(e))),[])}}const cU=nU.concat(["pointRadius","fit","extent","size"]);function dU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{cU.includes(s)&&(i=i.concat(mR(t[s],e)))})),i):i}let uU=class extends QR{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(mR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(mR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(mR(this.spec.size,this.view)),this.spec.size=t,this.attach(mR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(mR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(mR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(mR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(mR(t,this.view)),this.commit(),this}configure(t){return this.detach(dU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(dU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=rU((t||"mercator").toLowerCase());return e||ub("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),nU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,vR(this.spec[t],e,rU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(vR(this.spec.pointRadius,e,rU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=hU(vR(this.spec.fit,e,rU));this.spec.extent?this.projection.fitExtent(vR(this.spec.extent,e,rU),t):this.spec.size&&this.projection.fitSize(vR(this.spec.size,e,rU),t)}return this.projection}output(){return this.projection}};const pU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class gU extends MG{constructor(){super(...arguments),this.type=cB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${uB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mU=`${uB}_MAP_LOOK_UP_KEY`,fU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[xD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mU]=e.nameMap[n]:t[mU]=n})),t.features);class vU extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class _U extends UH{constructor(){super(...arguments),this.type=_U.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}_U.type="path";const yU=()=>{mz.registerMark(_U.type,_U),vO()};class bU{constructor(t){this.projection=rU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class xU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class SU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function AU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:xU}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:SU}:null}const kU={debounce:xt,throttle:St};class MU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),AU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,kU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:De({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,kU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){AU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;De({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||AU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=kU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=kU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function TU(t,e){return`${uB}_${e}_${t}`}class wU extends GG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:TU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Bj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new bU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===cB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),aB(this._regions,(t=>{var e;if(t.type===cB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new oe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===cB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}wU.type=r.geoCoordinate,U(wU,MU);const CU=()=>{mz.registerComponent(wU.type,wU)};class EU extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class PU extends gU{constructor(){super(...arguments),this.type=cB.map,this.transformerConstructor=EU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Wz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Vz(this._dataSet,"copyDataView",qz),Vz(this._dataSet,"map",fU),Vz(this._dataSet,"lookup",pU);const i=Wz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ya(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:tH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new oG(this._option,s)}initMark(){this._pathMark=this._createMark(PU.mark.area,{morph:bG(this._spec,PU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:AD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(fG(null===(t=mz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),vG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[xD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[xD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new oe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new oe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return xD}getActiveMarks(){return[this._pathMark]}}PU.type=cB.map,PU.mark=lF,PU.transformerConstructor=EU;const BU=()=>{CR.registerGrammar("projection",uU,"projections"),CU(),yU(),mz.registerSeries(PU.type,PU),mz.registerImplement("registerMap",Kz),mz.registerImplement("unregisterMap",Xz),tN()},RU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[ID]=!0:delete t[ID]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=LU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Kt(_,e)):(t[c]=+y,y=Kt(y,e)),t[d]=Kt(t[c],e),f=Kt(f,e),b=Xt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=LU(a,t,n,r,h,l,i,e),r.push(n)})),r};function LU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Kt(i.positive,e)):(t[h]=+i.negative,i.negative=Kt(i.negative,e)),t[c]=Kt(t[h],e),i.end=Kt(i.end,e)}i.isTotal=e,(u(p)||p===fD)&&(t[fD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Kt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Kt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},DU={type:"fadeIn"},FU={type:"growCenterIn"};function jU(t,e){switch(e){case"fadeIn":return DU;case"scaleIn":return FU;default:return CW(t,!1)}}class zU extends UH{constructor(){super(...arguments),this.type=zU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}zU.type="rule";const HU=()=>{mz.registerMark(zU.type,zU),yO()},NU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ya(e instanceof va?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Vz(e,"dimensionTree",NU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WU extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UU={rect:qU,symbol:XU,arc:JU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=XU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:QU,line:tY,area:tY,rect3d:qU,arc3d:JU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=RN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function KU(t){return d(t)?e=>t(e.data):t}function XU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=KU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:$U(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function $U(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function qU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=KU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:ZU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function ZU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function JU(t){var e;const{labelSpec:i}=t,s=null!==(e=KU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function QU(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=YU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),yp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function tY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class eY extends jW{constructor(){super(...arguments),this.type=cB.waterfall,this.transformerConstructor=WU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=fD)}getSeriesKeys(){return this._seriesField===fD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Vz(this._dataSet,"waterfallFillTotal",IU),Vz(this._dataSet,"waterfall",RU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Zz(this.getViewData(),this._dataSet,{name:`${uB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new oG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:wD,endAs:CD,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=wG(this);this._barMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),vG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(eY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return QU(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?XF(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):XF(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}eY.type=cB.waterfall,eY.mark=vF,eY.transformerConstructor=WU;const iY=()=>{HU(),OW(),mz.registerAnimation("waterfall",((t,e)=>({appear:jU(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t,!1)}))),tN(),rW(),iW(),mz.registerSeries(eY.type,eY)},sY=`${uB}_BOX_PLOT_OUTLIER_VALUE`;var nY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nY||(nY={}));const rY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class aY extends uV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return this.series.getOutliersField();if(t===nY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nY.MIN:return this.series.getMinField();case nY.MAX:return this.series.getMaxField();case nY.MEDIAN:return this.series.getMedianField();case nY.Q1:return this.series.getQ1Field();case nY.Q3:return this.series.getQ3Field();case nY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return e[sY];if(t===nY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nY.MIN:return e[this.series.getMinField()];case nY.MAX:return e[this.series.getMaxField()];case nY.MEDIAN:return e[this.series.getMedianField()];case nY.Q1:return e[this.series.getQ1Field()];case nY.Q3:return e[this.series.getQ3Field()];case nY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(nY.OUTLIER),value:this.getContentValue(nY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(nY.MAX),value:this.getContentValue(nY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q3),value:this.getContentValue(nY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MEDIAN),value:this.getContentValue(nY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q1),value:this.getContentValue(nY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MIN),value:this.getContentValue(nY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.SERIES_FIELD),value:this.getContentValue(nY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class oY extends UH{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}oY.type="boxPlot";const lY=()=>{mz.registerMark(oY.type,oY),CR.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(TO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ab(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ab(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),CR.registerAnimationType("boxplotScaleIn",wO),CR.registerAnimationType("boxplotScaleOut",CO),SO(),_O(),yO(),CR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(PO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),CR.registerAnimationType("barBoxplotScaleIn",BO),CR.registerAnimationType("barBoxplotScaleOut",RO),SO(),_O(),yO()};class hY extends CG{constructor(){super(...arguments),this.type=cB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(hY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(hY.mark.outlier,{progressive:t,key:xD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,nH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},nH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>XF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},nH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>XF(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>XF(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,nH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"foldOutlierData",rY),Vz(this._dataSet,"addVChartProperty",iG);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${uB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._outlierDataView=new oG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=wG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=mz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(vG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(fG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(fG(null===(a=mz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}hY.type=cB.boxPlot,hY.mark=_F;class cY extends UH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}cY.type="text";const dY=()=>{mz.registerMark(cY.type,cY),xO(),bM(),_M(),CR.registerGraphic(IB.richtext,Gg)};function uY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class pY extends uV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const gY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),mY={type:"fadeIn"},fY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vY(t,e){return"fadeIn"===e?mY:gY(t)}class _Y extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class yY extends jW{constructor(){super(...arguments),this.type=cB.rangeColumn,this._barMarkType="rect",this._barName=cB.bar,this.transformerConstructor=_Y}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yY.mark.bar,{morph:bG(this._spec,yY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(yY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(yY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});uY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});uY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=wG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),vG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(fG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}yY.type=cB.rangeColumn,yY.mark=kF,yY.transformerConstructor=_Y;const bY=()=>{OW(),dY(),mz.registerAnimation("rangeColumn",((t,e)=>({appear:vY(t,e),enter:gY(t),exit:fY(t),disappear:fY(t)}))),tN(),rW(),iW(),mz.registerSeries(yY.type,yY)};class xY extends yY{constructor(){super(...arguments),this.type=cB.rangeColumn3d,this._barMarkType="rect3d",this._barName=cB.bar3d}}xY.type=cB.rangeColumn3d,xY.mark=MF;class SY extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class AY extends kW{constructor(){super(...arguments),this.type=cB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(AY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new SY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}AY.type=cB.rangeArea,AY.mark=EF;class kY extends MG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=RB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};zw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};zw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&TG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const MY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:s,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=re(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[s]))),y=r-n;let b=n,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[xB],s=m?i/m:0;let n=s*y;n{g(e,n+i*t,t)}))}else{const t=x/S;b=n,i.forEach((e=>{const i=e[c]===a?a:e[xB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function TY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const wY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:TY(t,!0,iH.appear)}),CY={type:"fadeIn"},EY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:TY(t,!0,iH.enter)}),PY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:TY(t,!0,iH.exit)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:TY(t,!0,iH.exit)});function RY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CY;case"growRadius":return wY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return wY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class LY extends UH{constructor(t,e){super(t,e),this.type=OY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>se({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[TB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class OY extends LY{constructor(){super(...arguments),this.type=OY.type}}OY.type="arc";const IY=()=>{bM(),Jk(),CR.registerGraphic(IB.arc,Jg),fO.useRegisters([iD,sD,tD,eD]),mz.registerMark(OY.type,OY)};class DY extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Bj({},this._theme,i,t);const n=(t,e)=>Bj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}class FY extends kY{constructor(){super(...arguments),this.transformerConstructor=DY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=EB,this._endAngle=PB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[TB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return se(this.computeCenter(t),(i+s)/2,e)}}getCenter(){var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?te(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?te(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?te(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Vz(this._dataSet,"pie",MY),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?te(this._spec.minAngle):0,asStartAngle:AB,asEndAngle:kB,asRatio:SB,asMiddleAngle:TB,asRadian:CB,asQuadrant:wB,asK:MB}},!1);const e=new ya(this._dataSet,{name:`${uB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new oG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},FY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:bG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:SD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return hB(AB)(t)}endAngleScale(t){return hB(kB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$F(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$F(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:hB(_B).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:n,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===n&&t.centerX===s&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[TB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return se(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===iH.appear)return this._startAngle;if(i===iH.disappear)return this._endAngle;const n=[iH.disappear,iH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[xD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[TB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[TB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[TB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[TB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}FY.transformerConstructor=DY,FY.mark=rF;class jY extends FY{constructor(){super(...arguments),this.type=cB.pie}}jY.type=cB.pie;const zY=()=>{IY(),mz.registerAnimation("pie",((t,e)=>({appear:RY(t,e),enter:EY(t),exit:PY(t),disappear:BY(t)}))),mz.registerSeries(jY.type,jY)};class HY extends LY{constructor(){super(...arguments),this.type=HY.type,this._support3d=!0}}HY.type="arc3d";class NY extends DY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class VY extends FY{constructor(){super(...arguments),this.type=cB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=NY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[TB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}VY.type=cB.pie3d,VY.mark=aF,VY.transformerConstructor=NY;const GY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},WY={type:"fadeIn"},UY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),YY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),KY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function XY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return WY;case"growAngle":return GY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return GY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class $Y extends kY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(CD),this.setInnerRadiusField(wD)}setValueFieldToPercent(){this.setRadiusField(PD),this.setInnerRadiusField(ED)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class qY extends kG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const ZY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:BB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:RB,layoutRadius:e.layoutRadius}};class JY extends KG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!FN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=ZY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s;const n=[];return e.forEach(((e,r)=>{if(!FN(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=ZY(e,t);e.center=c,e.startAngle=l,e.endAngle=h,e.outerRadius=d,e.type=a,e.layoutRadius=u;const p={spec:e,specPath:[this.specKey,r],specInfoPath:["component",this.specKey,r],type:o};i.push(p),"radius"===e.orient?n.push(p):s=r})),n.forEach((t=>{t.angleAxisIndex=s})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=EB,this._endAngle=PB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:ON(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){aB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return zw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this.computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return se(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,n=this.getLabelItems(s),r=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),a=Object.assign(Object.assign({},r),{title:{text:this._spec.title.text||this._dataFieldText},items:n,orient:"angle"});this._spec.grid.visible&&(a.grid=Object.assign({type:"line",smoothLink:!0,items:n[0]},r)),this._update(a)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=qt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAngleAxis())||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(p(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutRadius(){const t=this.getRefLayoutRect();if(S(this._spec.layoutRadius))return this._spec.layoutRadius;if(d(this._spec.layoutRadius))return this._spec.layoutRadius(t,this.getCenter());const{width:e,height:i}=t;return"auto"===this._spec.layoutRadius&&e>0&&i>0?ae(t,this.getCenter(),this._startAngle,this._endAngle):Math.min(e/2,i/2)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this.computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this.computeLayoutRadius()*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=RB,e=0;const i=this.getChart().getSpec();return aB(this.getRegions(),(s=>{const n=s;if(r=n.type,[cB.rose,cB.radar,cB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Bj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Bj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}JY.type=r.polarAxis,JY.specKey="axes";class QY extends JY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}QY.type=r.polarLinearAxis,QY.specKey="axes",U(QY,tW);const tK=()=>{XG(),mz.registerComponent(QY.type,QY)};class eK extends JY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}eK.type=r.polarBandAxis,eK.specKey="axes",U(eK,sW);const iK=()=>{XG(),mz.registerComponent(eK.type,eK)};class sK extends $Y{constructor(){super(...arguments),this.type=cB.rose,this.transformerConstructor=qY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(sK.mark.rose,{morph:bG(this._spec,sK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XF(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),vG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}sK.type=cB.rose,sK.mark=oF,sK.transformerConstructor=qY;const nK=()=>{mz.registerSeries(sK.type,sK),IY(),mz.registerAnimation("rose",((t,e)=>({appear:XY(t,e),enter:UY(t),exit:YY(t),disappear:KY(t)}))),iK(),tK()};class rK extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,JP(this._fromAngle,this._toAngle)&&JP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class aK extends Wc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=re(s.angle),a=re(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=re(o.angle),c=re(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new $t(m,f,v,_);return y.defined=e.defined,y}}const oK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function lK(t,e,i){return"fadeIn"===e?oK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function hK(t,e,i){return"fadeIn"===e?oK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const cK=(t,e)=>({custom:Yc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class dK extends $Y{constructor(){super(...arguments),this.type=cB.radar,this.transformerConstructor=jG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(dK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?te(this._spec.startAngle):EB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),vG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=mz.getAnimationInKey(e);t.setAnimationConfig(fG(null==i?void 0:i(n,r),vG(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}dK.type=cB.radar,dK.mark=nF,dK.transformerConstructor=jG,U(dK,BG);const uK=()=>{mz.registerSeries(dK.type,dK),aI(),bW(),OG(),FG(),mz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:lK(t,e,"in"),enter:lK(t,e,"in"),exit:lK(t,e,"out"),disappear:"clipIn"===e?void 0:lK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:aK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:hK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:hK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:rK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarGroup",((t,e)=>({appear:cK(t,"in"),disappear:cK(t,"out")}))),Jk(),iK(),tK()};class pK extends uV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>di.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const gK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},mK={fill:"#bbb",fillOpacity:.2};class fK extends CG{constructor(){super(...arguments),this.type=cB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Vz(this._option.dataSet,"objFlat",gK),Vz(this._option.dataSet,"copyDataView",qz),Gz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:tH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Bj(mK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(fK.mark.group),this._containerMark=this._createMark(fK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(fK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(fK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(fK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(fK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(fK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(fK.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new UF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:AD}}initTooltip(){this._tooltipHelper=new pK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}fK.type=cB.dot,fK.mark=uF;class vK extends uV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>di.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const _K=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class yK extends CG{constructor(){super(...arguments),this.type=cB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Vz(this._option.dataSet,"linkDotInfo",_K),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:tH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(yK.mark.group),this._containerMark=this._createMark(yK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(yK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(yK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new vK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}yK.type=cB.link,yK.mark=dF;class bK extends kY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?wD:DD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?te(n):EB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):PB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[wD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(bK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+te(s),n=te(i)/2;return Jg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Pg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const AK=()=>{mz.registerAnimation("circularProgress",((t,e)=>({appear:SK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class kK extends kG{constructor(){super(...arguments),this._supportStack=!0}}class MK extends bK{constructor(){super(...arguments),this.type=cB.circularProgress,this.transformerConstructor=kK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(MK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(MK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?wD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}MK.type=cB.circularProgress,MK.mark=cF,MK.transformerConstructor=kK;function TK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const wK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TK(t)}),CK={type:"fadeIn"};function EK(t,e){return!1===e?{}:"fadeIn"===e?CK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TK(t)}))(t)}class PK extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class BK extends CG{constructor(){super(...arguments),this.type=cB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(BK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return XF(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(BK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(BK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=XF(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Pg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=XF(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Pg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new PK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}BK.type=cB.linearProgress,BK.mark=fF;const RK=()=>{OW(),mz.registerAnimation("linearProgress",((t,e)=>({appear:EK(t,e),enter:{type:"grow"},disappear:wK(t)}))),tN(),mz.registerSeries(BK.type,BK)},LK=[0],OK=[20,40],IK=[200,500],DK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},FK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],jK=`${uB}_WORD_CLOUD_WEIGHT`,zK=`${uB}_WORD_CLOUD_TEXT`;class HK extends MG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=OK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:IK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:LK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?zK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:DK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:LK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!FK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(HK.mark.word,{key:SD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(fG(mz.getAnimationInKey("wordCloud")(n,s),vG("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new UF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new EC,o=this._fontWeightRange;if(r){const[e,i]=vb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:jK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:zK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:sb(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:SD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:SD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}HK.mark=pF;function NK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||qH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function GK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function WK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const UK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function YK(t){return d(t)?t:function(){return t}}class KK{constructor(t){var e,i,s;switch(this.options=z({},KK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,VK[s]?VK[s]():VK.circle()),this.getText=null!==(e=YK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=YK(this.options.fontWeight),this.getTextFontSize=YK(this.options.fontSize),this.getTextFontStyle=YK(this.options.fontStyle),this.getTextFontFamily=YK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>UK(10,50);break;case"random-light":this.getTextColor=()=>UK(50,90);break;default:this.getTextColor=YK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return te(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return te(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class $K extends KK{constructor(t){var e;super(z({},$K.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=$K.defaultOptions.minFontSize&&(this.options.minFontSize=$K.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=XK[this.options.spiral])&&void 0!==e?e:XK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=YK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=WK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(O_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(JK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}QK(p,this._size)&&(p=tX(p,this._size))}else if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||ZK(p,i))&&(!i||!qK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function qK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function ZK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,QK=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function tX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=WK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}iX.defaultOptions={enlarge:!1};const nX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},rX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?aX(t.fontFamily):"sans-serif",d=t.fontStyle?aX(t.fontStyle):"normal",u=t.fontWeight?aX(t.fontWeight):"normal",p=t.rotate?aX(t.rotate):0,g=aX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?aX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||nX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?aX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=lX(hX(t,l),C);w=i=>e(t(i))}let E=$K;"fast"===t.layoutType?E=iX:"grid"===t.layoutType&&(E=eX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},aX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],oX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),lX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=oX(t[0]),s=oX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(oX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},hX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function cX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{CR.registerTransform("wordcloud",{transform:rX,markPhase:"beforeJoin"},!0),dY(),mz.registerAnimation("wordCloud",((t,e)=>({appear:NK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),mz.registerSeries(dX.type,dX)};(class extends HK{constructor(){super(...arguments),this.type=cB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(HK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),vG("word",this._spec,this._markAttributeContext)))}}).type=cB.wordCloud3d;const pX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},gX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},mX=`${uB}_FUNNEL_TRANSFORM_RATIO`,fX=`${uB}_FUNNEL_REACH_RATIO`,vX=`${uB}_FUNNEL_HEIGHT_RATIO`,_X=`${uB}_FUNNEL_VALUE_RATIO`,yX=`${uB}_FUNNEL_LAST_VALUE_RATIO`,bX=`${uB}_FUNNEL_NEXT_VALUE_RATIO`,xX=`${uB}_FUNNEL_LAST_VALUE`,SX=`${uB}_FUNNEL_CURRENT_VALUE`,AX=`${uB}_FUNNEL_NEXT_VALUE`,kX=`${uB}_FUNNEL_TRANSFORM_LEVEL`,MX=20;class TX extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[fX])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class wX extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class CX extends wX{constructor(){super(...arguments),this.type=CX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}CX.type="polygon";const EX=()=>{mz.registerMark(CX.type,CX),bM(),gM(),CR.registerGraphic(IB.polygon,em),fO.useRegisters([XI,$I])};class PX extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class BX extends MG{constructor(){super(...arguments),this.type=cB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=PX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"funnel",pX),Vz(this._dataSet,"funnelTransform",gX);const t=new ya(this._dataSet,{name:`${uB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new oG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:SX,asTransformRatio:mX,asReachRatio:fX,asHeightRatio:vX,asValueRatio:_X,asNextValueRatio:bX,asLastValueRatio:yX,asLastValue:xX,asNextValue:AX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:kX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},BX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:bG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},BX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(BX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(BX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new TX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*hB(fX).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),vG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(fG(mz.getAnimationInKey("fadeInOut")(),vG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(fG(mz.getAnimationInKey("funnel")({},o),vG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(fG(null===(a=mz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),vG("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[yX])/2:this._getSecondaryAxisLength(t[_X])/2,n=this._getSecondaryAxisLength(t[_X])/2):(s=this._getSecondaryAxisLength(t[_X])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[bX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[kX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[SD]===t[SD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?MX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{EX(),dY(),HU(),mz.registerSeries(BX.type,BX),mz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},JH))),mz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Kc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Kc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),tN()};class LX extends wX{constructor(){super(...arguments),this.type=LX.type}}LX.type="pyramid3d";class OX extends PX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class IX extends BX{constructor(){super(...arguments),this.type=cB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=OX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},IX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},IX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(IX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(IX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}IX.type=cB.funnel3d,IX.mark=mF,IX.transformerConstructor=OX;const DX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},FX=t=>{const e=t.mark.elements.filter((t=>t.diffState===OB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},jX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},zX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=jX(r,s,n);return DX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=jX(r,s,n);return DX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),HX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},NX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=HX(r);return DX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=HX(r);return DX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),VX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},GX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):GX(t.children,e,i)))})),e};function WX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=KX(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,wt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},XX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=XX(t.children,e,t,n))})),s},$X=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=$X(t.children,e,t,n)),n=e(t,s,i,n)})),n},qX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:WX,slice:UX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?UX:WX)(t,e,i,s,n)}};class ZX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},ZX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?gb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?YX(this.options.aspectRatio):null!==(e=qX[this.options.splitType])&&void 0!==e?e:qX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=KX(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}ZX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const JX=(t,e)=>{const i=new ZX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return GX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},QX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class t${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];WX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QX);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},t$.defaultOpionts,t):Object.assign({},t$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+yb(this.options.center[0],t.width),s=t.y0+yb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>yb(t,n))):yb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>yb(t,n))):yb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=yb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=KX(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=se({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}t$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const e$=4294967296;function i$(t,e){let i,s;if(r$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function r$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function h$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function c$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function d$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function u$(t){return{_:t,next:null,prev:null}}function p$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];h$(n,s,r);let a,o,l,h,c,d,u,p=u$(s),g=u$(n),m=u$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=KX(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%e$)/e$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:v$.defaultOpionts.nodeSort;XX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)XX([o],g$(h)),$X([o],m$(this._getPadding,.5,a)),XX([o],f$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);XX([o],g$(v$.defaultOpionts.setRadius)),$X([o],m$(fb,1,a)),c&&$X([o],m$(this._getPadding,o.radius/t,a)),XX([o],f$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}v$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const _$=(t,e={})=>{if(!t)return[];const i=[];return GX(t,i,e),i},y$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new t$(i).layout(t,{width:s,height:n})};class b$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var x$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(x$||(x$={}));const S$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===x$.DrillDown){return Y(lz(t,n,s,"children"))}if(i.type===x$.DrillUp){const e=hz(t,n,s,"children");if(e)return Y(e)}return t};class A${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Vz(t,"drillFilter",S$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:x$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:x$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:x$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:x$.DrillUp},model:this}),r}}class k$ extends kY{constructor(){super(...arguments),this.type=cB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"sunburstLayout",y$),Vz(this._dataSet,"flatten",_$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(k$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new b$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}k$.type=cB.sunburst,k$.mark=AF,U(k$,A$);const M$=()=>{mz.registerSeries(k$.type,k$),IY(),dY(),tN(),mz.registerAnimation("sunburst",((t,e)=>({appear:VX(0,e),enter:zX(t),exit:NX(t),disappear:NX(t)})))},T$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new v$(i).layout(t,{width:s,height:n})};class w$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const C$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class E$ extends CG{constructor(){super(...arguments),this.type=cB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"circlePackingLayout",T$),Vz(this._dataSet,"flatten",_$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(E$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(E$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},nH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new w$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}E$.type=cB.circlePacking,E$.mark=TF,U(E$,A$);const P$=()=>{mz.registerSeries(E$.type,E$),IY(),dY(),QH(),mz.registerAnimation("circlePacking",((t,e)=>({appear:C$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},B$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=B$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R$(t){return t.depth}function L$(t,e){return e-1-t.endDepth}const O$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),I$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},D$={left:R$,right:L$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R$,end:L$},F$=yt(0,1);class j${constructor(t){this._ascendingSourceBreadth=(t,e)=>O$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>O$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},j$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):D$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};kb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),kb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];B$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[I$(s[t.source]),I$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*F$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(O$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(O$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new j$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},H$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&H$(t,e.children,i)}))},N$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},V$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new j$(e),r=[];return r.push(n.layout(s,i)),r},G$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},W$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class U$ extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const Y$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),K$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:Y$(t),X$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class $$ extends UH{constructor(){super(...arguments),this.type=$$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}$$.type="linkPath";const q$=()=>{CR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(IO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),CR.registerAnimationType("linkPathGrowIn",DO),CR.registerAnimationType("linkPathGrowOut",FO),CR.registerAnimationType("linkPathUpdate",jO),SO(),vO(),mz.registerMark($$.type,$$)};class Z$ extends CG{constructor(){super(...arguments),this.type=cB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Jt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(nH.STATE_SANKEY_EMPHASIS),e.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS)):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(nH.STATE_SANKEY_EMPHASIS),s.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Vz(this._dataSet,"sankeyLayout",V$),Vz(this._dataSet,"sankeyFormat",N$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:tH.sankeyLayout});const{dataSet:a}=this._option;Vz(a,"sankeyNodes",G$),Vz(a,"flatten",_$);const o=new ya(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._nodesSeriesData=new oG(this._option,o),Vz(a,"sankeyLinks",W$);const l=new ya(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._linksSeriesData=new oG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Z$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(Z$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(Z$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},nH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),vG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),vG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(fG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([nH.STATE_SANKEY_EMPHASIS_REVERSE,nH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new U$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new UF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return H$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}Z$.type=cB.sankey,Z$.mark=bF;const J$=()=>{CR.registerTransform("sankey",{transform:z$,markPhase:"beforeJoin"},!0),OW(),q$(),dY(),mz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:K$(t,e)},JH))),mz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:X$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),tN(),mz.registerSeries(Z$.type,Z$)},Q$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=_$(n);return i=nG([{latestData:r}],e),i};class tq extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const eq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class iq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class sq extends CG{constructor(){super(...arguments),this.type=cB.treemap,this.transformerConstructor=iq,this._viewBox=new Jt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new oe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:SD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[hG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Vz(this._dataSet,"hierarchyDimensionStatistics",Q$),Vz(this._dataSet,"flatten",_$);const i=new ya(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(sq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(sq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new tq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}sq.type=cB.treemap,sq.mark=yF,sq.transformerConstructor=iq,U(sq,A$),U(sq,MU);const nq=()=>{OW(),dY(),mz.registerAnimation("treemap",((t,e)=>({appear:eq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),tN(),CR.registerTransform("treemap",{transform:JX,markPhase:"beforeJoin"},!0),mz.registerSeries(sq.type,sq)},rq={type:"fadeIn"};function aq(t,e){return"fadeIn"===e?rq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class oq extends kG{constructor(){super(...arguments),this._supportStack=!1}}class lq extends bK{constructor(){super(...arguments),this.type=cB.gaugePointer,this.transformerConstructor=oq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(lq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},lq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(lq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}lq.type=cB.gaugePointer,lq.mark=SF,lq.transformerConstructor=oq;const hq=()=>{mz.registerSeries(lq.type,lq),yU(),OW(),mz.registerAnimation("gaugePointer",((t,e)=>{const i=aq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),iK(),tK()};class cq extends kG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class dq extends bK{constructor(){super(...arguments),this.type=cB.gauge,this.transformerConstructor=cq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=te(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Vz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[FD]=t[this._angleField[0]],t[DD]=e>0?i[e-1][FD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(dq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(dq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return p(t[DD])?this.angleAxisHelper.dataToPosition([t[DD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[FD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}dq.type=cB.gauge,dq.mark=xF,dq.transformerConstructor=cq;class uq extends IG{constructor(){super(...arguments),this.type=uq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}uq.type="cell";const pq=()=>{mz.registerMark(uq.type,uq),bM(),SM(),CR.registerGraphic(IB.cell,kg),CR.registerMark(IB.cell,dD)};function gq(t){return!1===t?{}:{type:"fadeIn"}}class mq extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class fq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class vq extends CG{constructor(){super(...arguments),this.type=cB.heatmap,this.transformerConstructor=fq}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(vq.mark.cell,{morph:bG(this._spec,vq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(vq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ei(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=wG(this);this._cellMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),vG("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new mq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}vq.type=cB.heatmap,vq.mark=wF,vq.transformerConstructor=fq;const _q=()=>{dY(),pq(),mz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},JH),{appear:gq(e)}))),rW(),iW(),mz.registerSeries(vq.type,vq)},yq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=te(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=te(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=yb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=yb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+yb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+yb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=gb(e.field),C=t.map(w),[E,P]=vb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:gb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?vb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=bq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),xq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},xq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[xD]:null==n?void 0:n[xD],[AD]:null==n?void 0:n[AD]}};class Aq extends UH{constructor(){super(...arguments),this.type=Aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Aq.type="ripple";const kq=()=>{mz.registerMark(Aq.type,Aq),CR.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),SO(),bO()},Mq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Tq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class wq extends kY{constructor(){super(...arguments),this.type=cB.correlation,this.transformerConstructor=Tq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Vz(this._dataSet,"correlation",yq);const s=new va;Gz(s,"dataview",ga),Vz(s,"correlationCenter",Sq);const n=new ya(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new oG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(wq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:xD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(wq.mark.ripplePoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(wq.mark.centerPoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[vD],y:t=>t[_D],size:t=>t[yD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),vG("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}wq.type=cB.correlation,wq.mark=CF,wq.transformerConstructor=Tq;const Cq=()=>{FG(),kq(),mz.registerSeries(wq.type,wq),mz.registerAnimation("correlation",((t,e)=>Object.assign({appear:Mq(0,e)},ZH)))};class Eq extends UH{constructor(){super(...arguments),this.type=Eq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Eq.type="liquid";const Pq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Bq extends uV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Rq extends MG{constructor(){super(...arguments),this.type=cB.liquid,this.transformerConstructor=jG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=kg({x:s,y:n,size:r,symbolType:Pq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=tj(this._spec.outlineMargin),this._paddingSpec=tj(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Rq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Rq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Rq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Rq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Bq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),vG("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),vG("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Rq.type=cB.liquid,Rq.mark=PF,Rq.transformerConstructor=jG;const Lq=t=>Y(t).join(",");class Oq extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Lq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Lq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Iq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Dq extends MG{constructor(){super(...arguments),this.type=cB.venn,this.transformerConstructor=Iq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:SD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(Dq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Dq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},nH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},nH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Lq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},nH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Lq(t.sets)},nH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Oq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Lq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Lq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Lq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Lq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}}Dq.type=cB.venn,Dq.mark=BF,Dq.transformerConstructor=Iq;class Fq extends mW{_isValidSeries(t){return t===cB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class jq extends pW{constructor(){super(...arguments),this.transformerConstructor=Fq,this.type="map",this.seriesType=cB.map}}jq.type="map",jq.seriesType=cB.map,jq.transformerConstructor=Fq;class zq extends mW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Hq extends zq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=IN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Bj({},s,l)),n&&Object.assign(o,Bj({},n,o))}}class Nq extends zq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Vq extends zq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class Gq extends pW{constructor(){super(...arguments),this.transformerConstructor=Vq}}Gq.transformerConstructor=Vq;class Wq extends Gq{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="pie",this.seriesType=cB.pie}}Wq.type="pie",Wq.seriesType=cB.pie,Wq.transformerConstructor=Vq;class Uq extends Vq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Yq extends Gq{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="pie3d",this.seriesType=cB.pie3d}}Yq.type="pie3d",Yq.seriesType=cB.pie3d,Yq.transformerConstructor=Uq;class Kq extends Nq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:RB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:RB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Xq extends pW{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="rose",this.seriesType=cB.rose,this._canStack=!0}}Xq.type="rose",Xq.seriesType=cB.rose,Xq.transformerConstructor=Kq;class $q extends Nq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Bj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class qq extends pW{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="radar",this.seriesType=cB.radar,this._canStack=!0}}qq.type="radar",qq.seriesType=cB.radar,qq.transformerConstructor=$q;class Zq extends mW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Bj(e,uH(this.type,t))})),this._transformAxisSpec(t)}}class Jq extends pW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="common",this._canStack=!0}}Jq.type="common",Jq.transformerConstructor=Zq;class Qq extends fW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class tZ extends pW{constructor(){super(...arguments),this.transformerConstructor=Qq,this._canStack=!0}}tZ.transformerConstructor=Qq;class eZ extends Qq{transformSpec(t){super.transformSpec(t),hH(t)}}class iZ extends tZ{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="histogram",this.seriesType=cB.bar}}iZ.type="histogram",iZ.seriesType=cB.bar,iZ.transformerConstructor=eZ;class sZ extends tZ{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="histogram3d",this.seriesType=cB.bar3d}}sZ.type="histogram3d",sZ.seriesType=cB.bar3d,sZ.transformerConstructor=eZ;class nZ extends Hq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class rZ extends pW{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="circularProgress",this.seriesType=cB.circularProgress,this._canStack=!0}}rZ.type="circularProgress",rZ.seriesType=cB.circularProgress,rZ.transformerConstructor=nZ;class aZ extends Hq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:cB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===cB.gauge||t.type===cB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===cB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class oZ extends pW{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="gauge",this.seriesType=cB.gaugePointer}}oZ.type="gauge",oZ.seriesType=cB.gaugePointer,oZ.transformerConstructor=aZ;class lZ extends mW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class hZ extends pW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}hZ.transformerConstructor=lZ;class cZ extends lZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class dZ extends hZ{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}dZ.type="wordCloud",dZ.seriesType=cB.wordCloud,dZ.transformerConstructor=cZ;class uZ extends lZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class pZ extends hZ{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="wordCloud3d",this.seriesType=cB.wordCloud3d}}pZ.type="wordCloud3d",pZ.seriesType=cB.wordCloud3d,pZ.transformerConstructor=uZ;class gZ extends mW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mZ extends pW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="funnel",this.seriesType=cB.funnel}}mZ.type="funnel",mZ.seriesType=cB.funnel,mZ.transformerConstructor=gZ;class fZ extends pW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="funnel3d",this.seriesType=cB.funnel3d}}fZ.type="funnel3d",fZ.seriesType=cB.funnel3d,fZ.transformerConstructor=gZ;class vZ extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=IN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=IN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class _Z extends pW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="linearProgress",this.seriesType=cB.linearProgress,this._canStack=!0}}_Z.type="linearProgress",_Z.seriesType=cB.linearProgress,_Z.transformerConstructor=vZ;class yZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),hH(t)}}class bZ extends pW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="rangeColumn",this.seriesType=cB.rangeColumn}}bZ.type="rangeColumn",bZ.seriesType=cB.rangeColumn,bZ.transformerConstructor=yZ;class xZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class SZ extends pW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="rangeColumn3d",this.seriesType=cB.rangeColumn3d}}SZ.type="rangeColumn3d",SZ.seriesType=cB.rangeColumn3d,SZ.transformerConstructor=xZ;class AZ extends mW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:BB,i=p(t.endAngle)?t.endAngle:e+ee(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=cB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class kZ extends pW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="sunburst",this.seriesType=cB.sunburst}}kZ.type="sunburst",kZ.seriesType=cB.sunburst,kZ.transformerConstructor=AZ;class MZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=cB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class TZ extends pW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="circlePacking",this.seriesType=cB.circlePacking}}TZ.type="circlePacking",TZ.seriesType=cB.circlePacking,TZ.transformerConstructor=MZ;class wZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CZ extends pW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="treemap",this.seriesType=cB.treemap}}CZ.type="treemap",CZ.seriesType=cB.treemap,CZ.transformerConstructor=wZ;class EZ extends HW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),hH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class PZ extends NW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="waterfall",this.seriesType=cB.waterfall}}PZ.type="waterfall",PZ.seriesType=cB.waterfall,PZ.transformerConstructor=EZ;class BZ extends fW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),hH(t)}}class RZ extends pW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="boxPlot",this.seriesType=cB.boxPlot}}RZ.type="boxPlot",RZ.seriesType=cB.boxPlot,RZ.transformerConstructor=BZ;class LZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends pW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="sankey",this.seriesType=cB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}OZ.type="sankey",OZ.seriesType=cB.sankey,OZ.transformerConstructor=LZ;class IZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),hH(t)}}class DZ extends pW{constructor(){super(...arguments),this.transformerConstructor=IZ,this.type="rangeArea",this.seriesType=cB.rangeArea}}DZ.type="rangeArea",DZ.seriesType=cB.rangeArea,DZ.transformerConstructor=IZ;class FZ extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class jZ extends pW{constructor(){super(...arguments),this.transformerConstructor=FZ,this.type="heatmap",this.seriesType=cB.heatmap}}jZ.type="heatmap",jZ.seriesType=cB.heatmap,jZ.transformerConstructor=FZ;class zZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=cB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HZ extends pW{constructor(){super(...arguments),this.transformerConstructor=zZ,this.type="correlation",this.seriesType=cB.correlation}}HZ.type="correlation",HZ.seriesType=cB.correlation,HZ.transformerConstructor=zZ;function NZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=gz(t.style)),B(t.textStyle)||Bj(s.textStyle,gz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&gz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&gz(s.background.style),s}const VZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},GZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:AD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class WZ extends GG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=qF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VH(this._option,e),this._initSelectedData(),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(aB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Bj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}WZ.specKey="legends";class UZ extends WZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Vz(this._option.dataSet,"discreteLegendFilter",GZ),Vz(this._option.dataSet,"discreteLegendDataMake",VZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return aB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=ez(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=NZ(s)),B(n.focusIconStyle)||gz(n.focusIconStyle),n.shape&&(n.shape=dz(n.shape)),n.label&&(n.label=dz(n.label)),n.value&&(n.value=dz(n.value)),n.background&&(n.background=dz(n.background)),ZF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),ZF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),ZF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||gz(r.railStyle),B(r.sliderStyle)||gz(r.sliderStyle)):(B(r.textStyle)||gz(r.textStyle),r.handler&&dz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Bj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return mP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(lP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(lP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(lP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=RN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=RN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}UZ.specKey="legends",UZ.type=r.discreteLegend;const YZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},KZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?cz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function XZ(t){return"color"===t||"size"===t}const $Z={color:bP,size:SP},qZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],ZZ=[2,10];class JZ extends WZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return XZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{XZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Vz(this._option.dataSet,"continuousLegendFilter",KZ),Vz(this._option.dataSet,"continuousLegendDataMake",YZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=ez(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=ez(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?qZ:ZZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Bj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=NZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=gz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=gz(r.style)),B(a.style)||(w.trackStyle=gz(a.style)),w.startText=dz(o),w.endText=dz(l),w.handlerText=dz(h),B(c)||(w.sizeBackground=gz(c)),d.visible&&!B(d.style)&&(Bj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return $Z[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}JZ.specKey="legends",JZ.type=r.continuousLegend;class QZ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Rz(n,a,!0))&&void 0!==e?e:[],...null!==(i=bz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Nw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=hV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=hV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(_V(s).every((t=>{var e;return!hV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=hV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=fV(t,i,s),m=vV(t,i,s),f=Bj({},I(e[t]),m),v=g.title,_=bV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=gV(f.title,Object.assign(Object.assign({},v),_)):f.title=gV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=yV(y);f.content=mV(f.content,(e=>bV(e,f,u.shape,t)))}else f.content=mV(y,(t=>bV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=wV(a,t,e),l=!!p(o)&&!1!==SV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class tJ extends QZ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class eJ extends QZ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class iJ extends QZ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const sJ=t=>p(t)&&!y(t),nJ=t=>p(t)&&y(t);class rJ extends VG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Bj({},this._theme,s.style),s.offset=Bj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=hV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}class aJ extends GG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=rJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&sJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&nJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&lN.globalConfig.uniqueTooltip&&l&&lN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?AV.canvas:AV.dom,n=mz.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new eJ(this),dimension:new tJ(this),group:new iJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(nb(i)||rb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=oV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(nJ(t)){if(sJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>fz(t,e[i])))))return!1}else{if(nJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&si(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}aJ.type=r.tooltip,aJ.transformerConstructor=rJ,aJ.specKey="tooltip";var oJ,lJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(oJ||(oJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(lJ||(lJ={}));const hJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class cJ extends GG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{hJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){xz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Sz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=lB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=WN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=KN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=XN(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}dJ.specKey="crosshair",dJ.type=r.cartesianCrosshair;class uJ extends cJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:qt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=lB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Bj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=ON(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=ON(s.getSpec())),c.angle=a.angle,c.axis=s,Bj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=RN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=RN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:se(o,s,i),end:se(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},se(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ne(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=se(t,r,p),f=se(t,r,g),v=Re([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(qt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},se(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}uJ.specKey="crosshair",uJ.type=r.polarCrosshair;const pJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},gJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class mJ extends GG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Lt(s/n)>=.5:Lt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=kz(t),this._isHorizontal="horizontal"===Mz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(zw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};aB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=zw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else aB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Gz(s,"dataview",ga),Vz(s,"dataFilterComputeDomain",gJ);const n=new ya(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(zw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&zw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,zw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new lC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Vz(this._option.dataSet,"dataFilterWithNewDomain",pJ),aB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>zw(this._stateScale.type)},level:tH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Nw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Nw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(mJ,MU);class fJ extends VG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Bj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class vJ extends mJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=fJ,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new EC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!zw(t.type)||e[0]!==e[1])&&(!Nw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new lE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:gz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:gz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:gz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:gz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:gz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:gz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:gz(g.style)},selectedBackgroundStyle:gz(this._spec.selectedBackground.style),dragMaskStyle:gz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Bj(gz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Bj(gz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=RN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}vJ.type=r.dataZoom,vJ.transformerConstructor=fJ,vJ.specKey="dataZoom";class _J extends mJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=JP(this._start,e)&&JP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=gz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=gz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}_J.type=r.scrollBar,_J.specKey="scrollBar";const yJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class bJ extends GG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==bJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Vz(this._option.dataSet,"indicatorFilter",yJ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Bj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},pz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?ij(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ij(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},pz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new MP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}bJ.type=r.indicator,bJ.specKey="indicator";const xJ=["sum","average","min","max","variance","standardDeviation","median"];function SJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function AJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&SJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=ZF(t.x)?wJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function kJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&SJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=ZF(t.y)?wJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function MJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&SJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function TJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&SJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function wJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function CJ(t){return xJ.includes(t)}function EJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=AJ(t,m,n,d,h,a),i=kJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=AJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=kJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function PJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=MJ(t,l,n,r),i=TJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=MJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=TJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function BJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=ZF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=ZF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&SJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&SJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function RJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&SJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&SJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function LJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=wJ(e,r)),e+=s,ZF(i)&&(i=wJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=wJ(e,s)),ZF(i)&&(i=wJ(i,n)),{x:e,y:i}}))}function OJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function IJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},gz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},FJ(gz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=FJ(gz(n),i)),t}return{visible:!1}}function DJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function FJ(t,e){return d(t)?t(e):t}function jJ(t,e){return d(t)?t(e):t}function zJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function HJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function NJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function VJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function GJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>UJ(i,t,e))):s.x=UJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>UJ(i,t,e))):s.y=UJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>UJ(i,t,e))):s.angle=UJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>UJ(i,t,e))):s.radius=UJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=UJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const WJ={min:(t,e)=>QP(t[0].latestData,e.field),max:(t,e)=>tB(t[0].latestData,e.field),sum:function(t,e){return eB(t[0].latestData,e.field)},average:function(t,e){return iB(t[0].latestData,e.field)},variance:function(t,e){return sB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(sB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function UJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return WJ[i](e,{field:s})}return t}class YJ extends GG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&CJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&CJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&CJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&CJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&CJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new va;return e.registerParser("array",s),new ya(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=lB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=JF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=JF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function KJ(t,e){return function(t,e,i){const{predict:s}=Sb(t,(t=>t[e]),(t=>t[i])),n=QP(t,e),r=tB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function XJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class $J extends YJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=HJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:FJ(gz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:IJ(y,this._markerData),state:{line:DJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:DJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:DJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:DJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:DJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:gz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:gz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=HJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerRegression",KJ),Vz(this._option.dataSet,"markerFilter",XJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ya(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}$J.specKey="markLine";class qJ extends $J{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=HJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=EJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=BJ(i,r,d,e.coordinatesOffset):c&&(y=LJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(ZF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=HJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}qJ.type=r.markLine,qJ.coordinateType="cartesian";class ZJ extends $J{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=HJ(this._spec);return e||i?new ZE(t):new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=HJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=PJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>se(m,t.radius,t.angle)))}}else u&&(p=RJ(i,r,a),g={points:p.map((t=>se(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=HJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}ZJ.type=r.polarMarkLine,ZJ.coordinateType="polar";class JJ extends GG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=qF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new AP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}JJ.type=r.title,JJ.specKey=r.title;class QJ extends YJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=NJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:FJ(gz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:IJ(u,this._markerData),state:{area:DJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:DJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:DJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=NJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerFilter",XJ);const c=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}QJ.specKey="markArea";class tQ extends QJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=NJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=EJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=EJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=BJ(i,r,d,e.coordinatesOffset):c&&(u=LJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=NJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}tQ.type=r.markArea,tQ.coordinateType="cartesian";class eQ extends QJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=NJ(this._spec);return i||e||s?new JE(t):new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=NJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=PJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=RJ(i,r,c),u={points:d.map((t=>se(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=NJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}eQ.type=r.polarMarkArea,eQ.coordinateType="polar";const iQ=t=>gz(Object.assign({},t)),sQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},gz(t.style))}),nQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=iQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=iQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},gz(Object.assign({},y)));var y;const b=sQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=sQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=sQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=sQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},rQ=t=>"left"===t||"right"===t,aQ=t=>"top"===t||"bottom"===t;class oQ extends GG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},nQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},nQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new zP(t):this._playerComponent=new VP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=rQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=rQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=rQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=aQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):rQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):aQ(this._orient)?this._maxSize():t.height}_computeDx(t){return rQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return aQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}oQ.specKey="player",oQ.type=r.player;class lQ extends GG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}lQ.type=r.label;class hQ extends cY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}hQ.type="text",hQ.constructorType="label";const cQ=()=>{mz.registerMark(hQ.constructorType,hQ),xO()};class dQ extends VG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class uQ extends lQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=dQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),aB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Bj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=UU[t])&&void 0!==i?i:UU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:YU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}uQ.type=r.label,uQ.specKey="label",uQ.transformerConstructor=dQ;class pQ extends lQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[LD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Bj({textStyle:{pickable:!0===this._spec.interactive},position:gQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[ID]))},a))}})).encode((e=>YU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function gQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}pQ.type=r.totalLabel,pQ.specKey="totalLabel";class mQ extends YJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=VJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:jJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:jJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:FJ(B.style,this._markerData)},state:{line:DJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:DJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:DJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:DJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:DJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:DJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:DJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:DJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:DJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:DJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=gz(FJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=FJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=IJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=FJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:gz(z.style)}):{visible:!1};return new tP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:zJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:zJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=VJ(t);if(!(p(t.coordinate)||e||i||s))return;Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerFilter",XJ);const{options:n}=this._computeOptions(),r=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}mQ.specKey="markPoint";class fQ extends mQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=EJ(i,s,s,s,o)[0][0]:r?l=BJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=LJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=VJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}fQ.type=r.markPoint,fQ.coordinateType="cartesian";class vQ extends mQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=PJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:se({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}vQ.type=r.polarMarkPoint,vQ.coordinateType="polar";class _Q extends mQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}_Q.type=r.geoMarkPoint,_Q.coordinateType="geo";const yQ="inBrush",bQ="outOfBrush";class xQ extends GG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),yQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),bQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new YP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:gz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(HP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,bQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(HP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(HP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},gz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(yQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(yQ),i.addState(bQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(yQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(yQ),i.addState(bQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ze(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ze(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(yQ),i.removeState(bQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}xQ.type=r.brush,xQ.specKey="brush";class SQ extends GG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${uB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Jt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Jt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}SQ.type=r.customMark,SQ.specKey="customMark";function AQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function kQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function MQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:kQ(t.rect),anchorCandidates:BQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>AQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tAQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function TQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Ue(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=EQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ci(r,s,i);if(!EQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],wQ(CQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=wQ(CQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=PQ(t.rect,a,0),t}));return MQ(h)}function wQ(t){return t>180?t-360:t}function CQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function EQ(t,e){for(let i=0;i{const{x:r,y:a}=PQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class RQ extends GG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ya(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:tH.copyDataView},!1),this._data=new VH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new tP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=tj(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Cu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Pg(gz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=kg(gz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=yp(gz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=yp(gz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=PQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:gz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):MQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}RQ.type=r.mapLabel,RQ.specKey="mapLabel";class LQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>OQ(t))),a=n.filter((t=>!OQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>OQ(t))),h=o.filter((t=>!OQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function OQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}LQ.type="grid";lN.useRegisters([()=>{rI(),aI(),OG(),FG(),iN(),QH(),rW(),iW(),mz.registerSeries(hW.type,hW),mz.registerChart(_W.type,_W)},()=>{rI(),aI(),OG(),bW(),FG(),SW(),rW(),iW(),mz.registerSeries(kW.type,kW),mz.registerChart(TW.type,TW)},()=>{zW(),mz.registerChart(NW.type,NW)},()=>{tU(),mz.registerChart(iU.type,iU)},()=>{zY(),mz.registerChart(Wq.type,Wq)},()=>{nK(),mz.registerChart(Xq.type,Xq)},()=>{uK(),mz.registerChart(qq.type,qq)},()=>{zW(),mz.registerChart(iZ.type,iZ)},()=>{BU(),mz.registerChart(jq.type,jq)},()=>{hq(),mz.registerSeries(dq.type,dq),IY(),AK(),tK(),mz.registerChart(oZ.type,oZ)},()=>{uX(),mz.registerChart(dZ.type,dZ)},()=>{RX(),mz.registerChart(mZ.type,mZ)},()=>{iY(),mz.registerChart(PZ.type,PZ)},()=>{lY(),FG(),QH(),rW(),iW(),mz.registerSeries(hY.type,hY),mz.registerChart(RZ.type,RZ)},()=>{mz.registerSeries(MK.type,MK),IY(),AK(),tN(),iK(),tK(),mz.registerChart(rZ.type,rZ)},()=>{RK(),mz.registerChart(_Z.type,_Z)},()=>{bY(),mz.registerChart(bZ.type,bZ)},()=>{bW(),rW(),iW(),mz.registerSeries(AY.type,AY),mz.registerChart(DZ.type,DZ)},()=>{M$(),mz.registerChart(kZ.type,kZ)},()=>{P$(),mz.registerChart(TZ.type,TZ)},()=>{nq(),mz.registerChart(CZ.type,CZ)},()=>{J$(),mz.registerChart(OZ.type,OZ)},()=>{_q(),mz.registerChart(jZ.type,jZ)},()=>{Cq(),mz.registerChart(HZ.type,HZ)},()=>{mz.registerChart(Jq.type,Jq)},iW,rW,()=>{XG(),mz.registerComponent(aW.type,aW)},()=>{XG(),mz.registerComponent(oW.type,oW)},()=>{XG(),mz.registerComponent(lW.type,lW)},iK,tK,()=>{mz.registerComponent(UZ.type,UZ)},()=>{mz.registerComponent(JZ.type,JZ)},()=>{mz.registerComponent(aJ.type,aJ)},()=>{mz.registerComponent(dJ.type,dJ)},()=>{mz.registerComponent(uJ.type,uJ)},()=>{mz.registerComponent(vJ.type,vJ)},()=>{mz.registerComponent(_J.type,_J)},()=>{mz.registerComponent(bJ.type,bJ)},CU,()=>{mz.registerComponent(qJ.type,qJ),KE()},()=>{mz.registerComponent(tQ.type,tQ),$E()},()=>{mz.registerComponent(fQ.type,fQ),QE()},()=>{mz.registerComponent(ZJ.type,ZJ),ZE._animate=EE,KE()},()=>{mz.registerComponent(eQ.type,eQ),JE._animate=BE,$E()},()=>{mz.registerComponent(vQ.type,vQ),QE()},()=>{mz.registerComponent(_Q.type,_Q),QE()},()=>{mz.registerComponent(JJ.type,JJ)},()=>{mz.registerComponent(oQ.type,oQ)},()=>{GO(),cQ(),UG(),mz.registerComponent(uQ.type,uQ,!0)},()=>{GO(),cQ(),UG(),mz.registerComponent(pQ.type,pQ,!0)},()=>{mz.registerComponent(xQ.type,xQ)},()=>{mz.registerComponent(SQ.type,SQ)},()=>{mz.registerComponent(RQ.type,RQ)},()=>{th.load(pT)},()=>{mz.registerLayout(LQ.type,LQ)},eG,_N,$R,XR]),lN.useRegisters([()=>{gA(th)}]),t.ARC_END_ANGLE=kB,t.ARC_K=MB,t.ARC_MIDDLE_ANGLE=TB,t.ARC_QUADRANT=wB,t.ARC_RADIAN=CB,t.ARC_RATIO=SB,t.ARC_START_ANGLE=AB,t.ARC_TRANSFORM_VALUE=xB,t.AxisSyncPlugin=TN,t.BASE_EVENTS=uD,t.CORRELATION_SIZE=yD,t.CORRELATION_X=vD,t.CORRELATION_Y=_D,t.CanvasTooltipHandler=tG,t.DEFAULT_CHART_HEIGHT=gB,t.DEFAULT_CHART_WIDTH=pB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=GD,t.DEFAULT_DATA_INDEX=xD,t.DEFAULT_DATA_KEY=SD,t.DEFAULT_DATA_SERIES_FIELD=AD,t.DEFAULT_GRADIENT_CONFIG=WD,t.DEFAULT_LABEL_ALIGN=fB,t.DEFAULT_LABEL_LIMIT=mB,t.DEFAULT_LABEL_TEXT=vB,t.DEFAULT_LABEL_VISIBLE=_B,t.DEFAULT_LABEL_X=yB,t.DEFAULT_LABEL_Y=bB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=ND,t.DEFAULT_MEASURE_CANVAS_ID=bD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=VD,t.DEFAULT_SERIES_STYLE_NAME=kD,t.DomTooltipHandler=QV,t.Factory=mz,t.FormatterPlugin=vN,t.GradientType=HD,t.MediaQuery=pN,t.POLAR_DEFAULT_RADIUS=RB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=PB,t.POLAR_START_ANGLE=BB,t.POLAR_START_RADIAN=EB,t.PREFIX=uB,t.SEGMENT_FIELD_END=FD,t.SEGMENT_FIELD_START=DD,t.STACK_FIELD_END=CD,t.STACK_FIELD_END_OffsetSilhouette=RD,t.STACK_FIELD_END_PERCENT=PD,t.STACK_FIELD_KEY=TD,t.STACK_FIELD_START=wD,t.STACK_FIELD_START_OffsetSilhouette=BD,t.STACK_FIELD_START_PERCENT=ED,t.STACK_FIELD_TOTAL=LD,t.STACK_FIELD_TOTAL_PERCENT=OD,t.STACK_FIELD_TOTAL_TOP=ID,t.ThemeManager=$j,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=lN,t.WaterfallDefaultSeriesField=fD,t.builtinThemes=jj,t.computeActualDataScheme=jF,t.darkTheme=kj,t.dataScheme=sj,t.default=lN,t.defaultThemeName=zj,t.getActualColor=HF,t.getColorSchemeBySeries=WF,t.getDataScheme=FF,t.getMergedTheme=Kj,t.getTheme=Wj,t.hasThemeMerged=Vj,t.isColorKey=NF,t.isProgressiveDataColorScheme=VF,t.isTokenKey=xj,t.lightTheme=Aj,t.queryColorFromColorScheme=zF,t.queryToken=bj,t.registerCanvasTooltipHandler=eG,t.registerChartPlugin=uN,t.registerDomTooltipHandler=()=>{JV(QV)},t.registerFormatPlugin=_N,t.registerMediaQuery=()=>{uN(pN)},t.registerTheme=Gj,t.removeTheme=Uj,t.themeExist=Yj,t.themes=Hj,t.token=Sj,t.transformColorSchemeToStandardStruct=GF,t.version="1.11.11",t.vglobal=O_,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(Mt.source,"g");function wt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Lt=Math.abs,Ot=Math.atan2,It=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Vt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Yt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Kt(t,e){return Ut(t+e,10**Math.max(Yt(t),Yt(e)))}function Xt(t,e){return Ut(t-e,10**Math.max(Yt(t),Yt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class qt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Zt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Jt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Jt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Qt extends Jt{}function te(t){return t*(Math.PI/180)}function ee(t){return 180*t/Math.PI}const ie=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function se(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ne(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function re(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ae(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=re(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new oe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new oe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new oe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ee(r.rotateDeg),r}}class le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function he(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ce(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const de=/^#([0-9a-f]{3,8})$/,ue={transparent:4294967040},pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return S(t)?new ye(t>>16,t>>8&255,255&t,1):y(t)?new ye(t[0],t[1],t[2]):new ye(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ve(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class _e{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof _e?t:new _e(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(ue[t]))return function(t){return S(t)?new ye(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ye(t[0],t[1],t[2],t[3]):new ye(255,255,255,1)}(ue[t]);if(p(pe[t]))return me(pe[t]);const e=`${t}`.trim().toLowerCase(),i=de.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ye((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=he(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ye(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=_e.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ye(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=ce(this.color.r,this.color.g,this.color.b),r=he(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ye(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=de.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new ye((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?me(s):8===n?new ye(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=pe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _e(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ve(t.color.r),this.color.g=ve(t.color.g),this.color.b=ve(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ye{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${ge(this.r)+ge(this.g)+ge(this.b)+(1===this.opacity?"":ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ye(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ce});function Se(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ae,ke,Me,Te,we,Ce,Ee,Pe;function Be(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Le(t,e,i){return null===t?e:null===e?t:(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,i&&(Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>=Ce||ke<=we||Me>=Pe||Te<=Ee?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ae,we),y1:Math.max(Me,Ee),x2:Math.min(ke,Ce),y2:Math.min(Te,Pe)})}var Oe;function Ie(t,e,i){return!(t&&e&&(i?(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee]),Ae>Ce||kePe||Tee.x2||t.x2e.y2||t.y2ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),t.x>=Ae&&t.x<=ke&&t.y>=Me&&t.y<=Te):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Fe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function je(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function ze(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function He(t,e){const i=e?t.angle:te(t.angle),s=ze(t);return[je({x:t.x1,y:t.y1},i,s),je({x:t.x2,y:t.y1},i,s),je({x:t.x2,y:t.y2},i,s),je({x:t.x1,y:t.y2},i,s)]}let Ne,Ve,Ge,We;function Ue(t){return Ne=1/0,Ve=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ne>t.x&&(Ne=t.x),Get.y&&(Ve=t.y),Wee&&r>s||rn?o:0}function qe(t,e){return Math.abs(t-e)0&&Ke(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Je=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";const ti=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ei(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ii(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function si(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const ni=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ri=6371008.8,ai={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ri,kilometers:6371.0088,kilometres:6371.0088,meters:ri,metres:ri,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ri/1852,radians:1,yards:6967335.223679999};function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function hi(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===De(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ci(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=te(t[0]),r=te(t[1]),a=te(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ai[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:ee(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:ee(l)}}class di{static getInstance(){return di.instance||(di.instance=new di),di.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let pi;function gi(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class mi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vi(t){let e;if(e=fi.exec(t))return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const _i=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class yi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}newFormat(t){const e=vi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):bi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=bi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?_i[8+pi/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=vi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=ui(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=_i[8+n/3];return function(t){return s(r*t)+a}}}const bi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gi(100*t,e),r:gi,s:function(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(pi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+ui(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function xi(){return new Si}function Si(){this.reset()}Si.prototype={constructor:Si,reset:function(){this.s=this.t=0},add:function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},valueOf:function(){return this.s}};var Ai=new Si;function ki(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Mi=1e-6,Ti=Math.PI,wi=Ti/2,Ci=Ti/4,Ei=2*Ti,Pi=180/Ti,Bi=Ti/180,Ri=Math.abs,Li=Math.atan,Oi=Math.atan2,Ii=Math.cos,Di=Math.exp,Fi=Math.log,ji=Math.pow,zi=Math.sin,Hi=Math.sign||function(t){return t>0?1:t<0?-1:0},Ni=Math.sqrt,Vi=Math.tan;function Gi(t){return t>1?0:t<-1?Ti:Math.acos(t)}function Wi(t){return t>1?wi:t<-1?-wi:Math.asin(t)}function Ui(){}function Yi(t,e){t&&Xi.hasOwnProperty(t.type)&&Xi[t.type](t,e)}var Ki={Feature:function(t,e){Yi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sTi?t+Math.round(-t/Ei)*Ei:t,e]}function os(t,e,i){return(t%=Ei)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Ti?e-Ei:e<-Ti?e+Ei:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Ii(t),s=zi(t),n=Ii(e),r=zi(e);function a(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*i+o*s;return[Oi(l*n-c*r,o*i-h*s),Wi(c*n+l*r)]}return a.invert=function(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*n-l*r;return[Oi(l*n+h*r,o*i+c*s),Wi(c*i-o*s)]},a}function ds(t,e){(e=Qi(e))[0]-=t,ns(e);var i=Gi(-e[1]);return((-e[2]<0?-i:i)+Ei-Mi)%Ei}function us(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ui,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return Ri(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function fs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ss(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function As(t,e,i,s){return function(n){var r,a,o,l=e(n),h=us(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=Ss(a);var t=function(t,e){var i=bs(e),s=e[1],n=zi(s),r=[zi(i),-Ii(i),0],a=0,o=0;ys.reset(),1===n?s=wi+Mi:-1===n&&(s=-wi-Mi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Ti,w=m*x;if(ys.add(Oi(w*k*zi(M),f*S+w*Ii(M))),a+=T?A+k*Ei:A,T^p>=i^y>=i){var C=es(Qi(u),Qi(_));ns(C);var E=es(r,C);ns(E);var P=(T^A>=0?-1:1)*Wi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Mi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ks))}return u}}function ks(t){return t.length>1}function Ms(t,e){return((t=t.x)[0]<0?t[1]-wi-Mi:wi-t[1])-((e=e.x)[0]<0?e[1]-wi-Mi:wi-e[1])}1===(vs=xs).length&&(_s=vs,vs=function(t,e){return xs(_s(t),e)});var Ts=As((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ti:-Ti,l=Ri(r-i);Ri(l-Ti)0?wi:-wi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ti&&(Ri(i-n)Mi?Li((zi(e)*(r=Ii(s))*zi(i)-zi(s)*(n=Ii(e))*zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*wi,s.point(-Ti,n),s.point(0,n),s.point(Ti,n),s.point(Ti,0),s.point(Ti,-n),s.point(0,-n),s.point(-Ti,-n),s.point(-Ti,0),s.point(-Ti,n);else if(Ri(t[0]-e[0])>Mi){var r=t[0]0,n=Ri(e)>Mi;function r(t,i){return Ii(t)*Ii(i)>e}function a(t,i,s){var n=[1,0,0],r=es(Qi(t),Qi(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=es(n,r),u=ss(n,h);is(u,ss(r,c));var p=d,g=ts(u,p),m=ts(p,p),f=g*g-m*(ts(u,u)-1);if(!(f<0)){var v=Ni(f),_=ss(p,(-g-v)/m);if(is(_,u),_=Ji(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ri(_[0]-b)Ti^(b<=_[0]&&_[0]<=x)){var T=ss(p,(-g+v)/m);return is(T,u),[_,Ji(T)]}}}function o(e,i){var n=s?t:Ti-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return As(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Ti:-Ti),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ps(e,p)||ps(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Ii(e),o=zi(e),l=s*i;null==n?(n=e+s*Ei,r=e-l/2):(n=ds(a,n),r=ds(a,r),(s>0?nr)&&(n+=s*Ei));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ri(s[0]-t)0?0:3:Ri(s[0]-i)0?2:1:Ri(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=us(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Ss(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ms(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Es,Math.min(Cs,g)),m=Math.max(Es,Math.min(Cs,m))],b=[r=Math.max(Es,Math.min(Cs,r)),a=Math.max(Es,Math.min(Cs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Bs(t){return t}var Rs,Ls,Os,Is,Ds=xi(),Fs=xi(),js={point:Ui,lineStart:Ui,lineEnd:Ui,polygonStart:function(){js.lineStart=zs,js.lineEnd=Vs},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=Ui,Ds.add(Ri(Fs)),Fs.reset()},result:function(){var t=Ds/2;return Ds.reset(),t}};function zs(){js.point=Hs}function Hs(t,e){js.point=Ns,Rs=Os=t,Ls=Is=e}function Ns(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Vs(){Ns(Rs,Ls)}var Gs=js,Ws=1/0,Us=Ws,Ys=-Ws,Ks=Ys;var Xs,$s,qs,Zs,Js={point:function(t,e){tYs&&(Ys=t);eKs&&(Ks=e)},lineStart:Ui,lineEnd:Ui,polygonStart:Ui,polygonEnd:Ui,result:function(){var t=[[Ws,Us],[Ys,Ks]];return Ys=Ks=-(Us=Ws=1/0),t}},Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln=0,hn={point:cn,lineStart:dn,lineEnd:gn,polygonStart:function(){hn.lineStart=mn,hn.lineEnd=fn},polygonEnd:function(){hn.point=cn,hn.lineStart=dn,hn.lineEnd=gn},result:function(){var t=ln?[an/ln,on/ln]:rn?[sn/rn,nn/rn]:en?[Qs/en,tn/en]:[NaN,NaN];return Qs=tn=en=sn=nn=rn=an=on=ln=0,t}};function cn(t,e){Qs+=t,tn+=e,++en}function dn(){hn.point=un}function un(t,e){hn.point=pn,cn(qs=t,Zs=e)}function pn(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,cn(qs=t,Zs=e)}function gn(){hn.point=cn}function mn(){hn.point=vn}function fn(){_n(Xs,$s)}function vn(t,e){hn.point=_n,cn(Xs=qs=t,$s=Zs=e)}function _n(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,an+=(n=Zs*t-qs*e)*(qs+t),on+=n*(Zs+e),ln+=3*n,cn(qs=t,Zs=e)}var yn=hn;function bn(t){this._context=t}bn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ei)}},result:Ui};var xn,Sn,An,kn,Mn,Tn=xi(),wn={point:Ui,lineStart:function(){wn.point=Cn},lineEnd:function(){xn&&En(Sn,An),wn.point=Ui},polygonStart:function(){xn=!0},polygonEnd:function(){xn=null},result:function(){var t=+Tn;return Tn.reset(),t}};function Cn(t,e){wn.point=En,Sn=kn=t,An=Mn=e}function En(t,e){kn-=t,Mn-=e,Tn.add(Ni(kn*kn+Mn*Mn)),kn=t,Mn=e}var Pn=wn;function Bn(){this._string=[]}function Rn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ln(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Zi(t,i(s))),s.result()}return r.area=function(t){return Zi(t,i(Gs)),Gs.result()},r.measure=function(t){return Zi(t,i(Pn)),Pn.result()},r.bounds=function(t){return Zi(t,i(Js)),Js.result()},r.centroid=function(t){return Zi(t,i(yn)),yn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Bs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Bn):new bn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function On(t){return function(e){var i=new In;for(var s in t)i[s]=t[s];return i.stream=e,i}}function In(){}function Dn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Zi(i,t.stream(Js)),e(Js.result()),null!=s&&t.clipExtent(s),t}function Fn(t,e,i){return Dn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function jn(t,e,i){return Fn(t,[[0,0],e],i)}function zn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Hn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Bn.prototype={_radius:4.5,_circle:Rn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Rn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},In.prototype={constructor:In,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Nn=16,Vn=Ii(30*Bi);function Gn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Ni(b*b+x*x+S*S),k=Wi(S/=A),M=Ri(Ri(S)-1)e||Ri((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Bi:0,E()):[f*Pi,v*Pi,_*Pi]},w.angle=function(t){return arguments.length?(y=t%360*Bi,E()):y*Pi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Gn(o,T=t*t),P()):Ni(T)},w.fitExtent=function(t,e){return Fn(w,t,e)},w.fitSize=function(t,e){return jn(w,t,e)},w.fitWidth=function(t,e){return zn(w,t,e)},w.fitHeight=function(t,e){return Hn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function $n(t){var e=0,i=Ti/3,s=Xn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Bi,i=t[1]*Bi):[e*Pi,i*Pi]},n}function qn(t,e){var i=zi(t),s=(i+zi(e))/2;if(Ri(s)2?t[2]*Bi:0),e.invert=function(e){return(e=t.invert(e[0]*Bi,e[1]*Bi))[0]*=Pi,e[1]*=Pi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===sr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function rr(t){return Vi((wi+t)/2)}function ar(t,e){var i=Ii(t),s=t===e?zi(t):Fi(i/Ii(e))/Fi(rr(e)/rr(t)),n=i*ji(rr(t),s)/s;if(!s)return sr;function r(t,e){n>0?e<-wi+Mi&&(e=-wi+Mi):e>wi-Mi&&(e=wi-Mi);var i=n/ji(rr(e),s);return[i*zi(s*t),n-i*Ii(s*t)]}return r.invert=function(t,e){var i=n-e,r=Hi(s)*Ni(t*t+i*i),a=Oi(t,Ri(i))*Hi(i);return i*s<0&&(a-=Ti*Hi(t)*Hi(i)),[a/s,2*Li(ji(n/r,1/s))-wi]},r}function or(t,e){return[t,e]}function lr(t,e){var i=Ii(t),s=t===e?zi(t):(i-Ii(e))/(e-t),n=i/s+t;if(Ri(s)Mi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},vr.invert=tr(Wi),_r.invert=tr((function(t){return 2*Li(t)})),yr.invert=function(t,e){return[-e,2*Li(Di(t))-wi]};var Sr={exports:{}},Ar=function(t,e){this.p1=t,this.p2=e};Ar.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ar.prototype.run=function(){return this.p2[0]-this.p1[0]},Ar.prototype.slope=function(){return this.rise()/this.run()},Ar.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ar.prototype.isVertical=function(){return!isFinite(this.slope())},Ar.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ar.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ar.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ar.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ar.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var kr=Ar,Mr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new kr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Mr(t.slice(0,s),e),o=Mr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Tr=Mr;!function(t){var e=Tr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Cr(Br,e),{tolerance:s}=i;return wr(t,s)};var Lr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Lr||(Lr={}));const Or=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+zr(e,6):zr(e,4))+"-"+zr(t.getUTCMonth()+1,2)+"-"+zr(t.getUTCDate(),2)+(r?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"."+zr(r,3)+"Z":n?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"Z":s||i?"T"+zr(i,2)+":"+zr(s,2)+"Z":"")}function Nr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Dr;if(h)return h=!1,Ir;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.DSV;const i=Cr(Wr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Nr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Vr(t)},Kr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Gr(t)};function Xr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return $r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return $r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zr(t);default:throw new Error("unknown GeoJSON type")}}function $r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qr(t.properties),e.geometry=Zr(t.geometry),e}function qr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=qr(s):e[i]=s})),e):e}function Zr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Zr(t)})),e):(e.coordinates=Jr(t.coordinates),e)}function Jr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Jr(t)}))}function Qr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ta(t){for(var e,i,s=Qr(t),n=0,r=1;r0}function ea(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Xr(t));var r=[];switch(t.type){case"GeometryCollection":return ia(t,(function(t){na(t,s)})),t;case"FeatureCollection":return ea(t,(function(t){ea(na(t,s),(function(t){r.push(t)}))})),li(r)}return na(t,s)}function na(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ia(t,(function(t){na(t,e)})),t;case"LineString":return ra(Qr(t),e),t;case"Polygon":return aa(Qr(t),e),t;case"MultiLineString":return Qr(t).forEach((function(t){ra(t,e)})),t;case"MultiPolygon":return Qr(t).forEach((function(t){aa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ra(t,e){ta(t)===e&&t.reverse()}function aa(t,e){ta(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=oa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},da=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.GEO;const i=Cr(ha,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ca(t))})):e.push(ca(t))})),e})(t);let o=t.features;return a&&(o=sa(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=la.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=la.bounds(t);t.bbox=e}})),t.features=o,t},ua={},pa=(t,e,i)=>{i.type=Lr.GEO;const s=Cr(ha,ua,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return xr(a,t)}))}:xr(a,o));var a,o;return da(r,s,i)},ga=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ma=0;function fa(){return ma>1e8&&(ma=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ma++}class va{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:fa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const _a="_data-view-diff-rank";class ya{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:fa("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[_a]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[_a]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[_a]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Or),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ba{static GenAutoIncrementId(){return ba.auto_increment_id++}}ba.auto_increment_id=0;class xa{constructor(t){this.id=ba.GenAutoIncrementId(),this.registry=t}}const Sa="named",Aa="inject",ka="multi_inject",Ma="inversify:tagged",Ta="inversify:paramtypes";class wa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Sa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ca=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ea(e,0,s,t)}}function Ba(t){return e=>(i,s,n)=>Pa(new wa(t,e))(i,s,n)}const Ra=Ba(Aa),La=Ba(ka);function Oa(){return function(t){return Ca.defineMetadata(Ta,null,t),t}}function Ia(t){return Pa(new wa(Sa,t))}const Da="Singleton",Fa="Transient",ja="ConstantValue",za="DynamicValue",Ha="Factory",Na="Function",Va="Instance",Ga="Invalid";class Wa{constructor(t,e){this.id=ba.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ga,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wa(this.serviceIdentifier,this.scope);return t.activated=t.scope===Da&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ua{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ca.getMetadata(Ta,t),userGeneratedMetadata:Ca.getMetadata(Ma,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ya=(Ka=Sa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ka&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const qa=Symbol("ContributionProvider");class Za{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ja(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).inSingletonScope().whenTargetNamed(e)}class Qa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class to extends Qa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const eo=Symbol.for("EnvContribution"),io=Symbol.for("VGlobal");var so=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},no=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ro=function(t,e){return function(i,s){e(i,s,t)}};let ao=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ba.GenAutoIncrementId(),this.hooks={onSetEnv:new to(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ao=so([Oa(),ro(0,Ra(qa)),ro(0,Ia(eo)),no("design:paramtypes",[Object])],ao);const oo=Bt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,mo,fo,vo,_o,yo;var bo,xo,So,Ao,ko,Mo,To,wo,Co;function Eo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Po(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=te(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Lo(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Go extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Wo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Uo(t,e,i){const s=null!=e?e:Lt(i[i.length-1].x-i[0].x)>Lt(i[i.length-1].y-i[0].y)?To.ROW:To.COLUMN;return"monotoneY"===t?new Go(t,s):new Vo(t,s)}class Yo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ko(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new Yo(n,s),t),n}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("basis",i,t);return function(t,e){Wo(t,e)}(new $o(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneX",i,t);return function(t,e){Wo(t,e)}(new el(n,s),t),n}function nl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneY",i,t);return function(t,e){Wo(t,e)}(new il(n,s),t),n}let rl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function al(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Lt(t[t.length-1].x-t[0].x)>Lt(t[t.length-1].y-t[0].y)?To.ROW:To.COLUMN);return function(t,e){Wo(t,e)}(new rl(r,e,n),t),r}class ol extends Yo{lineEnd(){this.context.closePath()}}function ll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new ol(n,s),t),n}function hl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function cl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Ko(i,n);const o=Uo(t,r,i);return Wo(new e(o,s,a),i),o}}const dl=cl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ul=cl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function pl(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}class gl extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[];Bo(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Lo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===To.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.y-e.p1.y)}if(this.direction===To.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const ml=["l",0,0,0,0,0,0,0];function fl(t,e,i){const s=ml[0]=t[0];if("a"===s||"A"===s)ml[1]=e*t[1],ml[2]=i*t[2],ml[3]=t[3],ml[4]=t[4],ml[5]=t[5],ml[6]=e*t[6],ml[7]=i*t[7];else if("h"===s||"H"===s)ml[1]=e*t[1];else if("v"===s||"V"===s)ml[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Rl=Object.assign(Object.assign({},kl),{points:[],cornerRadius:0,closePath:!0}),Ll=Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ol=Object.assign(Object.assign({},kl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},kl),xl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dl=Object.assign(Object.assign(Object.assign({},kl),xl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kl),{fill:!0,cornerRadius:0}),jl=Object.assign(Object.assign({},Fl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const zl=new class{},Hl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Nl=!0,Vl=!1,Gl=/\w|\(|\)|-/,Wl=/[.?!,;:/,。?!、;:]/,Ul=/\S/;function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=zl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Kl(t,a)),a}function Kl(t,e){let i=e;for(;Gl.test(t[i-1])&&Gl.test(t[i])||Wl.test(t[i]);)if(i--,i<=0)return e;return i}function Xl(t,e){const i=zl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var $l=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Il.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Kl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Kl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=$l([Oa()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Oa()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Fa,this.options=e,this.id=ba.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ua}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Sa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wa(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new $a(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Aa],multiInject:s[ka]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case ja:case Na:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Da&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,zl.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-xh&&txh||t<-xh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Rt)<0&&(t+=Rt),t}function fh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Ah=[-1,-1,-1],kh=[-1,-1];function Mh(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Th(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Ah);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Ah);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ah[0]=-l,Ah[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=Ah[0]+t&&a<=Ah[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=Ah[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=fh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Bh[0]=S,Bh[1]=A,Ph(Bh,Boolean(a[6])),S=Bh[0],A=Bh[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case po.M:u=f,p=v,c=u,d=p;break;case po.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=fh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case po.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=fh(c,d,o,l,s,n),i){if(yh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ch(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case po.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=fh(o,p,o,l,s,n),h+=fh(u,l,u,p,s,n);break;case po.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=fh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new to(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=zl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Oh([Oa(),Ih("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=zl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Lh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:xl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Qe(Object.assign({defaultFontParams:{fontFamily:xl.fontFamily,fontSize:xl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Oa(),Nh(0,Ra(qa)),Nh(0,Ia(Jl)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new oe;let Uh=class{constructor(){this.matrix=new oe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Oa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:Ml,area:Tl,circle:wl,line:Pl,path:Bl,symbol:Ol,text:Il,rect:Ll,polygon:Rl,richtext:Dl,richtextIcon:jl,image:Fl,group:Cl,glyph:El},Kh=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const $h={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Kh.forEach((t=>{this._defaultTheme[t]=Object.create($h[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Kh.forEach((s=>{const n=Object.create($h[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Kh.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ba.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class uc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{static Avaliable(){return!!zl.global.getRequestAnimationFrame()}avaliable(){return gc.Avaliable()}tick(t,e){zl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var mc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(mc||(mc={}));class fc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-fc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*fc.bounceIn(2*t):.5*fc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}fc.quadIn=fc.getPowIn(2),fc.quadOut=fc.getPowOut(2),fc.quadInOut=fc.getPowInOut(2),fc.cubicIn=fc.getPowIn(3),fc.cubicOut=fc.getPowOut(3),fc.cubicInOut=fc.getPowInOut(3),fc.quartIn=fc.getPowIn(4),fc.quartOut=fc.getPowOut(4),fc.quartInOut=fc.getPowInOut(4),fc.quintIn=fc.getPowIn(5),fc.quintOut=fc.getPowOut(5),fc.quintInOut=fc.getPowInOut(5),fc.backIn=fc.getBackIn(1.7),fc.backOut=fc.getBackOut(1.7),fc.backInOut=fc.getBackInOut(1.7),fc.elasticIn=fc.getElasticIn(1,.3),fc.elasticOut=fc.getElasticOut(1,.3),fc.elasticInOut=fc.getElasticInOut(1,.3*1.5);class vc{constructor(){this.id=ba.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ao.END?this.removeAnimate(e):e.status===Ao.RUNNING||e.status===Ao.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ao.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const _c=new vc;class yc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class bc extends yc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let xc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ba.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new Sc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&ko.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:So.ANIMATE_PLAY})}runCb(t){const e=new bc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===Ao.RUNNING&&(this.status=Ao.PAUSED)}resume(){this.status===Ao.PAUSED&&(this.status=Ao.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Sc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ao.RUNNING&&(this.status=Ao.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ao.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};xc.mode=ko.NORMAL,xc.interpolateMap=new Map;class Sc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Ac(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?fc[i]:i,n=this._addStep(e,null,s);return n.type=Mo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?fc[i]:i,r=this._addStep(e,null,n);return r.type=Mo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=Mo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Mo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Ac(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Ac{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Mc="cubicOut",Tc=1e3,wc="quadInOut";var Cc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Cc||(Cc={}));const Ec=[!1,!1,!1,!1],Pc=[0,0,0,0],Bc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Pc[0]=t[0],Pc[2]=t[0],Pc[1]=t[1],Pc[3]=t[1],Pc):t:t:0,Rc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Lc=[1,2,3,0,1,2,3,0];function Oc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Rc[0].x=i,Rc[1].y=i,Rc[2].x=-i,Rc[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(It(t)*i,jt(t)*i),s.add(It(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:zc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}zc.TimeOut=1e3/60;const Hc=new zc,Nc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Vc extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Yt(this.fromNumber),Yt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Gc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Gc||(Gc={}));class Wc extends yc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Ic(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Uc extends yc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:So.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:So.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Yc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=zl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Kc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=zl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Xc extends yc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class $c extends yc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?fc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function qc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Zc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{pt(e,s)&&pt(i,n)||t.push(e,i,s,n,s,n)};function sd(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function nd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function od(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),cd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},dd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Jt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return cd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return cd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);dd(n[0],s,i),dd(n[1],e-s,i)}};var ud;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ud||(ud={}));class pd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ud.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ud.Color1){const e=pd.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=_e.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];pd.store1[t]=e,pd.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=pd.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=_e.parseColorString(t);return n&&(pd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],pd.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===ud.Color1){if(pd.store1[t])return;pd.store1[t]=i,pd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(pd.store255[t])return;pd.store255[t]=i,pd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function gd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function md(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>fd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):fd(t,e,i,s,n)}function fd(t,e,i,s,n){if(!t||!e)return t&&gd(t)||e&&gd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=pd.Get(t,ud.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=pd.Get(e,ud.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:gd(a)})))});return o?md(r,l,i,s,n):md(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),gd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}pd.store255={},pd.store1={};const vd=[0,0,0,0],_d=[0,0,0,0];function yd(t,e,i){return pd.Get(t,ud.Color255,vd),pd.Get(e,ud.Color255,_d),`rgba(${Math.round(vd[0]+(_d[0]-vd[0])*i)},${Math.round(vd[1]+(_d[1]-vd[1])*i)},${Math.round(vd[2]+(_d[2]-vd[2])*i)},${vd[3]+(_d[3]-vd[3])*i})`}const bd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=md(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},xd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?sd(t):[],n=sd(e);i&&s&&(i.fromTransform&&nd(s,i.fromTransform.clone().getInverse()),nd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Ad=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],kd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Ad.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?pd.Get(t[n],ud.Color255):t[n],to:"string"==typeof r?pd.Get(r,ud.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class Md extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;xd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&bd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Td=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Sd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=kd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new Md({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Tc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wc)),c};class wd extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;xd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&bd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Cd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Fc.includes(t))(i)||(e[i]=t[i])})),e},Ed=(t,e,i)=>{const s=Cd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=zl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Pd=(t,e,i)=>{const s=[],n=i?null:Cd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Cd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ad(t.attribute),n=od(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(zl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=od(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=od(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ld(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ld(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(zl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:hd(i)}];const s=[];return dd(i,e,s),s})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return dd(r,e,h),h})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=sd(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(zl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Ed(t,s,e),s};class Rd{static GetImage(t,e){var i;const s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Rd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Rd.cache.set(t,s),s.dataPromise=zl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Rd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Rd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=zl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=zl.global.loadBlob(t):"json"===e&&(i.dataPromise=zl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Rd.isLoading&&Rd.toLoadAueue.length){Rd.isLoading=!0;const t=Rd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Rd.cache.set(i,n),n.dataPromise=zl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()})).catch((t=>{console.error(t),Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()}))}}),0)}static loadImage(t,e){const i=Ld(t,Rd.toLoadAueue);if(-1!==i)return Rd.toLoadAueue[i].marks.push(e),void Rd.loading();Rd.toLoadAueue.push({url:t,marks:[e]}),Rd.loading()}static improveImageLoading(t){const e=Ld(t,Rd.toLoadAueue);if(-1!==e){const t=Rd.toLoadAueue.splice(e,1);Rd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ld(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Qt,this._updateTag=bo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Hd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Hd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Hd.x=n,Hd.y=r;return Hd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new oe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(zl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Mc),c&&this.setAttributes(c,!1,{type:So.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:So.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bo.UPDATE_SHAPE_AND_BOUNDS)===bo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=bo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=bo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&bo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,scaleX:i=vl.scaleX,scaleY:s=vl.scaleY,angle:n=vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=It(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),zl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Od.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:So.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=md(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Jh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:zl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new gl).fromString(t):this.pathProxy=new gl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",zl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Vd.mixin(hc);class Gd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Wd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Yd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Kd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Wd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Gd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Xd(t,e){return $d(t)}function $d(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let eu=0;function iu(){return eu++}var su;function nu(t){const e=[];let i=0,s="";for(let n=0;nru.set(t,!0)));const au=new Map;function ou(t){if(ru.has(t))return!0;if(au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>au.set(t,!0)));const lu=iu(),hu=iu(),cu=iu(),du=iu(),uu=iu(),pu=iu(),gu=iu(),mu=iu(),fu=iu(),vu=iu();iu();const _u=iu();iu();const yu=iu(),bu=iu(),xu=iu(),Su=Symbol.for("GraphicService"),Au=Symbol.for("GraphicCreator"),ku={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Mu=Object.keys(ku);var Tu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tu||(Tu={}));let wu=class t extends Vd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=pu,this._childUpdateTag=bo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,dx:i=vl.dx,dy:s=vl.dy,scaleX:n=vl.scaleX,scaleY:r=vl.scaleY,angle:a=vl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Jh(this).group;this._AABBBounds.clear();const i=zl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Bc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),zl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),zl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,zl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{zl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=zl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cu(t){return new wu(t)}wu.NOWORK_ANIMATE_ATTR=Nd;class Eu extends wu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Pu=Symbol.for("TransformUtil"),Bu=Symbol.for("GraphicUtil"),Ru=Symbol.for("LayerService"),Lu=Symbol.for("StaticLayerHandlerContribution"),Ou=Symbol.for("DynamicLayerHandlerContribution"),Iu=Symbol.for("VirtualLayerHandlerContribution");var Du,Fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zu=Du=class{static GenerateLayerId(){return`${Du.idprefix}_${Du.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=zl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(Lu):"dynamic"===t?th.get(Ou):th.get(Iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Eu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Du.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};zu.idprefix="visactor_layer",zu.prefix_count=0,zu=Du=Fu([Oa(),ju("design:paramtypes",[])],zu);var Hu=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Dh).to(jh),t(Bu).to(Vh).inSingletonScope(),t(Pu).to(Uh).inSingletonScope(),t(Ru).to(zu).inSingletonScope()}));function Nu(t,e){return!(!t&&!e)}function Vu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Gu(t,e,i){return i&&t*e>0}function Wu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Uu(t,e){return t*e>0}function Yu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Ku(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $u(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Lt(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*It(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*It(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*It(f),P=n*jt(f),B=r*It(_),R=r*jt(_);let L,O,I,D;if((T>Ct||M>Ct)&&(L=n*It(v),O=n*jt(v),I=r*It(b),D=r*jt(b),hCt){const t=Ft(x,w),r=Ft(S,w),o=Xu(I,D,E,P,n,t,Number(c)),l=Xu(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,n,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*It(Ot(l.y01,l.x01)),s+l.cy+r*jt(Ot(l.y01,l.x01))):e.moveTo(i+L,s+n*jt(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*It(v),s+n*jt(v));if(!(r>Ct)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>Ct){const t=Ft(k,C),n=Ft(A,C),o=Xu(B,R,L,O,r,-n,Number(c)),l=Xu(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,r,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*It(Ot(l.y01,l.x01)),s+l.cy+t*jt(Ot(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*It(b),s+r*jt(b))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class qu{static GetCanvas(){try{return qu.canvas||(qu.canvas=zl.global.createCanvas({})),qu.canvas}catch(t){return null}}static GetCtx(){if(!qu.ctx){const t=qu.GetCanvas();qu.ctx=t.getContext("2d")}return qu.ctx}}class Zu extends le{static getInstance(){return Zu._instance||(Zu._instance=new Zu),Zu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=qu.GetCanvas(),s=qu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Zu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ju{static GetSize(t){for(let e=0;e=t)return Ju.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ju.GenKey(t,e,i,s,n),l=Ju.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ju.GenKey(t,e,i,s,n);Ju.cache[l]?Ju.cache[l].push({width:a,height:o,pattern:r}):Ju.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ju.cache={},Ju.ImageSize=[20,40,80,160,320,640,1280,2560];const Qu=Symbol.for("ArcRenderContribution"),tp=Symbol.for("AreaRenderContribution"),ep=Symbol.for("CircleRenderContribution"),ip=Symbol.for("GroupRenderContribution"),sp=Symbol.for("ImageRenderContribution"),np=Symbol.for("PathRenderContribution"),rp=Symbol.for("PolygonRenderContribution"),ap=Symbol.for("RectRenderContribution"),op=Symbol.for("SymbolRenderContribution"),lp=Symbol.for("TextRenderContribution"),hp=Symbol.for("InteractiveSubRenderContribution"),cp=["radius","startAngle","endAngle",...Dd];class dp extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=du}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Jh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateCircleAABBBounds(i,Jh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,cp)}needUpdateTag(t){return super.needUpdateTag(t,cp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new gl;return o.arc(0,0,n,r,a),o}clone(){return new dp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function up(t){return new dp(t)}function pp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function gp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}dp.NOWORK_ANIMATE_ATTR=Nd;class fp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=xu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Jh(this).text;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Jh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Nc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=zl.graphicUtil.textMeasure,k=new fp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===su.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=gp(x,o),M=mp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Jh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Nc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=zl.graphicUtil.textMeasure,y=new fp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Jh(this).text,a=zl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Nc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=gp(x,o),e=this.cache.verticalList.length*b,i=mp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>nu(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===su.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const k=gp(x,o),M=this.cache.verticalList.length*b,T=mp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yp(t){return new _p(t)}_p.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Nd),_p.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_p.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class bp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function xp(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Sp=new class extends bp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return xp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return xp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Ap=new class extends bp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function kp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Mp=new class extends bp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return kp(t,e/2+n,i,s,r)}};function Tp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var wp=new class extends bp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Tp(t,e/2+n,i,s)}};class Cp extends bp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Ep=new Cp;var Pp=new class extends Cp{constructor(){super(...arguments),this.type="triangle"}};const Bp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Rp=Math.sin(Bt/10)*Bp,Lp=-Math.cos(Bt/10)*Bp;function Op(t,e,i,s){const n=Rp*e,r=Lp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ip=new class extends bp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};const Dp=zt(3);function Fp(t,e,i,s){const n=e,r=n/Dp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var jp=new class extends bp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Fp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Fp(t,e/2+n,i,s)}};function zp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Hp=new class extends bp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return zp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return zp(t,e/2+n,i,s)}};function Np(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Vp=new class extends bp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};const Gp=-.5,Wp=zt(3)/2,Up=1/zt(12);function Yp(t,e,i,s){const n=e/2,r=e*Up,a=n,o=e*Up+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Gp*n-Wp*r+i,Wp*n+Gp*r+s),t.lineTo(Gp*a-Wp*o+i,Wp*a+Gp*o+s),t.lineTo(Gp*l-Wp*h+i,Wp*l+Gp*h+s),t.lineTo(Gp*n+Wp*r+i,Gp*r-Wp*n+s),t.lineTo(Gp*a+Wp*o+i,Gp*o-Wp*a+s),t.lineTo(Gp*l+Wp*h+i,Gp*h-Wp*l+s),t.closePath(),!1}var Kp=new class extends bp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Yp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Yp(t,e/2+n,i,s)}};var Xp=new class extends bp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends bp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var qp=new class extends bp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Zp=zt(3);function Jp(t,e,i,s){const n=e*Zp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Qp=new class extends Cp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Jp(t,e/2/Zp,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/2/Zp+n,i,s)}};function tg(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var eg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return tg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return tg(t,e/4+n,i,s)}};function ig(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var sg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return ig(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ig(t,e/4+n,i,s)}};function ng(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var rg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return ng(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ng(t,e/4+n,i,s)}};function ag(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var og=new class extends bp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ag(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ag(t,e/4+n,i,s)}};function lg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var hg=new class extends bp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return lg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return lg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function cg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var dg=new class extends bp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return cg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return cg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ug(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var pg=new class extends bp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return ug(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ug(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function mg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var fg=new class extends bp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?mg(t,e,i,s):gg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?mg(t,e+2*n,i,s):gg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const vg=new Qt;class _g{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;vg.x1=s.bounds.x1*t,vg.y1=s.bounds.y1*t,vg.x2=s.bounds.x2*t,vg.y2=s.bounds.y2*t,e.union(vg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const yg={};[Sp,Ap,Mp,wp,Qp,Pp,Ip,jp,Hp,Vp,Kp,Xp,$p,Ep,qp,eg,sg,rg,og,fg,hg,dg,pg].forEach((t=>{yg[t.type]=t}));const bg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},xg=new Qt,Sg=["symbolType","size",...Dd];let Ag=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Jh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=yg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=bg[i]||i,!0===((n=i).startsWith("{const e=(new gl).fromString(t.d),i={};Mu.forEach((e=>{t[e]&&(i[ku[e]]=t[e])})),r.push({path:e,attribute:i}),xg.union(e.bounds)}));const a=xg.width(),o=xg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new _g(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new gl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new _g(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Jh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateSymbolAABBBounds(i,Jh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new gl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new gl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.userSymbolMap={},Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Nd);const Mg=["segments","points","curveType","curveTension",...Dd];let Tg=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=mu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}doUpdateAABBBounds(){const t=Jh(this).line;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateLineAABBBounds(e,Jh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.attribute,e=new gl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const Cg=["width","x1","y1","height","cornerRadius",...Dd];class Eg extends Vd{constructor(t){super(t),this.type="rect",this.numberType=_u}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Jh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRectAABBBounds(e,Jh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ad(t),r=new gl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Nd;class Bg extends Vd{constructor(t){super(t),this.type="glyph",this.numberType=uu,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=zl.graphicService.updateGlyphAABBBounds(this.attribute,Jh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Bg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Nd;class Lg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Hl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Og{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Nc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Vl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Nl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Ig=["width","height","image",...Dd];class Dg extends Vd{constructor(t){super(t),this.type="image",this.numberType=gu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Jh(this).image;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateImageAABBBounds(e,Jh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Fl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ig)}needUpdateTag(t){return super.needUpdateTag(t,Ig)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Nd);class jg extends Dg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Bc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Bc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fl.width,height:e=Fl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class zg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Hl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Ul.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof jg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Xl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof jg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Hl[this.direction]}store(t){if(t instanceof jg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new zg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof jg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character),new Og(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...Dd];class Vg extends Vd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Jh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRichTextAABBBounds(e,Jh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Lg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Hg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;const o=e.AABBBounds.clone();o.translate(e._marginArray[3],e._marginArray[0]),o.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i+e._marginArray[3],n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Nd);const Wg=["path","customPath",...Dd];class Ug extends Vd{constructor(t){super(t),this.type="path",this.numberType=fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Jh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof gl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof gl?this.cache:t.path)}doUpdateAABBBounds(){const t=Jh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePathAABBBounds(e,Jh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new gl).fromString(t.path):t.customPath&&(this.cache=new gl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}toCustomPath(){return(new gl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Nd);const Kg=["segments","points","curveType","curveTension",...Dd];class Xg extends Vd{constructor(t){super(t),this.type="area",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Jh(this).area;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateAreaAABBBounds(e,Jh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){const t=new gl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Dd];class Zg extends Vd{constructor(t){super(t),this.type="arc",this.numberType=lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Jh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Jh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ie(e),i=e+r,s&&Lt(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Jh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Lt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Vt(Number(l)/o*jt(g)),n=Vt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Jh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateArcAABBBounds(i,Jh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}getDefaultAttribute(t){return Jh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Lt(i-e),a=i>e;if(n=Rt-Ct)o.moveTo(0+n*It(e),0+n*jt(e)),o.arc(0,0,n,e,i,!a),s>Ct&&(o.moveTo(0+s*It(i),0+s*jt(i)),o.arc(0,0,s,i,e,a));else{const t=n*It(e),r=n*jt(e),l=s*It(i),h=s*jt(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Nd);const Qg=["points","cornerRadius",...Dd];class tm extends Vd{constructor(t){super(t),this.type="polygon",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Jh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePolygonAABBBounds(e,Jh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){const t=this.attribute.points,e=new gl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new tm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tm.NOWORK_ANIMATE_ATTR}}function em(t){return new tm(t)}tm.NOWORK_ANIMATE_ATTR=Nd;class im extends wu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function sm(t){return new im(t)}class nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class rm extends nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;tu(i,s+(r+o)/2,!0,a)}return i}}class am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};function um(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function pm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function gm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),um(t,t,[n+o,r+l,a+h]),um(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),um(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=lm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}um(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),um(i,i,[-s[0],-s[1],0]),gm(t,t,i)}}let fm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new to(["graphic"]),onSetStage:new to(["graphic","stage"]),onRemove:new to(["graphic"]),onRelease:new to(["graphic"]),onAddIncremental:new to(["graphic","group","stage"]),onClearIncremental:new to(["graphic","group","stage"]),beforeUpdateAABBBounds:new to(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new to(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Qt,this.tempAABBBounds2=new Qt,this._rectBoundsContribitions=[new nm],this._symbolBoundsContribitions=[new rm],this._imageBoundsContribitions=[new nm],this._circleBoundsContribitions=[new nm],this._arcBoundsContribitions=[new nm],this._pathBoundsContribitions=[new nm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new lo(t);return Lo(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=mp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=gp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){tu(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Zt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Rt-Ct?i.set(-a,-a,a,a):Oc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=Ct?i.set(0,0,0,0):Math.abs(l-h)>Rt-Ct?i.set(-n,-n,n,n):(Oc(h,l,n,i),Oc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){tu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;tu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Zt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};fm=hm([Oa(),dm(0,Ra(Au)),cm("design:paramtypes",[Object])],fm);const vm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let _m,ym;function bm(t){return _m||(_m=vm.CreateGraphic("text",{})),_m.initAttributes(t),_m.AABBBounds}const xm={x:0,y:0,z:0,lastModelMatrix:null};class Sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Gu(o,l,n),p=Uu(o,c),g=Nu(n,r),m=Vu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;xm.x=n,xm.y=r,xm.z=a,xm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=lm.allocate(),n=lm.allocate();mm(n,t,e),gm(s,d||s,n),xm.x=0,xm.y=0,xm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),lm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,xm.z=a,i.setTransformForCurrent()}else if(p)xm.x=0,xm.y=0,xm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,this.transformWithoutTranslate(i,xm.x,xm.y,xm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),xm.x=0,xm.y=0,xm.z=0;return xm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Gu(d,u,h),y=Uu(d,g),b=Nu(h),x=Vu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Lo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&lm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Am=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class km{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(km.IsGradientStr(t))try{const e=Am(t)[0];if(e){if("linear"===e.type)return km.ParseLinear(e);if("radial"===e.type)return km.ParseRadial(e);if("conic"===e.type)return km.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Mm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};class Pm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Lh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Lh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Bm=new Pm;let Rm=class{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Rm=wm([Oa(),Em(0,Ra(qa)),Em(0,Ia(hp)),Cm("design:paramtypes",[Object])],Rm);class Lm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Lh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Lh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Om=new Lm;const Im=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),$u(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),$u(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Dm=Om,Fm=Bm;const jm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},zm=Om,Hm=Bm;const Nm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vm=Et/2;function Gm(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Lt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Lt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Lt(t[0]),i=Lt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Lt(o[0]),o[1]=Lt(o[1]),o[2]=Lt(o[2]),o[3]=Lt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-Vm,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,Vm,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Vm,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+Vm,!1)}return!a&&t.closePath(),t}var Wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Um{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Gm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Gm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Ym=class{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ym=Wm([Oa()],Ym);let Km=class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Gm(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Km=Wm([Oa()],Km);const Xm=new Um,$m=Om,qm=Bm;const Zm=new class extends Um{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Bc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Gm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Qm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},tf=Om,ef=Bm;var sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rf=function(t,e){return function(i,s){e(i,s,t)}};let af=class extends Sm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=lu,this.builtinContributions=[Im,Fm,Dm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Lt(d-c),p=d>c;let g=!1;if(nCt||C>Ct)&&(D=n*It(x),F=n*jt(x),j=r*It(A),z=r*jt(A),uCt){const t=Ft(k,P),r=Ft(M,P),a=Xu(j,z,R,L,n,t,Number(p)),o=Xu(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>Ct)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>Ct){const t=Ft(w,B),n=Ft(T,B),a=Xu(O,I,D,F,r,-n,Number(p)),o=Xu(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Ot(a.y01,a.x01),Ot(a.y11,a.x11),!p);const t=Ot(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*It(A),s+r*jt(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Lt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Ec[s]=t,i&&(i=!(null!==(e=Ec[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ec[e]=!!t[e],i&&(i=!!Ec[e]);else Ec[0]=!1,Ec[1]=!1,Ec[2]=!1,Ec[3]=!1;return{isFullStroke:i,stroke:Ec}})(d);if((v||C)&&(e.beginPath(),$u(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),$u(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Lt(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),md(o.color,l.color,h,!1)}(0,0,h,n);a||Gu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};af=sf([Oa(),rf(0,Ra(qa)),rf(0,Ia(Qu)),nf("design:paramtypes",[Object])],af);var of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(i,s){e(i,s,t)}};let cf=class extends Sm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=du,this.builtinContributions=[jm,Hm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function df(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function uf(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),df(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=To.ROW:"y"===s?m=To.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gf=class extends Sm{constructor(){super(...arguments),this.numberType=mu}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=pl(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function mf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function ff(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),df(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),df(t,l,1,s),o=!1):o=!0}t.closePath()}gf=pf([Oa()],gf);const vf=new class extends Lm{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:jc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:jc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_f=Bm;var yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xf=function(t,e){return function(i,s){e(i,s,t)}};function Sf(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}let Af=class extends Sm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=cu,this.builtinContributions=[vf,_f],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Sf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Sf(e,C,{curveTension:b}),n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=To.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Lt(E.x-P.x),L=Lt(E.y-P.y);B=null==E.x1?To.ROW:null==E.y1?To.COLUMN:Number.isFinite(R+L)?R>L?To.ROW:To.COLUMN:To.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),mf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),mf(t,e,i,s),e.length=0,i.length=0)}n=o})),mf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?To.ROW:To.COLUMN,Number.isFinite(u)||(h=To.COLUMN),Number.isFinite(p)||(h=To.ROW);const g=i*(h===To.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Sm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Mf,kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Lo(t.pathShape.commandList,e,i,s,1,1,g);else{Lo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(np)),wf("design:paramtypes",[Object])],Ef);var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rf=function(t,e){return function(i,s){e(i,s,t)}};let Lf=class extends Sm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=_u,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Wu(g,m,k,M,c),w=Yu(g,v,k,M),C=Nu(c,d),E=Vu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Gm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(ap)),Bf("design:paramtypes",[Object])],Lf);var Of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Df=function(t,e){return function(i,s){e(i,s,t)}};let Ff=class extends Sm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bu,this.builtinContributions=[Qm,ef,tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Ff=Of([Oa(),Df(0,Ra(qa)),Df(0,Ia(op)),If("design:paramtypes",[Object])],Ff);const jf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Qt)}allocate(t,e,i,s){if(!this.pools.length)return(new Qt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Qt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const zf=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=jf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=bm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Gm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&jf.free(C),w()}};var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Sm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xu,this.builtinContributions=[zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Nc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=om.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),om.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=gp(l,f),_=mp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Wf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Sm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=vu,this.builtinContributions=[Xf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Wf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Uf(d,u),b=Uf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Yf(h,_,y,d,u),A=Yf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Uf(k,M),w=Yf(h,Uf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(rp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=pu}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Wu(u,f,p,g,h),k=Yu(u,v,p,g),M=Nu(h,c),T=Vu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Gm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Nm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=lm.allocate(),i=lm.allocate();mm(i,t,l),gm(e,h||e,i),n.modelMatrix=e,lm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&lm.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};iv=Qf([Oa(),ev(0,Ra(qa)),ev(0,Ia(ip)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];let ov=class extends Sm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=gu,this.builtinContributions=[Zm,Jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Gm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,av[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Rd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};ov=sv([Oa(),rv(0,Ra(qa)),rv(0,Ia(sp)),nv("design:paramtypes",[Object])],ov);const lv=Symbol.for("IncrementalDrawContribution"),hv=Symbol.for("ArcRender"),cv=Symbol.for("AreaRender"),dv=Symbol.for("CircleRender"),uv=Symbol.for("GraphicRender"),pv=Symbol.for("GroupRender"),gv=Symbol.for("LineRender"),mv=Symbol.for("PathRender"),fv=Symbol.for("PolygonRender"),vv=Symbol.for("RectRender"),_v=Symbol.for("SymbolRender"),yv=Symbol.for("TextRender"),bv=Symbol.for("RichTextRender"),xv=Symbol.for("GlyphRender"),Sv=Symbol.for("ImageRender"),Av=Symbol.for("DrawContribution");var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tv=Symbol.for("DrawItemInterceptor"),wv=new Qt,Cv=new Qt;class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){wv.copy(s.dirtyBounds),Cv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,om.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(wv),s.backupDirtyBounds.copy(Cv)),!0}}class Pv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Bv=class{constructor(){this.order=1,this.interceptors=[new Ev,new Lv,new Rv,new Pv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===hu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&lm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};const Fv=Symbol.for("RenderService");let jv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jv=Ov([Oa(),Dv(0,Ra(Av)),Iv("design:paramtypes",[Object])],jv);var zv=new xa((t=>{t(Fv).to(jv)}));const Hv=Symbol.for("PickerService"),Nv=Symbol.for("GlobalPickerService");var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Gv=Symbol.for("PickItemInterceptor");let Wv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=om.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Wv=Vv([Oa()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Uv=Vv([Oa()],Uv);let Yv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===hu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Yv=Vv([Oa()],Yv);var Kv=new xa(((t,e,i)=>{i(Hv)||(t(Nv).toSelf(),t(Hv).toService(Nv)),t(Yv).toSelf().inSingletonScope(),t(Gv).toService(Yv),t(Wv).toSelf().inSingletonScope(),t(Gv).toService(Wv),t(Uv).toSelf().inSingletonScope(),t(Gv).toService(Uv),Ja(t,Gv)})),Xv=new xa((t=>{t(Su).to(fm).inSingletonScope(),t(Au).toConstantValue(vm)}));const $v=Symbol.for("AutoEnablePlugins"),qv=Symbol.for("PluginService");var Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qv=function(t,e){return function(i,s){e(i,s,t)}};let t_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound($v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};t_=Zv([Oa(),Qv(0,Ra(qa)),Qv(0,Ia($v)),Jv("design:paramtypes",[Object])],t_);var e_=new xa((t=>{t(qv).to(t_),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,$v)})),i_=new xa((t=>{Ja(t,eo)})),s_=new xa((t=>{t(Jl).to(Ql).inSingletonScope(),Ja(t,Jl)})),n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let a_=class{constructor(){this.type="static",this.offscreen=!1,this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};a_=n_([Oa(),r_("design:paramtypes",[])],a_);var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let h_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=zl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};h_=o_([Oa(),l_("design:paramtypes",[])],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=sh({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};u_=c_([Oa(),d_("design:paramtypes",[])],u_);var p_=new xa((t=>{t(a_).toSelf(),t(u_).toSelf(),t(h_).toSelf(),t(Lu).toService(a_),t(Ou).toService(u_),t(Iu).toService(h_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function m_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return g_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function v_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Jt,this.backupDirtyBounds=new Jt,this.global=zl.global,this.layerService=zl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,om.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,kl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ie(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=jf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=om.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):m_(t,kl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jf.free(n),om.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(lv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends gf{constructor(){super(...arguments),this.numberType=mu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Gu(u,p,c),_=Uu(u,g),y=Nu(c),b=Vu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Oa()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Af{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Gu(u,d,c),m=Nu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Oa()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let B_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new to([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,kl.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield f_(t,kl.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};B_=w_([Oa(),E_(0,La(uv)),E_(1,Ra(A_)),E_(2,Ra(M_)),E_(3,Ra(qa)),E_(3,Ia(Tv)),C_("design:paramtypes",[Array,Object,Object,Object])],B_);var R_=new xa((t=>{t(Pm).toSelf().inSingletonScope(),t(Lm).toSelf().inSingletonScope(),t(Av).to(x_),t(lv).to(B_),t(pv).to(iv).inSingletonScope(),t(uv).toService(pv),Ja(t,ip),t(Rm).toSelf().inSingletonScope(),Ja(t,hp),Ja(t,uv),t(Bv).toSelf().inSingletonScope(),t(Tv).toService(Bv),Ja(t,Tv)}));function L_(){L_.__loaded||(L_.__loaded=!0,th.load(Hu),th.load(Xv),th.load(zv),th.load(Kv),th.load(e_),function(t){t.load(i_),t.load(s_),t.load(p_)}(th),function(t){t.load(R_)}(th))}L_.__loaded=!1,L_();const O_=th.get(io);zl.global=O_;const I_=th.get(Bu);zl.graphicUtil=I_;const D_=th.get(Pu);zl.transformUtil=D_;const F_=th.get(Su);zl.graphicService=F_;const j_=th.get(Ru);zl.layerService=j_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),zl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class H_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),zl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){zl.graphicService.hooks.onAddIncremental.taps=zl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onClearIncremental.taps=zl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,zl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class V_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.unTap(this.key),zl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?zl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:zl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=ni(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Jh(t).text)}getTransformOfText(t){const e=Jh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=ti(h,c);o=t.x,l=t.y}const p=zl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));zl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===zl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&zl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===zl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const G_=new Qt;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(G_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(G_,t.parent&&t.parent.globalTransMatrix)))})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),zl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.taps=zl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const U_=new Qt;class Y_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ba.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Qt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Jh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&U_.copy(s)})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(U_.equals(i)||this.tryLayout(t,!1))})),zl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const K_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===mc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=mc.INITIAL,zl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),zl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:gc},{mode:"timeout",cons:pc},{mode:"manual",cons:uc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==mc.INITIAL&&(this.status=mc.PAUSE,!0)}resume(){return this.status!==mc.INITIAL&&(this.status=mc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===mc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===mc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=mc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=mc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};K_.addTimeline(_c),K_.setFPS(60);class X_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=pd.Get(e,ud.Color1),this.ambient=i;const s=zt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Ft(Dt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?pd.Get(e,ud.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function $_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function q_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Z_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&zl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ey="white";class iy extends wu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ey}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=zl.global,!this.global.env&&Q_()&&this.global.setEnv("browser"),this.window=th.get(Dh),this.renderService=th.get(Fv),this.pluginService=th.get(qv),this.layerService=th.get(Ru),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ey,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||K_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new vc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new X_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Z_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new H_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Jt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Y_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new V_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new ty))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=th.get(Hv));const i=this.pickerService.pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry=new oe(1,0,0,1,0,0),ay={x:0,y:0};let oy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this.path=new gl,this._clearMatrix=new oe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ay),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,ay.x,ay.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ay);const i=Mm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,ay.x,ay.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ry,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};oy=sy([Oa(),ny("design:paramtypes",[Object,Number])],oy);var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cy={WIDTH:500,HEIGHT:500,DPR:1};let dy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=cy.WIDTH,height:n=cy.HEIGHT,dpr:r=cy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};dy.env="browser",dy=ly([Oa(),hy("design:paramtypes",[Object])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let py=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Qt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};py=uy([Oa()],py);var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fy=class{constructor(){this._uid=ba.GenAutoIncrementId(),this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};fy=gy([Oa(),my("design:paramtypes",[])],fy);var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yy=function(t,e){return function(i,s){e(i,s,t)}};let by=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=zl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Qt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new oe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=lm.allocate();if(pm(i,e),a){if(i){const t=lm.allocate();r.modelMatrix=gm(t,a,i),lm.free(i)}}else pm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&lm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),om.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function xy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&xy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&xy(t,a,i,s,n))}function Sy(t,e){const i=t.length-1,s=[t[0]];return xy(t,0,i,e,s),s.push(t[i]),s}by=vy([Oa(),yy(0,Ra(qa)),yy(0,Ia(Gv)),_y("design:paramtypes",[Object])],by);let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(af).toSelf().inSingletonScope(),t(hv).to(af).inSingletonScope(),t(uv).toService(hv),t(Qu).toService(Rm),Ja(t,Qu))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(Lf).toSelf().inSingletonScope(),t(vv).to(Lf).inSingletonScope(),t(uv).toService(vv),t(Km).toSelf(),t(Ym).toSelf(),t(ap).toService(Km),t(ap).toService(Ym),t(ap).toService(Rm),Ja(t,ap))}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(gf).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(gv).to(gf).inSingletonScope(),t(uv).toService(gv))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(Af).toSelf().inSingletonScope(),t(cv).to(Af).inSingletonScope(),t(uv).toService(cv),t(tp).toService(Rm),Ja(t,tp),t(M_).toSelf().inSingletonScope())}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(Ff).toSelf().inSingletonScope(),t(_v).to(Ff).inSingletonScope(),t(uv).toService(_v),t(op).toService(Rm),Ja(t,op))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(cf).toSelf().inSingletonScope(),t(dv).to(cf).inSingletonScope(),t(uv).toService(dv),t(ep).toService(Rm),Ja(t,ep))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(yv).to(Gf).inSingletonScope(),t(uv).toService(yv),t(lp).toService(Rm),Ja(t,lp))}));let Fy=!1;const jy=new xa((t=>{Fy||(Fy=!0,t(Ef).toSelf().inSingletonScope(),t(mv).to(Ef).inSingletonScope(),t(uv).toService(mv),t(np).toService(Rm),Ja(t,np))}));let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(fv).to(Jf).inSingletonScope(),t(uv).toService(fv),t(rp).toService(Rm),Ja(t,rp))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vy=class{constructor(){this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Vy=Ny([Oa()],Vy);let Gy=!1;const Wy=new xa((t=>{Gy||(Gy=!0,t(xv).to(Vy).inSingletonScope(),t(uv).toService(xv))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=class extends Sm{constructor(){super(),this.numberType=yu,this.builtinContributions=[zf],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Gu(o,l,!0),d=Gu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Gm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};Ky=Uy([Oa(),Yy("design:paramtypes",[])],Ky);let Xy=!1;const $y=new xa((t=>{Xy||(Xy=!0,t(bv).to(Ky).inSingletonScope(),t(uv).toService(bv))}));let qy=!1;const Zy=new xa((t=>{qy||(qy=!0,t(Sv).to(ov).inSingletonScope(),t(uv).toService(Sv),t(sp).toService(Rm),Ja(t,sp))}));const Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Q_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),db=t=>e=>R(e,t),ub=t=>{at.getInstance().error(t)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ub("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ub("Access path missing closing bracket: "+t),a&&ub("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return cb((i&&i.get||db)(s),[n],e||n)},gb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>pb(t,e,i)));return t=>s.map((e=>e(t)))}return pb(t,e,i)};gb("id");const mb=cb((function(t){return t}),[],"identity"),fb=cb((function(){return 0}),[],"zero");cb((function(){return 1}),[],"one"),cb((function(){return!0}),[],"true"),cb((function(){return!1}),[],"false"),cb((function(){return{}}),[],"emptyObject");const vb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>_b(t,r,n)))))},yb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function bb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function xb(t,e,i,s,n){let r=0,a=0;return bb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Sb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;bb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xb(t,e,i,n,h)}}function Ab(t){return"horizontal"===t}function kb(t){return"vertical"===t}const Mb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Tb extends wu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,Mb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Mb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const tx=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},ex=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ix extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||tx(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=ex(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=ex(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=tx(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ac.now()-i>this.config.press.time&&ex(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rx=[0,0,0];let ax=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},_l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},xl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this._clearMatrix=new oe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new oe(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ju.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=zl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:xl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:xl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Tm(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit}=e;r.lineWidth=Mm(this,a,this.dpr),r.strokeStyle=Tm(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=pp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=pp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};ax.env="browser",ax=sx([Oa(),nx("design:paramtypes",[Object,Number])],ax);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hx=class extends dy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=zl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ax(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function cx(t,e){return new xa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}hx.env="browser",hx=ox([Oa(),lx("design:paramtypes",[Object])],hx);const dx=cx(hx,ax);var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let mx=class extends by{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Lh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vx=class{constructor(){this.type="group",this.numberType=pu}contains(t,e,i){return!1}};vx=fx([Oa()],vx);const _x=new xa(((t,e,i,s)=>{_x.__vloaded||(_x.__vloaded=!0,t(Zb).to(vx).inSingletonScope(),t(Jb).toService(Zb),Ja(t,Jb))}));_x.__vloaded=!1;var yx=_x;const bx=new xa(((t,e,i,s)=>{i(mx)||t(mx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(mx):t(Hv).toService(mx)}));var xx,Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=xx=class extends fy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${xx.idprefix}_${xx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=zl.global,this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:xx.GenerateCanvasId(),canvasControled:!0};this.canvas=new hx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new hx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};kx.env="browser",kx.idprefix="visactor_window",kx.prefix_count=0,kx=xx=Sx([Oa(),Ax("design:paramtypes",[])],kx);const Mx=new xa((t=>{t(kx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(kx))).whenTargetNamed(kx.env)}));var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends py{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Qt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ba.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Tx([Oa(),wx("design:paramtypes",[])],Px);const Bx=new xa((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(eo).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(dx),t.load(Mx),e&&function(t){t.load(yx),t.load(bx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ox=class extends ax{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};Ox.env="feishu",Ox=Lx([Oa()],Ox);var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fx=class extends dy{constructor(t){super(t)}init(){this._context=new Ox(this,this._dpr)}release(){}};Fx.env="feishu",Fx=Ix([Oa(),Dx("design:paramtypes",[Object])],Fx);const jx=cx(Fx,Ox);var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};class Vx{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Gx=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new Vx}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Fx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Gx.env="feishu",Gx=zx([Oa(),Nx(0,Ra(io)),Hx("design:paramtypes",[Object])],Gx);const Wx=new xa((t=>{t(Gx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Gx))).whenTargetNamed(Gx.env)}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends by{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new oy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xx=Ux([Oa(),Kx(0,Ra(qa)),Kx(0,Ia(wb)),Kx(1,Ra(qa)),Kx(1,Ia(Gv)),Yx("design:paramtypes",[Object,Object])],Xx);const $x=new xa((t=>{$x.__vloaded||($x.__vloaded=!0,Ja(t,wb))}));$x.__vloaded=!1;var qx=$x,Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([Oa(),Qx(0,Ra(hv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new xa(((t,e,i,s)=>{eS||(eS=!0,t(Cb).to(tS).inSingletonScope(),t(wb).toService(Cb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};aS=sS([Oa(),rS(0,Ra(cv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new xa(((t,e,i,s)=>{oS||(oS=!0,t(Eb).to(aS).inSingletonScope(),t(wb).toService(Eb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([Oa(),dS(0,Ra(dv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new xa(((t,e,i,s)=>{pS||(pS=!0,t(Pb).to(uS).inSingletonScope(),t(wb).toService(Pb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};_S=mS([Oa(),vS(0,Ra(xv)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(jb).to(_S).inSingletonScope(),t(_S).toService(jb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};SS=xS([Oa()],SS);let AS=!1;const kS=new xa(((t,e,i,s)=>{AS||(AS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([Oa(),wS(0,Ra(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new xa(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(wb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OS=BS([Oa(),LS(0,Ra(fv)),RS("design:paramtypes",[Object])],OS);let IS=!1;const DS=new xa(((t,e,i,s)=>{IS||(IS=!0,t(Fb).to(OS).inSingletonScope(),t(wb).toService(Fb))}));var FS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zS=function(t,e){return function(i,s){e(i,s,t)}};let HS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};HS=FS([Oa(),zS(0,Ra(mv)),jS("design:paramtypes",[Object])],HS);let NS=!1;const VS=new xa(((t,e,i,s)=>{NS||(NS=!0,t(Lb).to(HS).inSingletonScope(),t(wb).toService(Lb))}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},US=function(t,e){return function(i,s){e(i,s,t)}};const YS=new Qt;let KS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;YS.setValue(i.x1,i.y1,i.x2,i.y2),YS.expand(-r/2),h=!YS.containsPoint(e)}}return s.highPerformanceRestore(),h}};KS=GS([Oa(),US(0,Ra(vv)),WS("design:paramtypes",[Object])],KS);let XS=!1;const $S=new xa(((t,e,i,s)=>{XS||(XS=!0,t(Ob).to(KS).inSingletonScope(),t(wb).toService(Ob))}));let qS=!1;const ZS=new xa(((t,e,i,s)=>{qS||(qS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};eA=JS([Oa(),tA(0,Ra(_v)),QS("design:paramtypes",[Object])],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Ib).to(eA).inSingletonScope(),t(wb).toService(Ib))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class{constructor(){this.type="text",this.numberType=xu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};rA=nA([Oa()],rA);let aA=!1;const oA=new xa(((t,e,i,s)=>{aA||(aA=!0,t(Db).to(rA).inSingletonScope(),t(wb).toService(Db))})),lA=new xa(((t,e,i,s)=>{i(Xx)||t(Xx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(Xx):t(Hv).toService(Xx)}));class hA{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uA=class extends py{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new hA(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};uA=cA([Oa(),dA("design:paramtypes",[])],uA);const pA=new xa((t=>{pA.isFeishuBound||(pA.isFeishuBound=!0,t(uA).toSelf().inSingletonScope(),t(eo).toService(uA))}));function gA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];gA.__loaded||(gA.__loaded=!0,t.load(pA),t.load(jx),t.load(Wx),e&&function(t){t.load(qx),t.load(lA),t.load(iS),t.load(lS),t.load(gS),t.load(bS),t.load(kS),t.load(PS),t.load(DS),t.load(VS),t.load($S),t.load(ZS),t.load(sA),t.load(oA)}(t))}pA.isFeishuBound=!1,gA.__loaded=!1;var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends ax{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vA.env="node",vA=mA([Oa(),fA("design:paramtypes",[Object,Number])],vA);var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bA=class extends dy{constructor(t){super(t)}init(){this._context=new vA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bA.env="node",bA=_A([Oa(),yA("design:paramtypes",[Object])],bA);const xA=cx(bA,vA);var SA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,s){e(i,s,t)}};let MA=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new bA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};MA.env="node",MA=SA([Oa(),kA(0,Ra(io)),AA("design:paramtypes",[Object])],MA);const TA=new xa((t=>{t(MA).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(MA))).whenTargetNamed(MA.env)}));var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CA=class extends py{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};CA=wA([Oa()],CA);const EA=new xa((t=>{EA.isNodeBound||(EA.isNodeBound=!0,t(CA).toSelf().inSingletonScope(),t(eo).toService(CA))}));function PA(t){PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(xA),t.load(TA))}EA.isNodeBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([Oa(),LA(0,Ra(hv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new xa(((t,e,i,s)=>{IA||(IA=!0,t(zb).to(OA).inSingletonScope(),t(Jb).toService(zb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Qt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([Oa(),zA(0,Ra(vv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new xa(((t,e,i,s)=>{VA||(VA=!0,t(Ub).to(NA).inSingletonScope(),t(Jb).toService(Ub))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends Sm{};UA=WA([Oa()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Jh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([Oa(),XA(0,Ra(gv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new xa(((t,e,i,s)=>{qA||(qA=!0,t(Gb).to($A).inSingletonScope(),t(Jb).toService(Gb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([Oa(),tk(0,Ra(cv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new xa(((t,e,i,s)=>{ik||(ik=!0,t(Hb).to(ek).inSingletonScope(),t(Jb).toService(Hb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Jh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&lm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([Oa(),ak(0,Ra(_v)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new xa(((t,e,i,s)=>{lk||(lk=!0,t(Yb).to(ok).inSingletonScope(),t(Jb).toService(Yb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([Oa(),uk(0,Ra(dv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new xa(((t,e,i,s)=>{gk||(gk=!0,t(Nb).to(pk).inSingletonScope(),t(Jb).toService(Nb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Jh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=mp(a,u,n),v=gp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&lm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([Oa(),_k(0,Ra(yv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new xa(((t,e,i,s)=>{bk||(bk=!0,t(Kb).to(yk).inSingletonScope(),t(Jb).toService(Kb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([Oa(),kk(0,Ra(mv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new xa(((t,e,i,s)=>{Tk||(Tk=!0,t(Wb).to(Mk).inSingletonScope(),t(Jb).toService(Wb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([Oa(),Pk(0,Ra(fv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new xa(((t,e,i,s)=>{Rk||(Rk=!0,t(Xb).to(Bk).inSingletonScope(),t(Jb).toService(Xb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([Oa(),Dk(0,Ra(xv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new xa(((t,e,i,s)=>{jk||(jk=!0,t(qb).to(Fk).inSingletonScope(),t(Jb).toService(qb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([Oa(),Vk(0,Ra(bv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t($b).to(Gk).inSingletonScope(),t(Jb).toService($b))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([Oa()],Kk);let Xk=!1;const $k=new xa(((t,e,i,s)=>{Xk||(Xk=!0,t(Vb).to(Kk).inSingletonScope(),t(Jb).toService(Vb))})),qk=Q_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,vm.RegisterGraphicCreator("arc",Jg),th.load(ky),th.load(qk?DA:iS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,vm.RegisterGraphicCreator("area",$g),th.load(Py),th.load(qk?sk:lS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,vm.RegisterGraphicCreator("circle",up),th.load(Oy),th.load(qk?mk:gS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,vm.RegisterGraphicCreator("glyph",Rg),th.load(Wy),th.load(qk?zk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,vm.RegisterGraphicCreator("group",Cu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,vm.RegisterGraphicCreator("image",Fg),th.load(Zy),th.load(qk?$k:kS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,vm.RegisterGraphicCreator("line",wg),th.load(Cy),th.load(qk?ZA:PS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,vm.RegisterGraphicCreator("path",Yg),th.load(jy),th.load(qk?wk:VS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,vm.RegisterGraphicCreator("polygon",em),th.load(Hy),th.load(qk?Lk:DS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,vm.RegisterGraphicCreator("rect",Pg),th.load(Ty),th.load(qk?GA:$S))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,vm.RegisterGraphicCreator("richtext",Gg),th.load($y),th.load(qk?Uk:ZS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,vm.RegisterGraphicCreator("shadowRoot",sm))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,vm.RegisterGraphicCreator("symbol",kg),th.load(Ry),th.load(qk?hk:sA))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,vm.RegisterGraphicCreator("text",yp),th.load(Dy),th.load(qk?xk:oA))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:xt,throttle:St};MM();let LM=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===O_.env?(O_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===O_.env?(O_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ei(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ei(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new _e(t).toHex(),o=new _e(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=_e.getColorBrightness(new _e(e));return _e.getColorBrightness(new _e(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:bm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=bm({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?vm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),vm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:Gke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>we&&keEe&&TeAe&&CeMe&&PeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([Oa()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([Oa()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([Oa()],uT);const pT=new xa(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(hp).toService(hT)),i(dT)||(t(dT).toSelf(),t($v).toService(dT)),i(uT)||(t(uT).toSelf(),t($v).toService(uT))}));class gT extends Tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=se(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Vc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Tb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Ie(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=vm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new gl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==So.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===So.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,xo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=ti(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,l+c)||gt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new gl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Tb{getStartAngle(){return re(this._startAngle)}getEndAngle(){return re(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=vm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=vm.line;Y(i)[0].cornerRadius&&(t=vm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=vm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=vm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function lw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function hw(t,e,i,s){const n=bm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}const mw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},fw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,vw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class _w extends Tb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=mw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=vm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=vm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=vm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=vm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=vm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=vm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=vm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Lt(s[0])>Lt(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function yw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function bw(t,e){return Ie(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=He(t,i),r=He(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=ze(t),l=ze(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:te(t.angle);let m=i?t.angle+Pt:te(90-t.angle);const f=i?e.angle:te(e.angle);let v=i?e.angle+Pt:te(90-e.angle);m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Fe(n,i)+Fe(n,s))/2>Fe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Sw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Sw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function Aw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Mw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Cw(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ew(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),yw(e)}function ww(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Cw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function Ew(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Pw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Bw(){aM(),cM(),_M(),kM()}var Rw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Cw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Ew(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=te(e)})),Tw(i,t),!Mw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(kw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),yw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:xw[n]||xw.parity;if(s.length>=3&&Aw(s,r)){do{s=a(s,r)}while(s.length>=3&&Aw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&Sw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=vm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ei(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Lw.defaultAttributes=aw,U(Lw,Pw);class Ow{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return se(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Iw,Dw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=vm.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=vm.circle(t)}h.name=sw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},rw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Dw(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Fw.defaultAttributes=aw,U(Fw,Ow);class jw extends yc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=Tt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=Tt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:At(i,s)})),r=Tt.lastIndex;return r{Hw[t]=!0}));const Uw=t=>-Math.log(-t),Yw=t=>-Math.exp(-t),Kw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Xw=t=>10===t?Kw:t===Math.E?Math.exp:e=>Math.pow(t,e),$w=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Zw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Jw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Qw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eC(t,e,i,s){return 1===i&&(i=0),tC(t,i,s)*(e/(1-i))}function iC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class aC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=iC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const oC=Symbol("implicit");class lC extends aC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Iw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=oC}clone(){const t=(new lC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==oC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class cC extends lC{constructor(t){super(),this.type=Iw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=eC(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:hC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return hC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new cC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:dC}=xe;function uC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=_e.parseColorString(e)){const e=dC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?dC(t,e):e instanceof _e?dC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class pC extends aC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ww,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ww;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Ww,this._piecewise=Qw,this._interpolate=uC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?sC:Qw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Ww),this.rescale(i)):this._clamp!==Ww}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const gC=Math.sqrt(50),mC=Math.sqrt(10),fC=Math.sqrt(2),vC=[1,2,5,10],_C=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=SC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?bC(0,-(e-1)/s,s):bC((e-1)/s,0,s)},yC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return _C(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _C(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=bC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=bC(t,e,l);return n&&r.reverse(),r})),SC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vC[0];return i>=gC?s=vC[3]:i>=mC?s=vC[2]:i>=fC&&(s=vC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AC(t,e,i){const s=(e-t)/Math.max(0,i);return SC(s)}function kC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=AC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function TC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const wC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),EC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wC(t,e,n):wC(t,e,rC(n)),h=wC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),PC=ft(((t,e,i,s,n)=>kC(s(t),s(e),i).map((t=>rC(n(t))))));class BC extends pC{constructor(){super(...arguments),this.type=Iw.Linear}clone(){return(new BC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return yC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=xC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return kC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=TC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=MC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=MC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=MC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function RC(t){return e=>-t(-e)}function LC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class OC extends pC{constructor(){super($w(10),Xw(10)),this.type=Iw.Log,this._limit=LC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new OC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=$w(this._base),s=Xw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RC(i),this._pows=RC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Uw,this.untransformer=Yw):(this._logs=i,this._pows=s,this._limit=LC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Ww}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class IC extends BC{constructor(){super(qw(1),Zw(1)),this.type=Iw.Symlog,this._const=1}clone(){return(new IC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=qw(t),this.untransformer=Zw(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return CC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class DC{constructor(){this.type=Iw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new DC).domain(this._domain).range(this._range).unknown(this._unknown)}}const FC=t=>t.map(((t,e)=>({index:e,value:t}))),jC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Qt(t).expand(i/2),n=new Qt(e).expand(i/2);return s.intersects(n)};function zC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function HC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=te(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=NC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=NC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=NC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=NC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Qt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},GC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=se({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Qt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},WC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},UC=(t,e,i,s)=>VC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),YC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},KC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!YC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?KC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&jC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qC=(t,e)=>{if(Nw(t.type))return((t,e)=>{if(!Nw(t.type))return FC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return FC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=VC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&HC(n,i);)n=WC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return FC(h)})(t,e);if(Gw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?FC([s[s.length-1]]):FC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=UC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=XC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=UC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return FC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=GC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=$C(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return FC(c)})(t,e)}return FC(t.domain())};function ZC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=qt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function JC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=qt.distancePP(s,l),c=qt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=ZC(e,t,!1,!!n),o=ZC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class QC extends Tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=ZC(t,o,!1,!!a)}const u=vm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=gw(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=vm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(tE,Pw);var eE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(iE,Ow);const sE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",nE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},rE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var aE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(aE||(aE={}));var oE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=aE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=aE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=aE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===O_.env&&(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===aE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===aE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=aE.endHandler):h+=l:this._activeTag===aE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===aE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===O_.env&&(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=oE(i,["formatMethod"]),{formatMethod:a}=s,o=oE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Jt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},rE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},rE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},rE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},rE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Sy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var cE,dE,uE,pE;function gE(){aM(),tT()}function mE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function fE(t,e){const{dx:i,dy:s}=mE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}hE.defaultAttributes=nE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(cE||(cE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(dE||(dE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(uE||(uE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(pE||(pE={}));class vE extends Tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=mw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=vm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=vm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=vm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function _E(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function yE(t,e,i,s){t&&(_E(t.startSymbol,e,i,s),t.lines.forEach((t=>_E(t,e,i,s))),_E(t.line,e,i,s),_E(t.endSymbol,e,i,s))}function bE(t,e,i,s){t&&(_E(t.getTextShape(),e,i,s),_E(t.getBgRect(),e,i,s))}function xE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function SE(t,e,i,s){t&&(xE(t.startSymbol,e,i,s),t.lines.forEach((t=>xE(t,e,i,s))),xE(t.line,e,i,s),xE(t.endSymbol,e,i,s))}function AE(t,e,i,s){t&&(xE(t.getTextShape(),e,i,s),xE(t.getBgRect(),e,i,s))}function kE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;_E(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),_E(t.endSymbol,s+r+a,o,n),_E(e.getTextShape(),s+r+a+o,l,n),_E(e.getBgRect(),s+r+a+o,l,n)}function ME(t,e,i,s,n){yE(t,s,i,n),bE(e,s,i,n)}function TE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function wE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function CE(t,e,i,s,n,r){var a;yE(t,n,s,r),_E(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?bE(i,n,s,r):_E(i,n,s,r)}function EE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;_E(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),_E(e,n+o+l,h,r),_E(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(_E(i.getTextShape(),n+o+l+h+c,d,r),_E(i.getBgRect(),n+o+l+c,d,r)):_E(i,n+o+l+c,d,r)}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?kE(t,e,s,r,a):"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?kE(t,e,s,n,a):"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&wE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&wE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function LE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?CE(n,r,e,i,s,o):"callIn"===t&&EE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?CE(n,r,e,i,s,a):"callIn"===t&&EE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;SE(t,n,s,r),xE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AE(i,n,s,r):xE(i,n,s,r)}(n,r,e,t,i,s)}}const OE={type:"clipIn",duration:500,easing:"linear",delay:0},IE={type:"fadeIn",duration:500,easing:"linear",delay:0},DE={type:"callIn",duration:500,easing:"linear",delay:0},FE={type:"fadeOut",duration:500,easing:"linear",delay:0};class jE extends vE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=FE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;fE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const zE=.001,HE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:cE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},NE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},VE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:uE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},GE={interactive:!0,label:{position:dE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={interactive:!0,label:{position:uE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},UE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},YE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},KE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function XE(){$E._animate=PE}gE(),QT();class $E extends jE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$E.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,zE)||FM(Math.abs(e),3*Math.PI/2,zE)?jM(i,e,t):DM(e)?NE.postiveXAxis[t]:NE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function qE(){ZE._animate=BE}$E.defaultAttributes=HE,gE(),gM();class ZE extends vE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},YE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=vm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}ZE.defaultAttributes=GE,gE(),tw();class JE extends jE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case uE.arcInnerStart:l=s;case uE.arcOuterStart:l=s;break;case uE.arcInnerEnd:l=n;case uE.arcOuterEnd:l=n;break;case uE.center:case uE.arcInnerMiddle:case uE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return UE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}JE.defaultAttributes=VE,gE(),Jk();class QE extends vE{markerAnimate(t){QE._animate&&this._animationConfig&&QE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case uE.center:h=(i+s)/2,c=(n+r)/2;break;case uE.arcInnerStart:h=i,c=n;break;case uE.arcOuterStart:h=s,c=n;break;case uE.arcInnerEnd:h=i,c=r;break;case uE.arcOuterEnd:h=s,c=r;break;case uE.arcInnerMiddle:h=i,c=(n+r)/2;break;case uE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=vm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function tP(){eP._animate=LE}QE.defaultAttributes=WE,gE(),QT(),tw(),SM(),lM(),cM();class eP extends vE{markerAnimate(t){eP._animate&&this._animationConfig&&eP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=DE,this.defaultExitAnimation=FE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,zE)||FM(Math.abs(s),3*Math.PI/2,zE)?jM(t,s,n):DM(s)?KE.postiveXAxis[n]:KE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=pE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=vm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=vm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=vm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,zE)||FM(d,0,zE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(cP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(cP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===cP.focus||"focus"===o){const s=a.hasState(lP.focus);a.toggleState(lP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover,lP.focus],t),this._setLegendItemState(e,lP.selected,t)})):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover,lP.focus],t),this._setLegendItemState(e,lP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(lP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(lP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(hP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[lP.selected,lP.selectedHover],t),this._setLegendItemState(a,lP.unSelected,t)):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t))}else this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover],t),this._setLegendItemState(e,lP.unSelected,t))}))}this._dispatchLegendEvent(hP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,lP.selected),this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover])):(this._removeLegendItemState(e,[lP.selected,lP.selectedHover]),this._setLegendItemState(e,lP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=rP,spaceRow:h=aP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ei(c);let w;!1===x.visible?(w=vm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,cP.item,t,w)):(w=vm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,cP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?lP.selected:lP.unSelected);const C=vm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=vm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,cP.itemShape,t,w,S.state),s.addState(e?lP.selected:lP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=vm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,cP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,cP.itemLabel,t,w,A.state),D.addState(e?lP.selected:lP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,cP.itemValue,t,w,k.state),r.addState(e?lP.selected:lP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new nP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new nP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=vm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=rP,spaceRow:a=aP}=s,o=this._itemsContainer,{space:l=oP,defaultCurrent:h=1}=n,c=gP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=vm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(lP.selected)?this._setLegendItemState(t,lP.selectedHover,e):this._setLegendItemState(t,lP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===cP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(hP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(lP.unSelectedHover)||t.hasState(lP.selectedHover))&&(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(lP.unSelectedHover)&&!t.hasState(lP.selectedHover)||(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===cP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(hP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(lP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},mP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(lP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var vP;function _P(t){return y(t)?t:[t,t]}function yP(t){return t?"ew-resize":"ns-resize"}fP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:rP,spaceRow:aP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:oP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(vP||(vP={})),uP();class bP extends Tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:_P(d)[0],endValue:_P(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=vm.group({x:0,y:0});m.name=vP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=vm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=vP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=vm.group({x:g?v:0,y:g?0:v});m.add(_);const y=vm.group({x:0,y:0});let b;if(y.name=vP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=vm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=vP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=vm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=vP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=_P(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(v.name=vP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=vP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(i.name=vP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=vP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=vm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=vP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":yP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=vm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=vP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return vm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":yP(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),vm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=vm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=vm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===vP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===vP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===vP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===vP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}bP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},pP(),uP();class xP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function SP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}xP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},pP(),uP(),uM();class AP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},AP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=vm.group({x:0,y:0});this._innerView.add(x);const S=new bP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:SP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=vm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}AP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let kP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ei(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};kP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const MP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let TP=class extends Tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(MP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class wP extends Ag{constructor(t){super(t)}}var CP,EP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(CP||(CP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(EP||(EP={}));class PP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},PP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},PP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new wP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new wP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new wP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(CP.OnPlay)},this.pause=()=>{this._dispatchEvent(CP.OnPause)},this.forward=()=>{this._dispatchEvent(CP.OnForward)},this.backward=()=>{this._dispatchEvent(CP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}PP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},PP.defaultAttributes={[EP.Start]:{},[EP.Pause]:{},[EP.Backward]:{},[EP.Forward]:{}};const BP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},RP=[200,10];var LP,OP;!function(t){t.Default="default",t.Reverse="reverse"}(LP||(LP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(OP||(OP={}));const IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},DP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},FP=t=>"top"===t||"bottom"===t;class jP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(FP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:RP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:RP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new bP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return FP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new PP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=FP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:RP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(FP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:FP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:FP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function zP(){uP(),aM(),SM()}jP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},BP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},BP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},BP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},BP),{key:"backward",position:"start"})}},zP();class HP extends jP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:LP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(OP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||DP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===LP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(OP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(OP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(OP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(OP.change),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var NP,VP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};zP();class GP extends jP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(OP.change))},this.play=()=>VP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(OP.play),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(OP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(NP||(NP={}));const WP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},UP=5;const YP={debounce:xt,throttle:St};aM(),gM();let KP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:YP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(NP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(NP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(NP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=WP.trigger,updateTrigger:e=WP.updateTrigger,endTrigger:i=WP.endTrigger,resetTrigger:s=WP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Xe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(NP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(NP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=UP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=vm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},$P=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},qP={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Qt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ZP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let JP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ei(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Nc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>ZP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&yg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return XP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return XP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};JP.defaultAttributes=qP;const QP=pt;function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function eB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function iB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function sB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function nB(t,e){const i=sB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function rB(t,e){const i=aB(t),s=aB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function aB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function oB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function lB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const hB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var dB,uB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(dB||(dB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(uB||(uB={}));const pB="__VCHART",gB=500,mB=500,fB=`${pB}_LABEL_LIMIT`,vB=`${pB}_LABEL_ALIGN`,_B=`${pB}_LABEL_TEXT`,yB=`${pB}_LABEL_VISIBLE`,bB=`${pB}_LABEL_X`,xB=`${pB}_LABEL_Y`,SB=`${pB}_ARC_TRANSFORM_VALUE`,AB=`${pB}_ARC_RATIO`,kB=`${pB}_ARC_START_ANGLE`,MB=`${pB}_ARC_END_ANGLE`,TB=`${pB}_ARC_K`,wB=`${pB}_ARC_MIDDLE_ANGLE`,CB=`${pB}_ARC_QUADRANT`,EB=`${pB}_ARC_RADIAN`,PB=-Math.PI/2,BB=3*Math.PI/2,RB=-90,LB=.6;var OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB,XB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(OB||(OB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(IB||(IB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(DB||(DB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(FB||(FB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(jB||(jB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(zB||(zB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(HB||(HB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(NB||(NB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(VB||(VB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(GB||(GB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(WB||(WB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(UB||(UB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(YB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",YB.AFTER_EVALUATE_DATA="afterEvaluateData",YB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",YB.AFTER_EVALUATE_SCALE="afterEvaluateScale",YB.BEFORE_PARSE_VIEW="beforeParseView",YB.AFTER_PARSE_VIEW="afterParseView",YB.BEFORE_TRANSFORM="beforeTransform",YB.AFTER_TRANSFORM="afterTransform",YB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",YB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",YB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",YB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",YB.BEFORE_STAGE_RESIZE="beforeStageResize",YB.AFTER_STAGE_RESIZE="afterStageResize",YB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",YB.AFTER_VRENDER_DRAW="afterVRenderDraw",YB.BEFORE_MARK_JOIN="beforeMarkJoin",YB.AFTER_MARK_JOIN="afterMarkJoin",YB.BEFORE_MARK_UPDATE="beforeMarkUpdate",YB.AFTER_MARK_UPDATE="afterMarkUpdate",YB.BEFORE_MARK_STATE="beforeMarkState",YB.AFTER_MARK_STATE="afterMarkState",YB.BEFORE_MARK_ENCODE="beforeMarkEncode",YB.AFTER_MARK_ENCODE="afterMarkEncode",YB.BEFORE_DO_LAYOUT="beforeDoLayout",YB.AFTER_DO_LAYOUT="afterDoLayout",YB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",YB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",YB.BEFORE_DO_RENDER="beforeDoRender",YB.AFTER_DO_RENDER="afterDoRender",YB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",YB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",YB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",YB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",YB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",YB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",YB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",YB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",YB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",YB.BEFORE_ELEMENT_STATE="beforeElementState",YB.AFTER_ELEMENT_STATE="afterElementState",YB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",YB.AFTER_ELEMENT_ENCODE="afterElementEncode",YB.ANIMATION_START="animationStart",YB.ANIMATION_END="animationEnd",YB.ELEMENT_ANIMATION_START="elementAnimationStart",YB.ELEMENT_ANIMATION_END="elementAnimationEnd",YB.ALL_ANIMATION_START="allAnimationStart",YB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(KB||(KB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(XB||(XB={}));const $B="__vgrammar_scene_item__",qB=[DB.line,DB.area],ZB=[DB.arc3d,DB.rect3d,DB.pyramid3d],JB="key",QB=[{}],tR=["key"],eR=!0,iR=!0,sR=!1,nR=!0,rR="VGRAMMAR_IMMEDIATE_ANIMATION",aR=0,oR=1e3,lR=0,hR=0,cR=!1,dR=!1,uR="quintInOut",pR={stopWhenStateChange:!1,immediatelyApply:!0},gR="_mo_hide_";function mR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function fR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return mR(t.dependency,e);var i;return[]}function vR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function _R(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function yR(t,e){return bR(t)?t.output():e[t]}const bR=t=>t&&!u(t.grammarType),xR=t=>d(t)?t:e=>e[t];function SR(t){return!!(null==t?void 0:t.scale)}function AR(t){return!!(null==t?void 0:t.field)}function kR(t,e){if(!t)return[];let i=[];return t.scale&&(i=bR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(fR(t,e))}function MR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function TR(t,e,i,s,n){i&&(vR(i)?e.forEach((e=>{const n=_R(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case DB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case DB.group:case DB.rect:case DB.image:return["width","height","y1"].includes(e);case DB.path:case DB.shape:return["path","customPath"].includes(e);case DB.line:return"defined"===e;case DB.area:return["x1","y1","defined"].includes(e);case DB.rule:return["x1","y1"].includes(e);case DB.symbol:return"size"===e;case DB.polygon:return"points"===e;case DB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(SR(l)){const t=yR(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?gb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(AR(l)){const t=gb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=_R(l,s,e.datum,t)}))})))}function wR(t,e,i,s){if(!t)return null;if(vR(t))return _R(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(SR(h)){const t=yR(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?gb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(AR(h)){const t=gb(h.field);n[r]=t(e)}else n[r]=_R(h,s,e,i)})),n}class CR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let ER=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};ER._plotMarks={},ER._marks={},ER._components={},ER._graphicComponents={},ER._transforms={},ER._grammars={},ER._glyphs={},ER._animations={},ER._interactions={},ER._graphics={},ER.registerGlyph=(t,e,i,s,n)=>(ER._glyphs[t]=new CR(e,i,s,n),ER._glyphs[t]),ER.registerAnimationType=(t,e)=>{ER._animations[t]=e},ER.getAnimationType=t=>ER._animations[t],ER.registerInteraction=(t,e)=>{ER._interactions[t]=e},ER.registerGraphic=(t,e)=>{ER._graphics[t]=e},ER.getGraphicType=t=>ER._graphics[t],ER.createGraphic=(t,e)=>{const i=ER._graphics[t];return i?i(e):null};const PR=t=>!!DB[t];function BR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=ER.getGraphicType(e)?ER.createGraphic(e,i):ER.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const RR=t=>{t&&(t[$B]=null,t.release(),t.parent&&t.parent.removeChild(t))},LR=["fillOpacity"],OR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const IR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[DB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[DB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[DB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const DR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?IR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(LR.includes(r)?OR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{LR.includes(t)?OR(n,t,e):n[t]=e[t]}));return n},FR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),jR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],zR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(jR);function HR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?zR:jR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>FR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=NR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function NR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let VR=class{constructor(t){this.data=null,this.states=[],this.diffState=IB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));TR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?DR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[$B]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?DR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===IB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(RR(this.graphicItem),this.graphicItem[$B]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=xR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(_R(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===IB.unChange&&(this.diffState=IB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,gR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[gR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||this.useStates(this.states),this.mark.markType===DB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new gl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[OB.update],a=e[OB.enter],o=e[OB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===IB.enter?(a&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.update?((n&&a||i)&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.exit&&o&&(i&&TR(this,t,a,s,l),TR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)_b(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[DB.line,DB.area,DB.largeRects,DB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||MR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[OB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=NR(h),e===DB.line||e===DB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>MR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===DB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=HR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=NR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?HR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=wR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=HR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===DB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===DB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(RR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class GR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const WR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class UR extends GR{constructor(t,e){super(t,e),this.type=UR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}UR.type="element-select",UR.defaultOptions={state:XB.selected,trigger:"click"};class YR extends GR{constructor(t,e){super(t,e),this.type=YR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},YR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function KR(t){if(t)return t.type===Iw.Band?t.bandwidth():t.type===Iw.Point?t.step():void 0}YR.type="element-highlight",YR.defaultOptions={highlightState:XB.highlight,blurState:XB.blur,trigger:"pointerover",triggerOff:"pointerout"};class XR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const $R=()=>{U(UR,XR),ER.registerInteraction(UR.type,UR)},qR=()=>{U(YR,XR),ER.registerInteraction(YR.type,YR)},ZR=(t,e)=>bR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,JR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=ZR(n,e),i}),{}):t.map((t=>ZR(t,e))):t;let QR=-1;class tL extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++QR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(fR(this.spec[e],this.view)),this.spec[e]=t,this.attach(fR(t,this.view)),this.commit(),this}}const eL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=fR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},iL=(t,e)=>{const i=ER.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(mR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>eL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return eL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},sL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=iL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},nL={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class rL extends tL{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!nL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return nL[e.type](t,i,new ya(new va))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?fR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=fR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=fR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=bR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=sL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const aL="window",oL="view",lL={trap:!1},hL="width",cL="height",dL="viewWidth",uL="viewHeight",pL="padding",gL="viewBox",mL="autoFit";function fL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function vL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,fL(t,e,n,s)}class _L{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}return this.nodes.push(t),fL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,vL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class yL{constructor(t){this.list=[],this.ids={},this.idFunc=t||mb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class bL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new yL((t=>t.uid)),this._heap=new _L(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new yL((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const xL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===DB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class SL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Qd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{zl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new iy(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Qb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ix(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function AL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function kL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function ML(t,e,i,s,n){if(n===aL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{kL(t,AL(t),!1)}))}));const e=AL(t);kL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class TL extends tL{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?_R(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},PL=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class BL extends VR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return TR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[$B]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?DR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===IB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=DR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=IR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===DB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return qB.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)_b(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[$B]=null})),this.glyphGraphicItems=null),super.release()}}const RL=t=>t.markType===DB.glyph?new BL(t):new VR(t);function LL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JB,i?t.slice().sort(i):t.slice()),{keys:tR,data:s};const n=xR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class OL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?LL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const IL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const DL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class FL extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class jL extends yc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Nd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}xc.mode|=ko.SET_ATTR_IMMEDIATELY;let zL=0;const HL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof yc||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class NL{constructor(t,e,i){this.id=zL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!ER.getAnimationType(e.type))return null;const r=ER.getAnimationType(e.type)(t,n,i);return IL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?DL(t,0,n[i].from,0,s):void 0,e.to[i]=l?DL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),IL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=HL(o);return u(o)||HL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new jL(r.from,r.to,a,t.easing):void 0:new FL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new $c(a,e))}r>0&&t.wait(r)}}function VL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(GL(i,t[i]))})),e}function GL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:aR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:dR,loop:null!==(s=h.loop)&&void 0!==s?s:cR,controlOptions:z({},pR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:oR,delay:null!==(a=h.delay)&&void 0!==a?a:lR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:hR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:uR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:aR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:dR,loop:null!==(d=t.loop)&&void 0!==d?d:cR,controlOptions:z({},pR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:lR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:hR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:uR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function WL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class UL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class YL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=VL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=VL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==IB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=GL(rR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===IB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new NL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===IB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=_R(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=WL(t.startTime,e,n),o=WL(t.totalTime,e,n),l=WL(t.oneByOne,e,n),h=WL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=WL(t.delay,e,n),l=WL(t.delayAfter,e,n),h=null!==(i=WL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:WL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===IB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===IB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===rR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===IB.exit&&0===o[IB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class KL extends tL{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new YL(this,{}),this.differ=new OL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===IB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===UB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:QB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===DB.group)return;const e=LL(null!=t?t:QB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(IB.update,t,e,i)}encodeState(t,e,i,s){if(t===IB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(vR(n))this.detach(kR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(kR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(kR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(kR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(kR(i,this.view))):vR(e)?(this.spec.encode[t]=e,this.attach(kR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(kR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=sL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return qB.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==IB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===KB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!vR(n)&&Object.keys(n).forEach((t=>{SR(n[t])&&(e[t]=yR(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];vR(s)||Object.keys(s).forEach((t=>{AR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B];if((null==s?void 0:s.mark)===this){const i=ML(this.view,t,s,0,oL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new YL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=yR(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==DB.group){if(!this.graphicItem){const t=BR(this,DB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||ZB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==DB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=xR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>JB),a=xR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>JB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===IB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=IB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):RL(this),n.diffState===IB.exit&&(n.diffState=IB.enter,this.animate.getElementAnimators(n,IB.exit).forEach((t=>t.stop("start")))),n.diffState=IB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=IB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:QB;l||this.differ.setCurrentData(LL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=wR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{this.markType===DB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:BR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==DB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=xR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>JB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=RL(this);e.diffState=IB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=RL(this);i.diffState=IB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==DB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=BR(this,DB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==IB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:IR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=IB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&RR(this.graphicItem),this.detachAll(),super.release()}}let XL=class extends KL{constructor(t,e){super(t,DB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===DB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return IR.rect}evaluateJoin(t){if(!this.elements.length){const t=RL(this);t.updateData(JB,QB,(()=>""),this.view),this.elements=[t],this.elementMap.set(JB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return TR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:BR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function $L(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function qL(t,e){return Math.min(t<0?t+e:t-1,e)}function ZL(t,e,i){let s=qL(t,i),n=qL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=qL(Math.max(0,n-1),i)):n=qL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const JL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>$L(t,i))),u=l.map((t=>$L(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=ZL(e,i,r),{start:h,end:c}=ZL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Jt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},QL={[FB.axis]:0,[FB.legend]:1,[FB.slider]:2,[FB.player]:3,[FB.datazoom]:4},tO=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=QL[t.componentType])&&void 0!==s?s:1/0},eO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=yb(r.maxChildWidth,n.width()),o=yb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=EL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dtO(t)-tO(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==DB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=eO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(dL,o),i.updateSignal(uL,l),i.updateSignal(pL,h)}else eO(t,n,a,e);else"grid"===r.display&&JL(t,n,a);iO(n,e,i)}}))};class sO extends KL{constructor(t,e,i){super(t,DB.glyph,i),this.glyphType=e,this.glyphMeta=ER.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!ER.getGraphicType(DB.glyph))return;const s=ER.createGraphic(DB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(ER.getGraphicType(n[t])){const e=ER.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const nO=Symbol.for("key");class rO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=LL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=LL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=xR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:nO})),r=LL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:nO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==nO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=_R(i.animation.delay,n,o,l),d=_R(i.animation.duration,n,o,l),u=_R(i.animation.oneByOne,n,o,l),p=_R(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Td(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Sd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>kd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Md({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Tc,null!==(l=i.easing)&&void 0!==l?l:wc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new wd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Tc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Td(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class aO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class oO extends aO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===DB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===DB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===DB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===DB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class lO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class hO extends KL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=BR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?DB.richtext:DB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}hO.markType=DB.text;const cO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},dO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},uO=Object.assign({},cO);uO.axis=Object.assign({},uO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.circleAxis=Object.assign({},uO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.grid=Object.assign({},uO.grid,{style:{stroke:"#404349"}}),uO.circleGrid=Object.assign({},uO.circleGrid,{style:{stroke:"#404349"}}),uO.rectLabel=Object.assign({},uO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.lineLabel=Object.assign({},uO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.symbolLabel=Object.assign({},uO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.title=Object.assign({},uO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const pO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:dO,components:uO},gO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:dO,components:cO};let mO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};mO._themes=new Map,mO.registerTheme("default",gO),mO.registerTheme("dark",pO);class fO extends KL{constructor(t,e,i,s){super(t,DB.component,i),this._componentDatum={[JB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:ER.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,JB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[JB]+=1}evaluateJoin(t){return this.spec.key=JB,t?(t[JB]=this._componentDatum[JB],this._componentDatum=t):this._componentDatum={[JB]:this._componentDatum[JB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class vO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B],n=ML(0,t,s,0,oL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(bR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):PR(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new TL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new rL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=ER.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=ER.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case DB.group:n=new XL(this,s);break;case DB.glyph:n=new sO(this,null==i?void 0:i.glyphType,s);break;case DB.component:n=ER.hasComponent(null==i?void 0:i.componentType)?ER.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new fO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case DB.text:n=new hO(this,t,s);break;default:n=ER.hasMark(t)?ER.createMark(t,this,s):new KL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(DB.group,t)}glyph(t,e){return this.mark(DB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(DB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.grid,mode:e})}legend(t){return this.mark(DB.component,t,{componentType:FB.legend})}slider(t){return this.mark(DB.component,t,{componentType:FB.slider})}label(t){return this.mark(DB.component,t,{componentType:FB.label})}datazoom(t){return this.mark(DB.component,t,{componentType:FB.datazoom})}player(t){return this.mark(DB.component,t,{componentType:FB.player})}title(t){return this.mark(DB.component,t,{componentType:FB.title})}scrollbar(t){return this.mark(DB.component,t,{componentType:FB.scrollbar})}customized(t,e){const i=ER.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&CL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(RR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++wL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(mO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(hL,t.width),this.updateSignal(cL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=ER.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:hL,value:null!==(s=t[hL])&&void 0!==s?s:0},{id:cL,value:null!==(n=t[cL])&&void 0!==n?n:0},{id:pL,value:EL(null!==(a=null!==(r=t[pL])&&void 0!==r?r:e[pL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:dL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[hL]-i.left-i.right},dependency:[hL,pL]}},{id:uL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[cL]-i.top-i.bottom},dependency:[cL,pL]}},{id:gL,update:{callback:(t,e)=>{const i=EL(e[pL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[dL],i.top+e[uL])},dependency:[dL,uL,pL]}},{id:mL,value:null!==(o=t[mL])&&void 0!==o?o:e[mL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===DB.glyph?{glyphType:t.glyphType}:t.type===DB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=mO.getTheme(t))&&void 0!==e?e:mO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(hL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(cL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(uL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(pL);if(arguments.length){const i=EL(t);return this.updateSignal(e,i),i}return EL(e.output())}autoFit(t){const e=this.getSignalById(mL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(gL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=UB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===DB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||iO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{xL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),xL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=eR,morph:o=iR,morphAll:l=sR,animation:h={},enableExitAnimation:c=nR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:uR,delay:null!==(i=h.delay)&&void 0!==i?i:lR,duration:null!==(s=h.duration)&&void 0!==s?s:oR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:dR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=UB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=UB.reevaluate,this._dataflow.evaluate()),this._layoutState=UB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!CL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return xL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ii(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(hL,t)),e!==this.height()&&(s=!0,this.updateSignal(cL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):PR(t)?(i.markType=t,i.source=e):i.source=t===aL?aL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=mR(l,this),v=PL(((t,e)=>{const s=c===oL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===aL&&(t=ML(0,t,e,0,aL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===oL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,oL,d))return this.addEventListener(d,v,lL),()=>{this.removeEventListener(d,v)}}else if(c===aL)return O_.addEventListener(d,v),this._eventListeners.push({type:d,source:O_,handler:v}),()=>{O_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===O_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=ER.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new SL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new aO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new oO((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new bL,this.animate=new lO(this),this._morph=new rO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[oL,aL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:mO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&O_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==DB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&O_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),ER.unregisterRuntimeTransforms(),at.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _O=()=>{bM(),uM(),ER.registerGraphic(DB.path,Yg)},yO=()=>{bM(),fM(),ER.registerGraphic(DB.rect,Pg)},bO=()=>{bM(),cM(),ER.registerGraphic(DB.rule,wg)},xO=()=>{bM(),SM(),ER.registerGraphic(DB.symbol,kg)},SO=()=>{bM(),kM(),_M(),ER.registerGraphic(DB.text,yp)},AO=()=>{bM(),nM(),ER.registerGraphic(DB.glyph,Rg)},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},MO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},TO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Ab(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},wO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ab(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},CO=kO(TO),EO=MO(TO);const PO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ab(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},BO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ab(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},RO=kO(PO),LO=MO(PO);const OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},IO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},DO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?IO:OO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},jO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},zO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class HO extends fO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const NO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class VO extends HO{constructor(t,e,i){super(t,FB.axis,e),this.spec.componentType=FB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=wR(n,e,i,s);const h=_R(this.spec.inside,s,e,i),c=_R(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(NO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=_R(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case zB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case zB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?zB.circleAxis:zB.lineAxis,this._axisComponentType}}VO.componentType=FB.axis;let GO=class extends fO{constructor(t,e){super(t,FB.label,e),this.spec.componentType=FB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=_R(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=_R(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case DB.line:case DB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case DB.rect:case DB.rect3d:case DB.interval:g=p.rectLabel;break;case DB.symbol:case DB.circle:case DB.cell:g=p.symbolLabel;break;case DB.arc:case DB.arc3d:g=p.arcLabel;break;case DB.polygon:case DB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=wR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=wR(i,t,e,d);m.push(z({},f,s))}));else{const t=wR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};GO.componentType=FB.label;const WO=()=>{ER.registerGraphicComponent(FB.label,(t=>new JT(t))),ER.registerComponent(FB.label,GO)};class UO extends HO{constructor(t,e,i){super(t,FB.grid,e),this.spec.componentType=FB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=wR(s,t,e,i);const d=_R(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case HB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case HB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=_R(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(NO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===HB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=_R(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case HB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case HB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=HB.circleAxisGrid:this._gridComponentType=HB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case zB.circleAxis:this._gridComponentType=HB.circleAxisGrid;break;case zB.lineAxis:default:this._gridComponentType=HB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?HB.lineAxisGrid:HB.circleAxisGrid:HB.lineAxisGrid}else this._gridComponentType=HB.lineAxisGrid;return this._gridComponentType}}UO.componentType=FB.grid;const YO=(t,e,i)=>e.filter((e=>t.callback(e,i))),KO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function XO(t){return t.reduce(((t,e)=>t+e),0)}const $O={min:$,max:X,average:function(t){return 0===t.length?0:XO(t)/t.length},sum:XO};function qO(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function ZO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function JO(t,e,i,s){return ZO(t,e,i,"min",s)}function QO(t,e,i,s){return ZO(t,e,i,"max",s)}function tI(t,e,i,s){return ZO(t,e,i,"average",s)}function eI(t,e,i,s){return ZO(t,e,i,"sum",s)}const iI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=qO;if("min"===n?l=JO:"max"===n?l=QO:"average"===n?l=tI:"sum"===n&&(l=eI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const sI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(gR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(gR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(gR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},nI=()=>{ER.registerTransform("filter",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{ER.registerTransform("map",{transform:KO,markPhase:"beforeJoin"},!0)},aI=()=>{ER.registerTransform("sampling",{transform:iI,markPhase:"afterEncode"},!0)},oI=()=>{ER.registerTransform("markoverlap",{transform:sI,markPhase:"afterEncode"},!0)},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},hI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},cI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},dI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},pI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},xI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},SI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},AI=(t,e,i)=>({from:{points:SI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),kI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:SI(t,e)}}),MI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),TI=(t,e,i)=>({from:{points:MI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),wI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:MI(t,e,i)}}),CI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),EI=(t,e,i)=>({from:{points:CI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),PI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:CI(t,e,i)}}),BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},LI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},OI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},II={symbol:["_mo_hide_","visible"]},DI=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=II[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{_b(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},jI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},zI=()=>{ER.registerAnimationType("clipIn",lI)},HI=()=>{ER.registerAnimationType("clipOut",hI)},NI=()=>{ER.registerAnimationType("fadeIn",cI)},VI=()=>{ER.registerAnimationType("fadeOut",dI)},GI=()=>{ER.registerAnimationType("growCenterIn",uI)},WI=()=>{ER.registerAnimationType("growCenterOut",pI)},UI=()=>{ER.registerAnimationType("growHeightIn",fI)},YI=()=>{ER.registerAnimationType("growHeightOut",vI)},KI=()=>{ER.registerAnimationType("growWidthIn",gI)},XI=()=>{ER.registerAnimationType("growWidthOut",mI)},$I=()=>{ER.registerAnimationType("growPointsIn",AI)},qI=()=>{ER.registerAnimationType("growPointsOut",kI)},ZI=()=>{ER.registerAnimationType("growPointsXIn",TI)},JI=()=>{ER.registerAnimationType("growPointsXOut",wI)},QI=()=>{ER.registerAnimationType("growPointsYIn",EI)},tD=()=>{ER.registerAnimationType("growPointsYOut",PI)},eD=()=>{ER.registerAnimationType("growAngleIn",_I)},iD=()=>{ER.registerAnimationType("growAngleOut",yI)},sD=()=>{ER.registerAnimationType("growRadiusIn",bI)},nD=()=>{ER.registerAnimationType("growRadiusOut",xI)},rD=()=>{ER.registerAnimationType("moveIn",BI)},aD=()=>{ER.registerAnimationType("moveOut",RI)},oD=()=>{ER.registerAnimationType("scaleIn",LI)},lD=()=>{ER.registerAnimationType("scaleOut",OI)},hD=()=>{ER.registerAnimationType("rotateIn",FI)},cD=()=>{ER.registerAnimationType("rotateOut",jI)},dD=()=>{ER.registerAnimationType("update",DI)};class uD extends KL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=vR(e)?null:Object.keys(e).reduce(((t,s)=>(SR(e[s])&&(t[s]=yR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=wR(e,t,i,n);if(u(r.size)){const t=s.x?KR(s.x):void 0,e=s.y?KR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(IR.symbol)}release(){super.release(),this._encoders=null}}uD.markType=DB.cell;const pD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var gD,mD,fD;t.ChartEvent=void 0,(gD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",gD.rendered="rendered",gD.renderFinished="renderFinished",gD.animationFinished="animationFinished",gD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",gD.afterInitData="afterInitData",gD.afterInitEvent="afterInitEvent",gD.afterInitMark="afterInitMark",gD.rawDataUpdate="rawDataUpdate",gD.viewDataFilterOver="viewDataFilterOver",gD.viewDataUpdate="viewDataUpdate",gD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",gD.markDeltaYUpdate="markDeltaYUpdate",gD.viewDataLabelUpdate="viewDataLabelUpdate",gD.scaleDomainUpdate="scaleDomainUpdate",gD.scaleUpdate="scaleUpdate",gD.dataZoomChange="dataZoomChange",gD.drill="drill",gD.layoutStart="layoutStart",gD.layoutEnd="layoutEnd",gD.layoutRectUpdate="layoutRectUpdate",gD.playerPlay="playerPlay",gD.playerPause="playerPause",gD.playerEnd="playerEnd",gD.playerChange="playerChange",gD.playerForward="playerForward",gD.playerBackward="playerBackward",gD.scrollBarChange="scrollBarChange",gD.brushStart="brushStart",gD.brushChange="brushChange",gD.brushEnd="brushEnd",gD.brushClear="brushClear",gD.legendSelectedDataChange="legendSelectedDataChange",gD.legendFilter="legendFilter",gD.legendItemClick="legendItemClick",gD.legendItemHover="legendItemHover",gD.legendItemUnHover="legendItemUnHover",gD.tooltipShow="tooltipShow",gD.tooltipHide="tooltipHide",gD.tooltipRelease="tooltipRelease",gD.afterResize="afterResize",gD.afterRender="afterRender",gD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(mD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",mD.window="window",mD.canvas="canvas",t.Event_Bubble_Level=void 0,(fD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",fD.chart="chart",fD.model="model",fD.mark="mark";const vD=`${pB}_waterfall_default_seriesField`,_D=`${pB}_CORRELATION_X`,yD=`${pB}_CORRELATION_Y`,bD=`${pB}_CORRELATION_SIZE`,xD=`${pB}_MEASURE_CANVAS_ID`,SD=`${pB}_DEFAULT_DATA_INDEX`,AD=`${pB}_DEFAULT_DATA_KEY`,kD=`${pB}_DEFAULT_DATA_SERIES_FIELD`,MD=`${pB}_DEFAULT_SERIES_STYLE_NAME`;var TD;t.AttributeLevel=void 0,(TD=t.AttributeLevel||(t.AttributeLevel={}))[TD.Default=0]="Default",TD[TD.Theme=1]="Theme",TD[TD.Chart=2]="Chart",TD[TD.Base_Series=3]="Base_Series",TD[TD.Series=4]="Series",TD[TD.Mark=5]="Mark",TD[TD.User_Chart=6]="User_Chart",TD[TD.User_Series=7]="User_Series",TD[TD.User_Mark=8]="User_Mark",TD[TD.User_SeriesStyle=9]="User_SeriesStyle",TD[TD.Built_In=99]="Built_In";const wD=`${pB}_STACK_KEY`,CD=`${pB}_STACK_START`,ED=`${pB}_STACK_END`,PD=`${pB}_STACK_START_PERCENT`,BD=`${pB}_STACK_END_PERCENT`,RD=`${pB}_STACK_START_OffsetSilhouette`,LD=`${pB}_STACK_END_OffsetSilhouette`,OD=`${pB}_STACK_TOTAL`,ID=`${pB}_STACK_TOTAL_PERCENT`,DD=`${pB}_STACK_TOTAL_TOP`,FD=`${pB}_SEGMENT_START`,jD=`${pB}_SEGMENT_END`;var zD,HD;t.LayoutZIndex=void 0,(zD=t.LayoutZIndex||(t.LayoutZIndex={}))[zD.Axis_Grid=50]="Axis_Grid",zD[zD.CrossHair_Grid=100]="CrossHair_Grid",zD[zD.Region=450]="Region",zD[zD.Mark=300]="Mark",zD[zD.Node=400]="Node",zD[zD.Axis=100]="Axis",zD[zD.MarkLine=500]="MarkLine",zD[zD.MarkArea=100]="MarkArea",zD[zD.MarkPoint=500]="MarkPoint",zD[zD.DataZoom=500]="DataZoom",zD[zD.ScrollBar=500]="ScrollBar",zD[zD.Player=500]="Player",zD[zD.Legend=500]="Legend",zD[zD.CrossHair=500]="CrossHair",zD[zD.Indicator=500]="Indicator",zD[zD.Title=500]="Title",zD[zD.Label=500]="Label",zD[zD.Brush=500]="Brush",zD[zD.CustomMark=500]="CustomMark",zD[zD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(HD=t.LayoutLevel||(t.LayoutLevel={}))[HD.Indicator=10]="Indicator",HD[HD.Region=20]="Region",HD[HD.Axis=30]="Axis",HD[HD.DataZoom=40]="DataZoom",HD[HD.Player=40]="Player",HD[HD.ScrollBar=40]="ScrollBar",HD[HD.Legend=50]="Legend",HD[HD.Title=70]="Title",HD[HD.CustomMark=70]="CustomMark";const ND=["linear","radial","conical"],VD={x0:0,y0:0,x1:1,y1:1},GD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},WD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},UD={linear:VD,radial:GD,conical:WD},YD={label:{name:"label",type:"text"}},KD=`${pB}_rect_x`,XD=`${pB}_rect_x1`,$D=`${pB}_rect_y`,qD=`${pB}_rect_y1`,ZD={data:!0},JD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},QD=Object.assign(Object.assign({},YD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),tF=Object.assign(Object.assign({},YD),{bar3d:{name:"bar3d",type:"rect3d"}}),eF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},iF=Object.assign(Object.assign({},YD),eF),sF=Object.assign(Object.assign({},YD),{point:{name:"point",type:"symbol"}}),nF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),aF=Object.assign(Object.assign({},YD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},YD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),lF=Object.assign(Object.assign({},YD),{rose:{name:"rose",type:"arc"}}),hF=Object.assign(Object.assign({},YD),{area:{name:"area",type:"path"}}),cF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"}}),dF=Object.assign(Object.assign({},cF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),uF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),pF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),gF=Object.assign(Object.assign({},YD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),mF=Object.assign(Object.assign({},YD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},YD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),vF=Object.assign(Object.assign({},YD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),_F=Object.assign(Object.assign({},QD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),yF=Object.assign(Object.assign({},YD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),bF=Object.assign(Object.assign({},YD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),xF=Object.assign(Object.assign({},YD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),SF=Object.assign(Object.assign({},cF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),AF=Object.assign(Object.assign({},YD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),kF=Object.assign(Object.assign({},YD),{sunburst:{name:"sunburst",type:"arc"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},tF),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),wF=Object.assign(Object.assign({},YD),{circlePacking:{name:"circlePacking",type:"arc"}}),CF=Object.assign(Object.assign({},YD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),EF=Object.assign(Object.assign({},YD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),PF=Object.assign({},nF),BF=Object.assign(Object.assign({},YD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),RF=Object.assign(Object.assign({},YD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var LF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(LF||(LF={}));const OF={[dB.bar]:QD,[dB.bar3d]:tF,[dB.line]:iF,[dB.scatter]:sF,[dB.area]:nF,[dB.radar]:rF,[dB.pie]:aF,[dB.pie3d]:oF,[dB.rose]:lF,[dB.geo]:YD,[dB.map]:hF,[dB.circularProgress]:dF,[dB.link]:uF,[dB.dot]:pF,[dB.wordCloud]:gF,[dB.wordCloud3d]:gF,[dB.funnel]:mF,[dB.funnel3d]:fF,[dB.linearProgress]:vF,[dB.waterfall]:_F,[dB.boxPlot]:yF,[dB.treemap]:bF,[dB.sankey]:xF,[dB.gauge]:SF,[dB.gaugePointer]:AF,[dB.sunburst]:kF,[dB.rangeColumn]:MF,[dB.rangeColumn3d]:TF,[dB.circlePacking]:wF,[dB.heatmap]:CF,[dB.correlation]:EF,[dB.rangeArea]:PF,[dB.liquid]:BF,[dB.venn]:RF};function IF(t){var e,i;const{type:s}=t;return s===dB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const DF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},FF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function jF(t,e){var i;if(!t)return[];const s=UF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?GF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>VF(i)?HF(t,i,e):i)).filter(p)}))):i.map((i=>VF(i)?HF(t,i,e):i)).filter(p):[]}return[]}function zF(t,e){var i,s;return GF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function HF(t,e,i){var s;const n=UF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=DF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=FF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new _e(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ce(t,i,s),a=he(n,r,e.l),l=new _e(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const NF=(t,e,i)=>{if(e&&VF(t)){const s=HF(e,t,i);if(s)return s}return t};function VF(t){return t&&"palette"===t.type&&!!t.key}function GF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function WF(t){return y(t)?{dataScheme:t}:t}function UF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=IF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class YF extends lC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!GF(this._range))return void super.range(this._range);const t=zF(this._range,this._domain);super.range(t)}}const KF={linear:BC,band:cC,point:class extends cC{constructor(t){super(!1),this.type=Iw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:lC,threshold:DC,colorOrdinal:YF};function XF(t){const e=KF[t];return e?new e:null}function $F(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function qF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ZF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function JF(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function QF(t,e,i,s=0){var n,r;return S(t)?t:JF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function tj(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=QF(t[s],e.size,i)}))})),o}function ej(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||JF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ij(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sj=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},nj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],rj={default:{dataScheme:nj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},aj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",oj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:aj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:aj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:RB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},lj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},hj=Object.assign(Object.assign({},lj),{label:{space:0}}),cj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},dj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",uj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},pj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},gj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},mj={horizontal:Object.assign(Object.assign({},pj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj}),vertical:Object.assign(Object.assign({},pj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj})},fj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},vj={horizontal:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj}),vertical:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj})},_j={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},bj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function xj(t,e){return t&&e.key in t?t[e.key]:e.default}function Sj(t){return t&&"token"===t.type&&!!t.key}const Aj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},kj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:rj,token:Aj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:oj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:mj,sizeLegend:vj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:lj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:hj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:yj,markArea:_j,markPoint:bj,polarMarkLine:yj,polarMarkArea:_j,polarMarkPoint:bj,geoMarkPoint:bj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:uj,crosshair:cj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},Mj={name:"dark",colorScheme:{default:{dataScheme:nj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Tj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Tj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Tj(t[i],e[i])))),wj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),wj(t[s],e.slice(1),i))};function Cj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof ya||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=Cj(n,e)}return s}function Ej(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Pj(t,e,r,i):Bj(t,r,s[r])}}}}function Pj(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Rj({},t[n][e.index],i):i):t[n]=s?Rj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Rj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Rj({},t[n],i):i)}))}function Oj(t,...e){return Rj(Ij(t),...e.map(Ij))}function Ij(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=WF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(OF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Dj(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Dj(t,e,i,s){if(!OF[e])return t;const n={};return Object.values(OF[e]).forEach((({type:e,name:r})=>{n[r]=Rj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Fj=["animationThreshold","colorScheme","name","padding"];function jj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Fj.includes(r)?n[r]=a:f(a)?VF(a)?n[r]=NF(a,e,s):Sj(a)?n[r]=xj(i,a):n[r]=jj(a,e,i,s):n[r]=a})),n}const zj={[kj.name]:kj},Hj=kj.name,Nj=new Map(Object.keys(zj).map((t=>[t,zj[t]]))),Vj=new Map(Object.keys(zj).map((t=>[t,jj(zj[t])]))),Gj=new Map(Object.keys(zj).map((t=>[t,t===Hj]))),Wj=(t,e)=>{if(!t)return;const i=Xj(e);Nj.set(t,i),Vj.set(t,jj(i)),Gj.set(t,!0)},Uj=(t=Hj,e=!1)=>(Gj.has(t)&&!Gj.get(t)&&Wj(t,Nj.get(t)),e?Vj.get(t):Nj.get(t)),Yj=t=>Nj.delete(t)&&Vj.delete(t)&&Gj.delete(t),Kj=t=>!!_(t)&&Nj.has(t),Xj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Hj;return Oj({},Uj(i),t)};class $j{static registerInstance(t){$j.instances.set(t.id,t)}static unregisterInstance(t){$j.instances.delete(t.id)}static getInstance(t){return $j.instances.get(t)}static instanceExist(t){return $j.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return $j.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}$j.instances=new Map;class qj{static registerTheme(t,e){Wj(t,e)}static getTheme(t,e=!1){return Uj(t,e)}static removeTheme(t){return Yj(t)}static themeExist(t){return Kj(t)}static getDefaultTheme(){return qj.themes.get(Hj)}static setCurrentTheme(t){qj.themeExist(t)&&(qj._currentThemeName=t,$j.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return qj.getTheme(qj._currentThemeName,t)}static getCurrentThemeName(){return qj._currentThemeName}}function Zj(t,e){return _(t)?qj.themeExist(t)?qj.getTheme(t,e):{}:g(t)?t:{}}function Jj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}function Qj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Qj(t[s],e)}return i}return y(t)?t.map((t=>Qj(t,e))):t}qj.themes=Nj,qj._currentThemeName=Hj;function tz(t,e){for(let i=0;it.key===e))}function iz(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},lz(t,a,n[o],l,e,r))})),s?nz(n):n}function nz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nz(t[e].nodes);return t}function rz(t,e){if("values"in t&&t.values.length){const i=iB(t.values,e),s=eB(t.values,BD);t.values.forEach((t=>{t[OD]=i,t[ID]=s,delete t[DD]}));const n=t.values.reduce(((t,e)=>e[ED]>t[ED]?e:t));n[DD]=!0}else for(const i in t.nodes)rz(t.nodes[i],e)}function az(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ED]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[CD]=s,s+=r[ED],r[ED]=s):(r[CD]=n,n+=r[ED],r[ED]=n),r[wD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r,l[BD]=0===h?0:Math.min(1,l[ED]/h)*r}}for(const s in t.nodes)oz(t.nodes[s],e,i)}function lz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[ED]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),lz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const hz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mz(t.style(e,i,s,n)):B(t.style)||(e.style=mz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mz(t.state[e]))})),e.state=i}return e}function pz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e,s,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}function gz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mz(i)}function mz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class fz{static registerChart(t,e){fz._charts[t]=e}static registerSeries(t,e){fz._series[t]=e}static registerComponent(t,e,i){fz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){fz._marks[t]=e}static registerRegion(t,e){fz._regions[t]=e}static registerTransform(t,e){fz.transforms[t]=e}static registerLayout(t,e){fz._layout[t]=e}static registerAnimation(t,e){fz._animations[t]=e}static registerImplement(t,e){fz._implements[t]=e}static registerChartPlugin(t,e){fz._chartPlugin[t]=e}static registerComponentPlugin(t,e){fz._componentPlugin[t]=e}static createChart(t,e,i){if(!fz._charts[t])return null;return new(0,fz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!fz._charts[t])return null;const i=fz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!fz._regions[t])return null;return new(0,fz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!fz._regions[t])return null;return new(0,fz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!fz._series[t])return null;return new(0,fz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!fz._series[t])return null;return new(0,fz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!fz._marks[t])return null;const s=new(0,fz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(fz._components)}static getComponentInKey(t){return fz._components[t].cmp}static getLayout(){return Object.values(fz._layout)}static getLayoutInKey(t){return fz._layout[t]}static getSeries(){return Object.values(fz._series)}static getSeriesInType(t){return fz._series[t]}static getRegionInType(t){return fz._regions[t]}static getAnimationInKey(t){return fz._animations[t]}static getImplementInKey(t){return fz._implements[t]}static getSeriesMarkMap(t){return fz._series[t]?fz._series[t].mark:{}}static getChartPlugins(){return Object.values(fz._chartPlugin)}static getComponentPlugins(){return Object.values(fz._componentPlugin)}static getComponentPluginInType(t){return fz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}fz._charts={},fz._series={},fz._components={},fz._marks={},fz._regions={},fz._animations={},fz._implements={},fz._chartPlugin={},fz._componentPlugin={},fz.transforms={fields:Or,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},fz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},fz._layout={};const vz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},_z=(t,e,i,s)=>{var n;const r=Gw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:yz(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,bz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},xz=(t,e)=>{if(!t)return null;const{x:i,y:s}=e,n=bz(t,(t=>"angle"===t.getOrient()),e),r=bz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Gw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=rB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=aB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=_z(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Gw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=rB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=aB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=_z(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function Sz(t){return"bottom"===t||"top"===t}function Az(t){return"left"===t||"right"===t}function kz(t){return"z"===t}function Mz(t,e){return ZF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Tz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function wz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Sz(t)?"linear":"band":Sz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Cz=t=>t.fieldX[0],Ez=t=>t.fieldY[0],Pz=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Bz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Rz=(t,e)=>t?e?Cz:Pz:e?Ez:Bz,Lz=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=bz(t,(t=>Sz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=bz(t,(t=>Az(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Gw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Oz(s,i,t,Rz(e,Gw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Oz(s,i,t,Rz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Oz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Iz(t,a,s)},Iz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=_z(e,t,"cartesian",null!=i?i:Sz(t.getOrient())?Cz:Ez);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Dz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Lz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=xz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Gw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return Sz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Iz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Fz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Fz||(Fz={}));const jz={[Fz.dimensionHover]:class extends Dz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!vz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Fz.dimensionClick]:class extends Dz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let zz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(jz[t]){const e=new jz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(jz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Hz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Nz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Vz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new Hz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Nz[a]&&(a=Nz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=St(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=xt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return pD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&ER.hasInteraction(e)}}function Gz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Wz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Uz=new Map;let Yz;function Kz(){Yz||(Yz=new va,Wz(Yz,"geojson",da),Wz(Yz,"topojson",pa),Gz(Yz,"simplify",Rr))}function Xz(t,e,i={type:"geojson",centroid:!0}){Uz.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),Kz();const s=new ya(Yz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Uz.set(t,s)}function $z(t){Uz.has(t)?Uz.delete(t):Jy(`map type of '${t}' does not exists.`)}function qz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Zz=(t,e)=>0===t.length?[]:1===t.length?qz(t[0],null==e?void 0:e.deep):t.map((t=>qz(t,null==e?void 0:e.deep)));function Jz(t,e,i){Gz(e=e instanceof va?e:t.dataSet,"copyDataView",Zz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:eH.copyDataView}),s}function Qz(t,e,i=[],s={}){var n,r,a;if(t instanceof ya)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new ya(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Qy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Qy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Jy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function tH(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var eH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(eH||(eH={}));const iH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:oH(this._option.mode),autoFit:!1,eventConfig:{gesture:nb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(O_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=O_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function hH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function cH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Rj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function dH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ii(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function uH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function pH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(rH||(rH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aH||(aH={}));class gH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},gH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}gH.defaultMarkInfo={};class mH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gH,this._markReverse=new gH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(rH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(rH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[rH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[rH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Fz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const fH={};Object.values(rH).forEach((t=>{fH[t]=!0}));const vH={[rH.STATE_HOVER]:rH.STATE_HOVER_REVERSE,[rH.STATE_SELECTED]:rH.STATE_SELECTED_REVERSE,[rH.STATE_DIMENSION_HOVER]:rH.STATE_DIMENSION_HOVER_REVERSE};function _H(t){return vH[t]}class yH{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=_H(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=_H(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=_H(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=_H(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class bH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class xH extends bH{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class SH extends xH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=nH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class AH extends bH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new SH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class kH extends AH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class MH extends kH{constructor(){super(...arguments),this.id=ob(),this.stateKeyToSignalName=t=>`${pB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===sH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===sH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?sH.none:sH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?sH.exit:"update"===e.diffState?sH.update:sH.appear}}}}class TH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Rj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class wH extends bH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=TH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new gH,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${pB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=fz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class CH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=tj(ej(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class EH extends wH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new CH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class PH extends TH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BH extends EH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=PH,this.modelType="region",this.specKey="region",this.type=BH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new yH,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new mH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aH)B(t.stateStyle[aH[e]])||this.interaction.registerMark(aH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function RH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function LH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function OH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function IH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),OH(c,!0,u,o),s&&LH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function DH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),OH(c,!1,u,a),s&&LH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function jH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"left"),n.length&&IH(n,e,i,!0,"left"),r.length&&DH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"top"),n.length&&FH(n,e,i,!0,"top"),r.length&&jH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"right"),n.length&&IH(n,e,i,!0,"right"),r.length&&DH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"bottom"),n.length&&FH(n,e,i,!0,"bottom"),r.length&&jH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}zH.type="base";const HH=["line","area","trail"];function NH(t){return HH.includes(t)}class VH extends kH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(NH)?s:!t.mark||NH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!fH[t])).map((t=>[t,10])),s=!t.mark||NH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(pB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(pB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(Nw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class GH extends xH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=nH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class WH extends GH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${pB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class UH extends xH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=nH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new VH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new zz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new WH(t)}stateKeyToSignalName(t){return`${pB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=rH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=rH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===sH.appear&&this.runAnimationByState(sH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(sH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class YH extends UH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,te)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Rj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=XF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):ND.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Vw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},UD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=_e.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)ND.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class KH extends YH{constructor(){super(...arguments),this.type=KH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}KH.type="group";const XH=()=>{bM(),aM(),ER.registerGraphic(DB.group,Cu),fz.registerMark(KH.type,KH)},$H={type:"fadeIn"};function qH(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return $H;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ZH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},JH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},QH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},tN=()=>{fz.registerAnimation("scaleInOut",(()=>JH))},eN=()=>{fz.registerAnimation("fadeInOut",(()=>QH))},iN=(t,e)=>({appear:qH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Wc,duration:ZH.update.duration,easing:ZH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),sN=()=>{fz.registerAnimation("line",iN)},nN=()=>{vO.useRegisters([$I,qI,ZI,JI,QI,tD,zI,HI])},rN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Aj.fontFamily,fontSize:Aj.fontSize}))(e,i,s).measure(t)};class aN{static instance(){return aN.instance_||(aN.instance_=new aN),aN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class oN{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class lN extends oN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class hN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>fz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>fz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>fz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return fz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>fz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){fz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}static getFunction(t){return t?aN.instance().getFunction(t):null}static getFunctionList(){return aN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=fz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=fz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Uz.get(e);var e}static hideTooltip(t=[]){$j.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=xt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=sb(p);v?Rx(th):"node"===p&&PA(th),v&&d&&(this._container=_(d)?O_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=qj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new lH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Vz(this,this._compiler),this._event=new zz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),$j.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Rj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Jj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;hN.getFunctionList()&&hN.getFunctionList().length&&(t=Qj(t,hN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=fz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return dH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:gB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:mB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof va?t:new va,Wz(this._dataSet,"dataview",ga),Wz(this._dataSet,"array",s),Gz(this._dataSet,"stackSplit",iH),Gz(this._dataSet,"copyDataView",Zz);for(const t in fz.transforms)Gz(this._dataSet,t,fz.transforms[t]);for(const t in fz.dataParser)Wz(this._dataSet,t,fz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(d=this._compiler)||void 0===d||d.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?sH.appear:sH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,$j.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof ya?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Qz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=uH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Rj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=Zj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Oj({},Zj(this._currentThemeName,!0),Zj(s,!0),Zj(n,!0));this._currentTheme=t}else{const t=Oj({},Zj(this._currentThemeName),Zj(s),Zj(n));this._currentTheme=jj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Zj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield hH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ij(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ij(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return aN.instance().getFunction(t)}registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}getFunctionList(){return aN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=fz.getChartPlugins();t.length>0&&(this._chartPlugin=new lN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}hN.InstanceManager=$j,hN.ThemeManager=qj,hN.globalConfig={uniqueTooltip:!0},hN.Utils=rN,hN.vglobal=O_;fz.registerRegion("region",BH),fz.registerLayout("base",zH),XH(),vO.useRegisters([nI,rI]),vO.useRegisters([oD,lD,NI,VI,rD,aD,hD,cD,dD]),qR(),$R(),Wj(Mj.name,Mj),at.getInstance(rt.Error);const cN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(dB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=fz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=fz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},dN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=cN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Tj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Rj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Rj(m,f),hasChanged:!0};const i=Rj({},t,f);wj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class uN{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const pN=t=>{fz.registerChartPlugin(t.type,t)};class gN extends uN{constructor(){super(gN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[gN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[gN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=Cj(this._option.globalInstance.getSpec(),["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Cj(this._baseChartSpec,["data",gN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=dN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=Cj(i,["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}gN.pluginType="chart",gN.specKey="media",gN.type="MediaQueryPlugin";const mN=/\{([^}]+)\}/,fN=/\{([^}]+)\}/g,vN=/:/;class _N extends uN{constructor(){super(_N.type),this.type="formatterPlugin",this._timeModeFormat={utc:di.getInstance().timeUTCFormat,local:di.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=yi.getInstance().format,this._numericSpecifier=yi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[_N.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),fz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=mN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(fN,((t,i)=>{if(!vN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(fi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}_N.pluginType="chart",_N.specKey="formatter",_N.type="formatterPlugin";const yN=()=>{pN(_N)};function bN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function xN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function SN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function AN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function kN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function MN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const TN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return FC(v)};class wN extends uN{constructor(){super(wN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Nw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&bN(c)&&bN(d)))return;const u=xN(t,c),p=xN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!AN(u,p))return}else if(0===y&&0===b){if(!AN(p,u))return}else if(_||A)if(_&&!A){if(!SN(u,p))return}else if(A&&!_){if(!SN(p,u))return}else{if(m===b)return;if(m>b){if(!kN(u,p))return}else if(!kN(p,u))return}else{if(0===m&&0===y){if(!MN(u,p))return}else if(0===b&&0===g&&!MN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Gz(e.getOption().dataSet,"tickAlign",TN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}wN.pluginType="component",wN.type="AxisSyncPlugin";const CN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,EN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ym||(ym=vm.CreateGraphic("richtext",{})),ym.setAttributes(a),ym.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},PN="vchart-tooltip-container",BN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function RN(t,e){return R(e,`component.${t}`)}function LN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=fz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const ON={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function IN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function DN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function FN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function jN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?RN("axisBand",i):["linear","log","symlog"].includes(e)?RN("axisLinear",i):{})&&void 0!==s?s:{},r=Sz(t)?RN("axisX",i):Az(t)?RN("axisY",i):RN("axisZ",i);return Rj({},RN("axis",i),n,r)},HN=(t,e,i)=>{var s;const n=null!==(s="band"===e?RN("axisBand",i):"linear"===e?RN("axisLinear",i):{})&&void 0!==s?s:{},r=RN("angle"===t?"axisAngle":"axisRadius",i);return Rj({},RN("axis",i),n,r)},NN=t=>"band"===t||"ordinal"===t||"point"===t;function VN(t,e){return{id:t,label:t,value:e,rawValue:t}}function GN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function WN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const UN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Gw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Nw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=WN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=IN(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Gw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Nw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=WN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=IN(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(KN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&YN(t,"top",r.label),e.visible&&YN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(KN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&YN(t,"left",a.label),e.visible&&YN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},YN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=LN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},KN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},XN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=qN(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},$N=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=qN(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},qN=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},ZN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},JN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},QN=(t,e)=>{var i,s;return null!==(s=null===(i=JN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},tV=(t,e)=>{var i,s;return null!==(s=null===(i=JN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},eV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=UN(3,e,i,s,n,r,a);return o?XN(r,o,d,h):l?$N(a,l,u,c):void 0},iV={fontFamily:Aj.fontFamily,spacing:10,wordBreak:"break-word"};function sV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:iV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},rV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,aV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),oV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function lV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=hV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>aV(i,s)(t)&&aV(n,r)(t)&&(u(a)||aV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(u.id),d}return"none"}const hV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=rV(c,t);let _=rV(d,t);const y=oV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(aV(c,v));if(!y&&(_=rV(d,i),!oV(_)))return;const n=e.type===dB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Gw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(aV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=rV(d,o),!oV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(aV(c,n));if(!y&&(_=rV(d,r),!oV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===dB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(aV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=rV(d,i),!oV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},cV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const dV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class uV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class pV extends uV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:mV(e.title,{seriesId:this.series.id},!0),content:fV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=cV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const gV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},mV=(t,e,i)=>p(t)?d(t)?(...s)=>gV(t(...s),e,i):gV(t,e,i):void 0,fV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>gV(t,e,i))):gV(t,e,i))):void 0;return s},vV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=dV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=dV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},_V=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=yV(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&cV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},yV=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),bV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},xV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=LN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},AV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class kV{}kV.dom=`${pB}_TOOLTIP_HANDLER_DOM`,kV.canvas=`${pB}_TOOLTIP_HANDLER_CANVAS`;const MV=20,TV={key:"其他",value:"..."},wV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=di.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},CV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=AV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==SV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:wV(SV(c,t,i,v),p,g),valueStyle:SV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=MV}=t,x=t.othersLine?Object.assign(Object.assign({},TV),t.othersLine):TV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=EV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=EV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},EV=(t,e,i)=>{const s=wV(SV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=wV(SV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==SV(e.visible,t,i)&&(p(s)||p(n)),a=SV(e.isKeyAdaptive,t,i),o=SV(e.spaceRow,t,i),l=SV(e.shapeType,t,i),h=SV(e.shapeColor,t,i),c=SV(e.shapeFill,t,i),d=SV(e.shapeStroke,t,i),u=SV(e.shapeLineWidth,t,i),g=SV(e.shapeHollow,t,i),m=SV(e.keyStyle,t,i),f=SV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class PV extends uN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=AV(x.position,b,e),M=null!==(n=AV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:gB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:mB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(sb(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=CN(t,e),j=CN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=eV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(QN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=eV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(tV(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=ZN(t,c),N=ZN(i,c),V=ZN(e,c),G=ZN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=ZN(t,c):Y(t),S(e)||d(e)?N=ZN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(QN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(tV(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,sb(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===QN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===QN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===tV(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===tV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(QN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(tV(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,St(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},BN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:BN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:BN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ei(d.padding),x=ej(d.padding),S=sV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=sV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=sV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:nV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Rj({},A,sV(b,void 0,{})),{width:s,height:n,text:r}=EN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Rj({},k,sV(x,void 0,{})),{width:e,height:s,text:n}=EN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Rj({},S,sV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=EN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(sb(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=CN(t,s),u=CN(l,c)}return s*=d,n*=d,sb(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(De(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Xe([c,a,o],r.x,r.y)||Xe([c,l,h],r.x,r.y)||Xe([c,a,h],r.x,r.y)||Xe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}PV.specKey="tooltip";const BV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",RV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let LV;const OV=(t=document.body)=>{if(u(LV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),LV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return LV};function IV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Rj({},e,t),s={};return s.width=BV(i),s}(C),R=DV(E),L=DV(P),{bottom:O,left:I,right:D,top:F}=ej(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:BV(T+2*M),minHeight:BV(g+2*M),paddingBottom:BV(O),paddingLeft:BV(I),paddingRight:BV(D),paddingTop:BV(F),borderColor:k,borderWidth:BV(M),borderRadius:BV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?BV(null==r?void 0:r.spaceRow):"0px"},DV(Rj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return FV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=FV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==ib?void 0:ib.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(FV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}FV.type="tooltipModel";const jV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},zV={boxSizing:"border-box"},HV={display:"inline-block",verticalAlign:"top"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},GV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},WV={lineHeight:"normal",boxSizing:"border-box"};class UV extends FV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=RV(u),y=t=>new Ag({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class YV extends FV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const KV={overflowWrap:"normal",wordWrap:"normal"};class XV extends FV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Rj({},HV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Rj({},o?VV:NV,Object.assign(Object.assign(Object.assign({height:BV(l)},KV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Rj({},GV,Object.assign(Object.assign(Object.assign({height:BV(s)},KV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Rj({},WV,Object.assign(Object.assign({height:BV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class $V extends FV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new XV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Rj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+RV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+OV(this._option.getContainer())}px`,maxHeight:BV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class qV extends FV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new UV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new YV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Rj({},jV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const ZV="99999999999999";class JV extends FV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:ZV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new qV(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new $V(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Rj({},zV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const QV=t=>{fz.registerComponentPlugin(t.type,t)};class tG extends PV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(tG.type),this.type=kV.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(ib&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=IV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!si(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}tG.type=kV.dom;class eG extends PV{constructor(){super(eG.type),this.type=kV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new JP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}eG.type=kV.canvas;const iG=()=>{QV(eG)},sG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},nG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tz([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return aG(a,n,o)},aG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t};class lG extends GH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hG=`${pB}_HIERARCHY_DEPTH`,cG=`${pB}_HIERARCHY_ROOT`,dG=`${pB}_HIERARCHY_ROOT_INDEX`;function uG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pG(t,e,i){t&&(i.needDefaultSeriesField&&(t[kD]=i.defaultSeriesField),t[SD]=e,t[AD]=i.getKey(t,e,i))}function gG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mG(t,e,i,s=0,n,r){void 0===r&&(r=e),pG(t,e,i),t[hG]=s,t[cG]=n||t[i.categoryField],t[dG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mG(e,s,i,t[hG]+1,t[cG],r)))}const fG=["appear","enter","update","exit","disappear","normal"];function vG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return SG(n)&&delete n.type,n.oneByOne&&(n=yG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Rj({},o[e],a);return SG(n)&&delete n.type,n.oneByOne&&(n=yG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function _G(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),AG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function yG(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function bG(t,e){var i,s;return null!==(i=null==t?void 0:t[SD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function xG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function SG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function AG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),AG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),AG(t[i],e)}function kG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class MG extends TH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=IF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Dj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Rj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Rj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Rj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class TG extends wH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${pB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=MG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=kG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"invalidTravel",oG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Qz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Jz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Jz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=aG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Gz(this._dataSet,"dimensionStatistics",rG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ya(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tz(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Gz(this._dataSet,"dimensionStatistics",rG);const s=new ya(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tz(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tz(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ya(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",sG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=vG({},_G(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Rj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Rj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:rH.STATE_HOVER_REVERSE,highlightState:rH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:rH.STATE_SELECTED_REVERSE,state:rH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:kD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:MD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,MD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new pV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},ZD),JD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>JD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ya||tH(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();kG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:kD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new YF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return jF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:kD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Rj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:AD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ED&&t!==BD&&t!==CD&&t!==PD||(t=this.getStackValueField()),null!==(e=iz(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=OF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:kD]}}function wG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Nw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function CG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}TG.mark=YD,TG.transformerConstructor=MG;class EG extends TG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Nw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${pB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(BD),this.setFieldX2(PD)):(this.setFieldY(BD),this.setFieldY2(PD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(LD),this.setFieldX2(RD)):(this.setFieldY(LD),this.setFieldY2(RD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(wG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const PG="monotone",BG="linear";class RG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(eF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:BG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===PG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(eF.point,{morph:xG(this._spec,eF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new ya(this._option.dataSet,{name:`${pB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[eF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Rj({},this._spec[eF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class LG extends YH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Vw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class OG extends LG{constructor(){super(...arguments),this.type=OG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===dB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}OG.type="line";const IG=()=>{fz.registerMark(OG.type,OG),bM(),cM(),ER.registerGraphic(DB.line,wg),nN()};class DG extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class FG extends DG{constructor(){super(...arguments),this.type=FG.type}}FG.type="symbol";const jG=()=>{fz.registerMark(FG.type,FG),xO()};class zG extends MG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class HG extends oN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function NG(t,e,i,s){switch(t){case r.cartesianBandAxis:return zN(Mz(i,["z"]),"band",e);case r.cartesianLinearAxis:return zN(Mz(i,["z"]),"linear",e);case r.cartesianLogAxis:return zN(Mz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return zN(Mz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return zN(Mz(i),void 0,e);case r.polarBandAxis:return HN(i.orient,"band",e);case r.polarLinearAxis:return HN(i.orient,"linear",e);case r.polarAxis:return HN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=RN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>Sz(t.orient)));let d;d=p(c)?Rj({},NN(c.type)?a:o,l):l;const u=n.find((t=>Az(t.orient)));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=RN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Rj({},NN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return VG(i,RN(t,e));default:return RN(t,e)}}const VG=(t,e)=>{var i;const s=Rj({},e,e[Tz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class GG extends TH{getTheme(t,e){return NG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},ej(e)),{[s]:0}))}}class WG extends EH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new HG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=GG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof rc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}WG.transformerConstructor=GG;class UG extends YH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(DB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}UG.type="component";const YG=()=>{fz.registerMark(UG.type,UG)},KG=t=>t;class XG extends WG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?HB.circleAxisGrid:HB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=vG(null===(o=fz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new GH(this._option,t)]}collectData(t,e){const i=[];return oB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Nw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return oB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(oB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uz(s=t.domainLine)).startSymbol=uz(s.startSymbol),s.endSymbol=uz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mz(Rj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mz(t.tick.style)),t.tick.state&&(i.tick.state=pz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mz(t.subTick.style)),t.subTick.state&&(i.subTick.state=pz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=ON[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Rj({},d,mz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mz(h.style)}),h.state&&(i.title.state.shape=pz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mz(o.style)}),o.state&&(i.title.state.background=pz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mz(t.background.style)),t.background.state&&(i.panel.state=pz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mz(Rj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=LN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Wz(this._option.dataSet,"scale",KG),Gz(this._option.dataSet,"ticks",qC);return new ya(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}XG.specKey="axes";const $G=()=>{ER.registerGraphicComponent(zB.lineAxis,((t,e)=>new Lw(t,e))),ER.registerGraphicComponent(zB.circleAxis,(t=>new Fw(t))),ER.registerComponent(FB.axis,VO),ER.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new tE(t,e))),ER.registerGraphicComponent(HB.circleAxisGrid,((t,e)=>new iE(t,e))),ER.registerComponent(FB.grid,UO),YG(),fz.registerAnimation("axis",(()=>({appear:{custom:zw},update:{custom:jw},exit:{custom:Xc}})))},qG=[wN];class ZG extends XG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{const e=this.getOrient();Sz(e)?t.setXAxisHelper(this.axisHelper()):Az(e)?t.setYAxisHelper(this.axisHelper()):kz(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Rj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Rj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Sz(this.getOrient()),n=t=>{var e;return(s?!Sz(t.getOrient()):Sz(t.getOrient()))&&Nw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=Mz(i,["z"]),kz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!FN(e))return null;const{axisType:t,componentName:s}=wz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!FN(t))return;const{axisType:s,componentName:n}=wz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];Sz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):kz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(qG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){Sz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Sz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!kz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Sz(this.getOrient())?t.fieldX:kz(this.getOrient())?t.fieldZ:t.fieldY,Nw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(Sz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Sz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return oB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:Sz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:kz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();oB(this._regions,(e=>{Sz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Az(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):kz(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Sz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=Sz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Rj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return VN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=DN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=JG?10:n>=QG?5:n>=tW?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class iW extends ZG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}iW.type=r.cartesianLinearAxis,iW.specKey="axes",U(iW,eW);const sW=()=>{$G(),fz.registerComponent(iW.type,iW)};class nW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=VN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>VN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class rW extends ZG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=eC(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$G(),fz.registerComponent(rW.type,rW)};class oW extends iW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{Sz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Rj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new GH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=di.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>VN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>VN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}oW.type=r.cartesianTimeAxis,oW.specKey="axes";class lW extends iW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new OC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}lW.type=r.cartesianLogAxis,lW.specKey="axes",U(lW,eW);class hW extends iW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new IC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}hW.type=r.cartesianSymlogAxis,hW.specKey="axes",U(hW,eW);class cW extends EG{constructor(){super(...arguments),this.type=dB.line,this.transformerConstructor=zG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),_G("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=CG(this);this._symbolMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_G("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}cW.type=dB.line,cW.mark=iF,cW.transformerConstructor=zG,U(cW,RG);class dW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{tH(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ya)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class uW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tz(e,[{key:t,operations:Nw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tz(e,[{key:i.field,operations:Nw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?XF("colorOrdinal"):XF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Nw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Nw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Nw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Nw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class pW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=sz(t,!0);for(const e in a)for(const i in a[e].nodes)oz(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)az(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class gW extends bH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:gB,height:mB},this._viewRect={width:gB,height:mB},this._viewBox={x1:0,y1:0,x2:gB,y2:mB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=ej(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new zz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new dW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new pW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=fz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=fz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof YH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof YH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&tH(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=dH(this._spec,this._option,{width:gB,height:mB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=jF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new uW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){uH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=jF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{uH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,uH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):uH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=tj(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(rH.STATE_SELECTED)}clearHovered(){this.clearState(rH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Fz.dimensionHover||s===Fz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Gw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class fW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);wj(t,r,l.spec),wj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));wj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=fz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class vW extends fW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Rj(i,pH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class _W extends vW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class yW extends gW{constructor(){super(...arguments),this.transformerConstructor=_W,this.type="line",this.seriesType=dB.line,this._canStack=!0}}yW.type="line",yW.seriesType=dB.line,yW.transformerConstructor=_W;class bW extends LG{constructor(){super(...arguments),this.type=bW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}bW.type="area";const xW=()=>{fz.registerMark(bW.type,bW),bM(),tM(),ER.registerGraphic(DB.area,$g),nN()};class SW extends pV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const AW=()=>{fz.registerAnimation("area",iN),sN(),tN()};class kW extends zG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Rj({},m.style,g.style),l.state=Rj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class MW extends EG{constructor(){super(...arguments),this.type=dB.area,this.transformerConstructor=kW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(MW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===PG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return $F(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return $F(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),_G("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),_G("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=CG(this);this._symbolMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_G("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new SW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}MW.type=dB.area,MW.mark=nF,MW.transformerConstructor=kW,U(MW,RG);class TW extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class wW extends gW{constructor(){super(...arguments),this.transformerConstructor=TW,this.type="area",this.seriesType=dB.area,this._canStack=!0}}wW.type="area",wW.seriesType=dB.area,wW.transformerConstructor=TW;function CW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CW(t,e)}),PW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:CW(t,e)}),BW={type:"fadeIn"},RW={type:"growCenterIn"};function LW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BW;case"scaleIn":return RW;default:return EW(t)}}class OW extends YH{constructor(){super(...arguments),this.type=OW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}OW.type="rect";const IW=()=>{fz.registerMark(OW.type,OW),yO(),vO.useRegisters([UI,YI,KI,XI,GI,WI])};function DW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):$F(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[XD]):$F(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):$F(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[qD]):$F(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},zW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:xG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(zW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Gz(this._option.dataSet,"addVChartProperty",sG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Gz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ya(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=qD,s=$D,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=XD,s=KD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)DW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=$F(this[n](t),o),d=$F(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[CD],n=t[ED],r=t[PD],h=t[BD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[CD]:i,[ED]:s}),a?{[PD]:o,[BD]:l}:void 0);t.push(Pg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>$F(this._dataToPosY(t),a),y1:t=>$F(this._dataToPosY1(t),a)}:{y:t=>$F(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>$F(this._dataToPosX(t),r),x1:t=>$F(this._dataToPosX1(t),r)}:{x:t=>$F(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=CG(this);this._barMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),_G(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=sj(this._spec.barWidth,a)),l&&(c=Math.max(c,sj(this._spec.barMinWidth,a))),h&&(c=Math.min(c,sj(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sj(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=Nw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}zW.type=dB.bar,zW.mark=QD,zW.transformerConstructor=jW;const HW=()=>{aI(),IW(),fz.registerAnimation("bar",((t,e)=>({appear:LW(t,e),enter:EW(t,!1),exit:PW(t,!1),disappear:PW(t)}))),aW(),sW(),fz.registerSeries(zW.type,zW)};class NW extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),cH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class VW extends gW{constructor(){super(...arguments),this.transformerConstructor=NW,this.type="bar",this.seriesType=dB.bar,this._canStack=!0}}VW.type="bar",VW.seriesType=dB.bar,VW.transformerConstructor=NW;class GW extends YH{constructor(){super(...arguments),this.type=GW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}GW.type="rect3d";class WW extends zW{constructor(){super(...arguments),this.type=dB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}WW.type=dB.bar3d,WW.mark=tF;class UW extends NW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class YW extends VW{constructor(){super(...arguments),this.transformerConstructor=UW,this.type="bar3d",this.seriesType=dB.bar3d}}YW.type="bar3d",YW.seriesType=dB.bar3d,YW.transformerConstructor=UW;const KW=[10,20],XW=Iw.Linear,$W="circle",qW=Iw.Ordinal,ZW=["circle","square","triangle","diamond","star"],JW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class QW extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class tU extends EG{constructor(){super(...arguments),this.type=dB.scatter,this.transformerConstructor=QW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${pB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${pB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:XW,defaultRange:KW},"size")}getShapeAttribute(t,e){return u(e)?$W:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qW,defaultRange:ZW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(tU.mark.point,{morph:xG(this._spec,tU.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=CG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),_G("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:$W},rH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}tU.type=dB.scatter,tU.mark=sF,tU.transformerConstructor=QW;const eU=()=>{jG(),fz.registerAnimation("scatter",((t,e)=>Object.assign({appear:JW(0,e)},JH))),aW(),sW(),fz.registerSeries(tU.type,tU)};class iU extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class sU extends gW{constructor(){super(...arguments),this.transformerConstructor=iU,this.type="scatter",this.seriesType=dB.scatter,this._canStack=!0}}sU.type="scatter",sU.seriesType=dB.scatter,sU.transformerConstructor=iU;Ln();const nU={},rU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function aU(t,e){t&&_(t)||ub("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(nU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ln().projection(s),s.copy=s.copy||function(){const t=i();return rU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),nU[i]||null}const oU={albers:Jn,albersusa:function(){var t,e,i,s,n,r,a=Jn(),o=Zn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Zn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(oU).forEach((t=>{aU(t,oU[t])}));const lU="Feature",hU="FeatureCollection";function cU(t){const e=Y(t);return 1===e.length?e[0]:{type:hU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===hU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===lU?t:{type:lU,geometry:t}))}(e))),[])}}const dU=rU.concat(["pointRadius","fit","extent","size"]);function uU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{dU.includes(s)&&(i=i.concat(fR(t[s],e)))})),i):i}let pU=class extends tL{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(fR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(fR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(fR(this.spec.size,this.view)),this.spec.size=t,this.attach(fR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(fR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(fR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(fR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(fR(t,this.view)),this.commit(),this}configure(t){return this.detach(uU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(uU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=aU((t||"mercator").toLowerCase());return e||ub("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),rU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,_R(this.spec[t],e,aU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(_R(this.spec.pointRadius,e,aU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=cU(_R(this.spec.fit,e,aU));this.spec.extent?this.projection.fitExtent(_R(this.spec.extent,e,aU),t):this.spec.size&&this.projection.fitSize(_R(this.spec.size,e,aU),t)}return this.projection}output(){return this.projection}};const gU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class mU extends TG{constructor(){super(...arguments),this.type=dB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${pB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const fU=`${pB}_MAP_LOOK_UP_KEY`,vU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[SD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[fU]=e.nameMap[n]:t[fU]=n})),t.features);class _U extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class yU extends YH{constructor(){super(...arguments),this.type=yU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}yU.type="path";const bU=()=>{fz.registerMark(yU.type,yU),_O()};class xU{constructor(t){this.projection=aU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class SU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class AU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function kU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:SU}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:AU}:null}const MU={debounce:xt,throttle:St};class TU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),kU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return kU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,MU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,MU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||kU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:De({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,MU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,MU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){kU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;De({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||kU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=MU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=MU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function wU(t,e){return`${pB}_${e}_${t}`}class CU extends WG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:wU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Rj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new xU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===dB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),oB(this._regions,(t=>{var e;if(t.type===dB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new oe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===dB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}CU.type=r.geoCoordinate,U(CU,TU);const EU=()=>{fz.registerComponent(CU.type,CU)};class PU extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class BU extends mU{constructor(){super(...arguments),this.type=dB.map,this.transformerConstructor=PU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Uz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Gz(this._dataSet,"copyDataView",Zz),Gz(this._dataSet,"map",vU),Gz(this._dataSet,"lookup",gU);const i=Uz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ya(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:eH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:fU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lG(this._option,s)}initMark(){this._pathMark=this._createMark(BU.mark.area,{morph:xG(this._spec,BU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:kD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(vG(null===(t=fz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),_G("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new _U(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[SD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[SD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new oe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new oe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return SD}getActiveMarks(){return[this._pathMark]}}BU.type=dB.map,BU.mark=hF,BU.transformerConstructor=PU;const RU=()=>{ER.registerGrammar("projection",pU,"projections"),EU(),bU(),fz.registerSeries(BU.type,BU),fz.registerImplement("registerMap",Xz),fz.registerImplement("unregisterMap",$z),eN()},LU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[DD]=!0:delete t[DD]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=OU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=IU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Kt(_,e)):(t[c]=+y,y=Kt(y,e)),t[d]=Kt(t[c],e),f=Kt(f,e),b=Xt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=OU(a,t,n,r,h,l,i,e),r.push(n)})),r};function OU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=IU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Kt(i.positive,e)):(t[h]=+i.negative,i.negative=Kt(i.negative,e)),t[c]=Kt(t[h],e),i.end=Kt(i.end,e)}i.isTotal=e,(u(p)||p===vD)&&(t[vD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function IU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Kt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const DU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Kt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},FU={type:"fadeIn"},jU={type:"growCenterIn"};function zU(t,e){switch(e){case"fadeIn":return FU;case"scaleIn":return jU;default:return EW(t,!1)}}class HU extends YH{constructor(){super(...arguments),this.type=HU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}HU.type="rule";const NU=()=>{fz.registerMark(HU.type,HU),bO()},VU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:GU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function GU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>GU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class WU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ya(e instanceof va?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Gz(e,"dimensionTree",VU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class UU extends jW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const YU={rect:ZU,symbol:$U,arc:QU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=$U(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tY,line:eY,area:eY,rect3d:ZU,arc3d:QU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function KU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=LN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function XU(t){return d(t)?e=>t(e.data):t}function $U(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QU(t){var e;const{labelSpec:i}=t,s=null!==(e=XU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tY(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=KU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),yp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class iY extends zW{constructor(){super(...arguments),this.type=dB.waterfall,this.transformerConstructor=UU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new WU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=vD)}getSeriesKeys(){return this._seriesField===vD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Gz(this._dataSet,"waterfallFillTotal",DU),Gz(this._dataSet,"waterfall",LU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Jz(this.getViewData(),this._dataSet,{name:`${pB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:CD,endAs:ED,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=CG(this);this._barMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),_G("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(iY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tY(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?$F(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):$F(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}iY.type=dB.waterfall,iY.mark=_F,iY.transformerConstructor=UU;const sY=()=>{NU(),IW(),fz.registerAnimation("waterfall",((t,e)=>({appear:zU(t,e),enter:EW(t,!1),exit:PW(t,!1),disappear:PW(t,!1)}))),eN(),aW(),sW(),fz.registerSeries(iY.type,iY)},nY=`${pB}_BOX_PLOT_OUTLIER_VALUE`;var rY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(rY||(rY={}));const aY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[nY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class oY extends pV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===rY.OUTLIER)return this.series.getOutliersField();if(t===rY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case rY.MIN:return this.series.getMinField();case rY.MAX:return this.series.getMaxField();case rY.MEDIAN:return this.series.getMedianField();case rY.Q1:return this.series.getQ1Field();case rY.Q3:return this.series.getQ3Field();case rY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===rY.OUTLIER)return e[nY];if(t===rY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case rY.MIN:return e[this.series.getMinField()];case rY.MAX:return e[this.series.getMaxField()];case rY.MEDIAN:return e[this.series.getMedianField()];case rY.Q1:return e[this.series.getQ1Field()];case rY.Q3:return e[this.series.getQ3Field()];case rY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[nY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(rY.OUTLIER),value:this.getContentValue(rY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(rY.MAX),value:this.getContentValue(rY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.Q3),value:this.getContentValue(rY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.MEDIAN),value:this.getContentValue(rY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.Q1),value:this.getContentValue(rY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.MIN),value:this.getContentValue(rY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.SERIES_FIELD),value:this.getContentValue(rY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class lY extends YH{constructor(){super(...arguments),this.type=lY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}lY.type="boxPlot";const hY=()=>{fz.registerMark(lY.type,lY),ER.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(wO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ab(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ab(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),ER.registerAnimationType("boxplotScaleIn",CO),ER.registerAnimationType("boxplotScaleOut",EO),AO(),yO(),bO(),ER.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(BO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),ER.registerAnimationType("barBoxplotScaleIn",RO),ER.registerAnimationType("barBoxplotScaleOut",LO),AO(),yO(),bO()};class cY extends EG{constructor(){super(...arguments),this.type=dB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(cY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(cY.mark.outlier,{progressive:t,key:SD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,rH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>$F(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>$F(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>$F(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>$F(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>$F(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},rH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>$F(e(this.getDatumPositionValues(t,nY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>$F(e(this.getDatumPositionValues(t,nY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,rH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"foldOutlierData",aY),Gz(this._dataSet,"addVChartProperty",sG);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${pB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._outlierDataView=new lG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=CG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=fz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(_G("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(vG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(vG(null===(a=fz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new oY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}cY.type=dB.boxPlot,cY.mark=yF;class dY extends YH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=dY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}dY.type="text";const uY=()=>{fz.registerMark(dY.type,dY),SO(),bM(),_M(),ER.registerGraphic(DB.richtext,Gg)};function pY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class gY extends pV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const mY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),fY={type:"fadeIn"},vY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function _Y(t,e){return"fadeIn"===e?fY:mY(t)}class yY extends jW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class bY extends zW{constructor(){super(...arguments),this.type=dB.rangeColumn,this._barMarkType="rect",this._barName=dB.bar,this.transformerConstructor=yY}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(bY.mark.bar,{morph:xG(this._spec,bY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(bY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(bY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});pY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});pY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=CG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),_G("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(vG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),_G("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new gY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}bY.type=dB.rangeColumn,bY.mark=MF,bY.transformerConstructor=yY;const xY=()=>{IW(),uY(),fz.registerAnimation("rangeColumn",((t,e)=>({appear:_Y(t,e),enter:mY(t),exit:vY(t),disappear:vY(t)}))),eN(),aW(),sW(),fz.registerSeries(bY.type,bY)};class SY extends bY{constructor(){super(...arguments),this.type=dB.rangeColumn3d,this._barMarkType="rect3d",this._barName=dB.bar3d}}SY.type=dB.rangeColumn3d,SY.mark=TF;class AY extends pV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class kY extends MW{constructor(){super(...arguments),this.type=dB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(kY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new AY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}kY.type=dB.rangeArea,kY.mark=PF;class MY extends TG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=LB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Nw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Nw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&wG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const TY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{asStartAngle:s,asEndAngle:n,asMiddleAngle:r,asRadian:a,asRatio:o,asQuadrant:l,asK:h}=e,c=e.angleField(),d=e.startAngle(),u=e.endAngle(),p=e.minAngle(),g=(t,e,i)=>{t[s]=e,t[n]=e+i,t[r]=e+i/2,t[a]=i,t[l]=function(t){return(t=re(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[c]))),y=u-d;let b=d,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[SB],s=m?i/m:0;let n=s*y;n{g(e,d+i*t,t)}))}else{const t=x/S;b=d,i.forEach((e=>{const i=e[a]===p?p:e[SB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][n]=u),i};function wY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const CY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:wY(t,!0,sH.appear)}),EY={type:"fadeIn"},PY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:wY(t,!0,sH.enter)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:wY(t,!0,sH.exit)}),RY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:wY(t,!0,sH.exit)});function LY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return EY;case"growRadius":return CY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return CY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class OY extends YH{constructor(t,e){super(t,e),this.type=IY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>se({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[wB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class IY extends OY{constructor(){super(...arguments),this.type=IY.type}}IY.type="arc";const DY=()=>{bM(),Jk(),ER.registerGraphic(DB.arc,Jg),vO.useRegisters([sD,nD,eD,iD]),fz.registerMark(IY.type,IY)};class FY extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Rj({},this._theme,i,t);const n=(t,e)=>Rj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const jY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:RB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:LB,layoutRadius:e.layoutRadius}},zY=(t,e,i,s=0,n=0*Math.PI)=>{if(S(t))return t;if(d(t))return t(e(),i());const r=e();return"auto"===t&&r.width>0&&r.height>0?ae(r,i(),s,n):Math.min(r.width/2,r.height/2)};class HY extends MY{constructor(){super(...arguments),this.transformerConstructor=FY,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}},this._startAngle=PB,this._endAngle=BB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[wB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return se(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?te(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?te(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?te(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Gz(this._dataSet,"pie",TY),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?te(this._spec.minAngle):0,asStartAngle:kB,asEndAngle:MB,asRatio:AB,asMiddleAngle:wB,asRadian:EB,asQuadrant:CB,asK:TB}},!1);const e=new ya(this._dataSet,{name:`${pB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},HY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:xG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:AD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return cB(kB)(t)}endAngleScale(t){return cB(MB)(t)}_computeLayoutRadius(){return zY(this._spec.layoutRadius,this.getLayoutRect,this.getCenter,this._startAngle,this._endAngle)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:qF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:qF(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:cB(yB).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[wB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return se(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===sH.appear)return this._startAngle;if(i===sH.disappear)return this._endAngle;const n=[sH.disappear,sH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[SD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[wB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[wB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[wB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[wB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}HY.transformerConstructor=FY,HY.mark=aF;class NY extends HY{constructor(){super(...arguments),this.type=dB.pie}}NY.type=dB.pie;const VY=()=>{DY(),fz.registerAnimation("pie",((t,e)=>({appear:LY(t,e),enter:PY(t),exit:BY(t),disappear:RY(t)}))),fz.registerSeries(NY.type,NY)};class GY extends OY{constructor(){super(...arguments),this.type=GY.type,this._support3d=!0}}GY.type="arc3d";class WY extends FY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class UY extends HY{constructor(){super(...arguments),this.type=dB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=WY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[wB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}UY.type=dB.pie3d,UY.mark=oF,UY.transformerConstructor=WY;const YY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},KY={type:"fadeIn"},XY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),$Y=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),qY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function ZY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return KY;case"growAngle":return YY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return YY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class JY extends MY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(ED),this.setInnerRadiusField(CD)}setValueFieldToPercent(){this.setRadiusField(BD),this.setInnerRadiusField(PD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class QY extends MG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class tK extends XG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!jN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=jY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s,n;const r=[],a=[];return e.forEach(((e,o)=>{if(!jN(e))return;const{axisType:l,componentName:h,startAngle:c,endAngle:d,center:u,outerRadius:p,layoutRadius:g}=jY(e,t);e.center=u,e.startAngle=c,e.endAngle=d,e.outerRadius=p,e.type=l,e.layoutRadius=g;const m={spec:e,specPath:[this.specKey,o],specInfoPath:["component",this.specKey,o],type:h};i.push(m),"radius"===e.orient?(r.push(m),n=o):(a.push(m),s=o)})),r.forEach((t=>{t.angleAxisIndex=s})),a.forEach((t=>{t.radiusAxisIndex=n})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=PB,this._endAngle=BB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:IN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){oB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Nw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return se(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>VN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=qt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return zY(this._spec.layoutRadius,this.getRefLayoutRect,this.getCenter,this._startAngle,this._endAngle)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=LB,e=0;const i=this.getChart().getSpec();return oB(this.getRegions(),(s=>{const n=s;if(r=n.type,[dB.rose,dB.radar,dB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Rj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Rj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}tK.type=r.polarAxis,tK.specKey="axes";class eK extends tK{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}eK.type=r.polarLinearAxis,eK.specKey="axes",U(eK,eW);const iK=()=>{$G(),fz.registerComponent(eK.type,eK)};class sK extends tK{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}sK.type=r.polarBandAxis,sK.specKey="axes",U(sK,nW);const nK=()=>{$G(),fz.registerComponent(sK.type,sK)};class rK extends JY{constructor(){super(...arguments),this.type=dB.rose,this.transformerConstructor=QY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(rK.mark.rose,{morph:xG(this._spec,rK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>$F(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=$F(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),_G("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rK.type=dB.rose,rK.mark=lF,rK.transformerConstructor=QY;const aK=()=>{fz.registerSeries(rK.type,rK),DY(),fz.registerAnimation("rose",((t,e)=>({appear:ZY(t,e),enter:XY(t),exit:$Y(t),disappear:qY(t)}))),nK(),iK()};class oK extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,QP(this._fromAngle,this._toAngle)&&QP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class lK extends Wc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=re(s.angle),a=re(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=re(o.angle),c=re(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new $t(m,f,v,_);return y.defined=e.defined,y}}const hK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cK(t,e,i){return"fadeIn"===e?hK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dK(t,e,i){return"fadeIn"===e?hK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const uK=(t,e)=>({custom:Yc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class pK extends JY{constructor(){super(...arguments),this.type=dB.radar,this.transformerConstructor=zG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(pK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:BG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?te(this._spec.startAngle):PB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),_G("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=fz.getAnimationInKey(e);t.setAnimationConfig(vG(null==i?void 0:i(n,r),_G(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}pK.type=dB.radar,pK.mark=rF,pK.transformerConstructor=zG,U(pK,RG);const gK=()=>{fz.registerSeries(pK.type,pK),oI(),xW(),IG(),jG(),fz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cK(t,e,"in"),enter:cK(t,e,"in"),exit:cK(t,e,"out"),disappear:"clipIn"===e?void 0:cK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:lK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:oK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarGroup",((t,e)=>({appear:uK(t,"in"),disappear:uK(t,"out")}))),Jk(),nK(),iK()};class mK extends pV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>di.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const fK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},vK={fill:"#bbb",fillOpacity:.2};class _K extends EG{constructor(){super(...arguments),this.type=dB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Gz(this._option.dataSet,"objFlat",fK),Gz(this._option.dataSet,"copyDataView",Zz),Wz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:eH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Rj(vK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(_K.mark.group),this._containerMark=this._createMark(_K.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(_K.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(_K.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(_K.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(_K.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(_K.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(_K.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new YF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:kD}}initTooltip(){this._tooltipHelper=new mK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}_K.type=dB.dot,_K.mark=pF;class yK extends pV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>di.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const bK=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class xK extends EG{constructor(){super(...arguments),this.type=dB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Gz(this._option.dataSet,"linkDotInfo",bK),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:eH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(xK.mark.group),this._containerMark=this._createMark(xK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(xK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(xK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new yK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}xK.type=dB.link,xK.mark=uF;class SK extends MY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:FD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ED:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?te(n):PB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):BB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[ED]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(SK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+te(s),n=te(i)/2;return Jg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Pg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const MK=()=>{fz.registerAnimation("circularProgress",((t,e)=>({appear:kK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class TK extends MG{constructor(){super(...arguments),this._supportStack=!0}}class wK extends SK{constructor(){super(...arguments),this.type=dB.circularProgress,this.transformerConstructor=TK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(wK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(wK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ED:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),_G("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}wK.type=dB.circularProgress,wK.mark=dF,wK.transformerConstructor=TK;function CK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const EK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:CK(t)}),PK={type:"fadeIn"};function BK(t,e){return!1===e?{}:"fadeIn"===e?PK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CK(t)}))(t)}class RK extends pV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class LK extends EG{constructor(){super(...arguments),this.type=dB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(LK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return $F(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(LK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(LK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=$F(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Pg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=$F(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Pg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),_G("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new RK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}LK.type=dB.linearProgress,LK.mark=vF;const OK=()=>{IW(),fz.registerAnimation("linearProgress",((t,e)=>({appear:BK(t,e),enter:{type:"grow"},disappear:EK(t)}))),eN(),fz.registerSeries(LK.type,LK)},IK=[0],DK=[20,40],FK=[200,500],jK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},zK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],HK=`${pB}_WORD_CLOUD_WEIGHT`,NK=`${pB}_WORD_CLOUD_TEXT`;class VK extends TG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=DK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:FK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:IK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?NK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:jK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:IK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!zK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(VK.mark.word,{key:AD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(vG(fz.getAnimationInKey("wordCloud")(n,s),_G("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new YF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new BC,o=this._fontWeightRange;if(r){const[e,i]=vb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:HK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:NK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:sb(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:AD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:HK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:AD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:HK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}VK.mark=gF;function GK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||ZH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function UK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function YK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const KK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function XK(t){return d(t)?t:function(){return t}}class $K{constructor(t){var e,i,s;switch(this.options=z({},$K.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,WK[s]?WK[s]():WK.circle()),this.getText=null!==(e=XK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=XK(this.options.fontWeight),this.getTextFontSize=XK(this.options.fontSize),this.getTextFontStyle=XK(this.options.fontStyle),this.getTextFontFamily=XK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>KK(10,50);break;case"random-light":this.getTextColor=()=>KK(50,90);break;default:this.getTextColor=XK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return te(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return te(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class ZK extends $K{constructor(t){var e;super(z({},ZK.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=ZK.defaultOptions.minFontSize&&(this.options.minFontSize=ZK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=qK[this.options.spiral])&&void 0!==e?e:qK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=XK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=YK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(O_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(eX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(tX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}eX(p,this._size)&&(p=iX(p,this._size))}else if(eX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||QK(p,i))&&(!i||!JK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function JK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function QK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,eX=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function iX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=YK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}nX.defaultOptions={enlarge:!1};const aX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},oX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?lX(t.fontFamily):"sans-serif",d=t.fontStyle?lX(t.fontStyle):"normal",u=t.fontWeight?lX(t.fontWeight):"normal",p=t.rotate?lX(t.rotate):0,g=lX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?lX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||aX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?lX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=cX(dX(t,l),C);w=i=>e(t(i))}let E=ZK;"fast"===t.layoutType?E=nX:"grid"===t.layoutType&&(E=sX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},lX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],hX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),cX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=hX(t[0]),s=hX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(hX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},dX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function uX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{ER.registerTransform("wordcloud",{transform:oX,markPhase:"beforeJoin"},!0),uY(),fz.registerAnimation("wordCloud",((t,e)=>({appear:GK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),fz.registerSeries(pX.type,pX)};(class extends VK{constructor(){super(...arguments),this.type=dB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(VK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),_G("word",this._spec,this._markAttributeContext)))}}).type=dB.wordCloud3d;const mX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},fX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},vX=`${pB}_FUNNEL_TRANSFORM_RATIO`,_X=`${pB}_FUNNEL_REACH_RATIO`,yX=`${pB}_FUNNEL_HEIGHT_RATIO`,bX=`${pB}_FUNNEL_VALUE_RATIO`,xX=`${pB}_FUNNEL_LAST_VALUE_RATIO`,SX=`${pB}_FUNNEL_NEXT_VALUE_RATIO`,AX=`${pB}_FUNNEL_LAST_VALUE`,kX=`${pB}_FUNNEL_CURRENT_VALUE`,MX=`${pB}_FUNNEL_NEXT_VALUE`,TX=`${pB}_FUNNEL_TRANSFORM_LEVEL`,wX=20;class CX extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[_X])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class EX extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class PX extends EX{constructor(){super(...arguments),this.type=PX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}PX.type="polygon";const BX=()=>{fz.registerMark(PX.type,PX),bM(),gM(),ER.registerGraphic(DB.polygon,em),vO.useRegisters([$I,qI])};class RX extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class LX extends TG{constructor(){super(...arguments),this.type=dB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=RX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"funnel",mX),Gz(this._dataSet,"funnelTransform",fX);const t=new ya(this._dataSet,{name:`${pB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:kX,asTransformRatio:vX,asReachRatio:_X,asHeightRatio:yX,asValueRatio:bX,asNextValueRatio:SX,asLastValueRatio:xX,asLastValue:AX,asNextValue:MX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:TX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},LX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:xG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},LX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(LX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(LX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new CX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*cB(_X).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),_G("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(vG(fz.getAnimationInKey("fadeInOut")(),_G(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(vG(fz.getAnimationInKey("funnel")({},o),_G(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(vG(null===(a=fz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),_G("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[xX])/2:this._getSecondaryAxisLength(t[bX])/2,n=this._getSecondaryAxisLength(t[bX])/2):(s=this._getSecondaryAxisLength(t[bX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[SX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[TX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[AD]===t[AD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?wX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{BX(),uY(),NU(),fz.registerSeries(LX.type,LX),fz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},QH))),fz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Kc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Kc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),eN()};class IX extends EX{constructor(){super(...arguments),this.type=IX.type}}IX.type="pyramid3d";class DX extends RX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class FX extends LX{constructor(){super(...arguments),this.type=dB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=DX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},FX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},FX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(FX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(FX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}FX.type=dB.funnel3d,FX.mark=fF,FX.transformerConstructor=DX;const jX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zX=t=>{const e=t.mark.elements.filter((t=>t.diffState===IB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},NX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=HX(r,s,n);return jX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=HX(r,s,n);return jX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},GX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=VX(r);return jX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=VX(r);return jX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),WX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},UX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):UX(t.children,e,i)))})),e};function YX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=$X(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,wt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},qX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=qX(t.children,e,t,n))})),s},ZX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=ZX(t.children,e,t,n)),n=e(t,s,i,n)})),n},JX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:YX,slice:KX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?KX:YX)(t,e,i,s,n)}};class QX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},QX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?gb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?XX(this.options.aspectRatio):null!==(e=JX[this.options.splitType])&&void 0!==e?e:JX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=$X(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}QX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const t$=(t,e)=>{const i=new QX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return UX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},e$={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class i${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];YX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),e$);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},i$.defaultOpionts,t):Object.assign({},i$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+yb(this.options.center[0],t.width),s=t.y0+yb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>yb(t,n))):yb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>yb(t,n))):yb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=yb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=$X(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=se({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}i$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const s$=4294967296;function n$(t,e){let i,s;if(o$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function o$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function d$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function u$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function p$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function g$(t){return{_:t,next:null,prev:null}}function m$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];d$(n,s,r);let a,o,l,h,c,d,u,p=g$(s),g=g$(n),m=g$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=$X(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%s$)/s$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:y$.defaultOpionts.nodeSort;qX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)qX([o],f$(h)),ZX([o],v$(this._getPadding,.5,a)),qX([o],_$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);qX([o],f$(y$.defaultOpionts.setRadius)),ZX([o],v$(fb,1,a)),c&&ZX([o],v$(this._getPadding,o.radius/t,a)),qX([o],_$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}y$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const b$=(t,e={})=>{if(!t)return[];const i=[];return UX(t,i,e),i},x$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new i$(i).layout(t,{width:s,height:n})};class S$ extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var A$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(A$||(A$={}));const k$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===A$.DrillDown){return Y(hz(t,n,s,"children"))}if(i.type===A$.DrillUp){const e=cz(t,n,s,"children");if(e)return Y(e)}return t};class M${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=kU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Gz(t,"drillFilter",k$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:A$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:A$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:A$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:A$.DrillUp},model:this}),r}}class T$ extends MY{constructor(){super(...arguments),this.type=dB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"sunburstLayout",x$),Gz(this._dataSet,"flatten",b$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",sG),t.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(T$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(T$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new S$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}T$.type=dB.sunburst,T$.mark=kF,U(T$,M$);const w$=()=>{fz.registerSeries(T$.type,T$),DY(),uY(),eN(),fz.registerAnimation("sunburst",((t,e)=>({appear:WX(0,e),enter:NX(t),exit:GX(t),disappear:GX(t)})))},C$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new y$(i).layout(t,{width:s,height:n})};class E$ extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const P$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class B$ extends EG{constructor(){super(...arguments),this.type=dB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"circlePackingLayout",C$),Gz(this._dataSet,"flatten",b$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",sG),t.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(B$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(B$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}B$.type=dB.circlePacking,B$.mark=wF,U(B$,M$);const R$=()=>{fz.registerSeries(B$.type,B$),DY(),uY(),tN(),fz.registerAnimation("circlePacking",((t,e)=>({appear:P$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},L$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=L$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function O$(t){return t.depth}function I$(t,e){return e-1-t.endDepth}const D$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),F$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},j$={left:O$,right:I$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:O$,end:I$},z$=yt(0,1);class H${constructor(t){this._ascendingSourceBreadth=(t,e)=>D$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>D$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},H$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):j$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};kb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),kb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];L$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[F$(s[t.source]),F$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*z$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(D$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(D$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new H$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},V$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&V$(t,e.children,i)}))},G$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},W$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new H$(e),r=[];return r.push(n.layout(s,i)),r},U$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},Y$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class K$ extends pV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const X$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),$$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:X$(t),q$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class Z$ extends YH{constructor(){super(...arguments),this.type=Z$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}Z$.type="linkPath";const J$=()=>{ER.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(DO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),ER.registerAnimationType("linkPathGrowIn",FO),ER.registerAnimationType("linkPathGrowOut",jO),ER.registerAnimationType("linkPathUpdate",zO),AO(),_O(),fz.registerMark(Z$.type,Z$)};class Q$ extends EG{constructor(){super(...arguments),this.type=dB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Jt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(rH.STATE_SANKEY_EMPHASIS),e.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS)):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(rH.STATE_SANKEY_EMPHASIS),s.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Gz(this._dataSet,"sankeyLayout",W$),Gz(this._dataSet,"sankeyFormat",G$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:eH.sankeyLayout});const{dataSet:a}=this._option;Gz(a,"sankeyNodes",U$),Gz(a,"flatten",b$);const o=new ya(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._nodesSeriesData=new lG(this._option,o),Gz(a,"sankeyLinks",Y$);const l=new ya(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._linksSeriesData=new lG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Q$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(Q$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(Q$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},rH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),_G("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),_G("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(vG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),_G("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([rH.STATE_SANKEY_EMPHASIS_REVERSE,rH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new K$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new YF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return V$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}Q$.type=dB.sankey,Q$.mark=xF;const tq=()=>{ER.registerTransform("sankey",{transform:N$,markPhase:"beforeJoin"},!0),IW(),J$(),uY(),fz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:$$(t,e)},QH))),fz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:q$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),eN(),fz.registerSeries(Q$.type,Q$)},eq=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=b$(n);return i=rG([{latestData:r}],e),i};class iq extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const sq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class nq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class rq extends EG{constructor(){super(...arguments),this.type=dB.treemap,this.transformerConstructor=nq,this._viewBox=new Jt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new oe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:AD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",sG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Gz(this._dataSet,"hierarchyDimensionStatistics",eq),Gz(this._dataSet,"flatten",b$);const i=new ya(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(rq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(rq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new iq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}rq.type=dB.treemap,rq.mark=bF,rq.transformerConstructor=nq,U(rq,M$),U(rq,TU);const aq=()=>{IW(),uY(),fz.registerAnimation("treemap",((t,e)=>({appear:sq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),eN(),ER.registerTransform("treemap",{transform:t$,markPhase:"beforeJoin"},!0),fz.registerSeries(rq.type,rq)},oq={type:"fadeIn"};function lq(t,e){return"fadeIn"===e?oq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class hq extends MG{constructor(){super(...arguments),this._supportStack=!1}}class cq extends SK{constructor(){super(...arguments),this.type=dB.gaugePointer,this.transformerConstructor=hq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(cq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},cq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(cq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),_G("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}cq.type=dB.gaugePointer,cq.mark=AF,cq.transformerConstructor=hq;const dq=()=>{fz.registerSeries(cq.type,cq),bU(),IW(),fz.registerAnimation("gaugePointer",((t,e)=>{const i=lq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),nK(),iK()};class uq extends MG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class pq extends SK{constructor(){super(...arguments),this.type=dB.gauge,this.transformerConstructor=uq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=te(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Gz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[jD]=t[this._angleField[0]],t[FD]=e>0?i[e-1][jD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(pq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(pq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[FD])?this.angleAxisHelper.dataToPosition([t[FD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[jD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),_G("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}pq.type=dB.gauge,pq.mark=SF,pq.transformerConstructor=uq;class gq extends DG{constructor(){super(...arguments),this.type=gq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}gq.type="cell";const mq=()=>{fz.registerMark(gq.type,gq),bM(),SM(),ER.registerGraphic(DB.cell,kg),ER.registerMark(DB.cell,uD)};function fq(t){return!1===t?{}:{type:"fadeIn"}}class vq extends pV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class _q extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class yq extends EG{constructor(){super(...arguments),this.type=dB.heatmap,this.transformerConstructor=_q}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(yq.mark.cell,{morph:xG(this._spec,yq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(yq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ei(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=CG(this);this._cellMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),_G("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new vq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}yq.type=dB.heatmap,yq.mark=CF,yq.transformerConstructor=_q;const bq=()=>{uY(),mq(),fz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},QH),{appear:fq(e)}))),aW(),sW(),fz.registerSeries(yq.type,yq)},xq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=te(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=te(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=yb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=yb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+yb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+yb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=gb(e.field),C=t.map(w),[E,P]=vb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:gb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?vb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=Sq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),Aq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Aq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[SD]:null==n?void 0:n[SD],[kD]:null==n?void 0:n[kD]}};class Mq extends YH{constructor(){super(...arguments),this.type=Mq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Mq.type="ripple";const Tq=()=>{fz.registerMark(Mq.type,Mq),ER.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),AO(),xO()},wq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Cq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Eq extends MY{constructor(){super(...arguments),this.type=dB.correlation,this.transformerConstructor=Cq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Gz(this._dataSet,"correlation",xq);const s=new va;Wz(s,"dataview",ga),Gz(s,"correlationCenter",kq);const n=new ya(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(Eq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:SD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(Eq.mark.ripplePoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Eq.mark.centerPoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[_D],y:t=>t[yD],size:t=>t[bD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),_G("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Eq.type=dB.correlation,Eq.mark=EF,Eq.transformerConstructor=Cq;const Pq=()=>{jG(),Tq(),fz.registerSeries(Eq.type,Eq),fz.registerAnimation("correlation",((t,e)=>Object.assign({appear:wq(0,e)},JH)))};class Bq extends YH{constructor(){super(...arguments),this.type=Bq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Bq.type="liquid";const Rq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Lq extends pV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Oq extends TG{constructor(){super(...arguments),this.type=dB.liquid,this.transformerConstructor=zG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=kg({x:s,y:n,size:r,symbolType:Rq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=ej(this._spec.outlineMargin),this._paddingSpec=ej(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Oq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Oq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Oq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Oq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Lq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),_G("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),_G("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Oq.type=dB.liquid,Oq.mark=BF,Oq.transformerConstructor=zG;const Iq=t=>Y(t).join(",");class Dq extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Iq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Iq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Fq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class jq extends TG{constructor(){super(...arguments),this.type=dB.venn,this.transformerConstructor=Fq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:AD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(jq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(jq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},rH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},rH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Iq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},rH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Iq(t.sets)},rH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Dq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Iq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Iq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Iq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Iq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}}jq.type=dB.venn,jq.mark=RF,jq.transformerConstructor=Fq;class zq extends fW{_isValidSeries(t){return t===dB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class Hq extends gW{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="map",this.seriesType=dB.map}}Hq.type="map",Hq.seriesType=dB.map,Hq.transformerConstructor=zq;class Nq extends fW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Vq extends Nq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=DN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Rj({},s,l)),n&&Object.assign(o,Rj({},n,o))}}class Gq extends Nq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Wq extends Nq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,layoutRadius:t.layoutRadius})}}class Uq extends gW{constructor(){super(...arguments),this.transformerConstructor=Wq}}Uq.transformerConstructor=Wq;class Yq extends Uq{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="pie",this.seriesType=dB.pie}}Yq.type="pie",Yq.seriesType=dB.pie,Yq.transformerConstructor=Wq;class Kq extends Wq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Xq extends Uq{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="pie3d",this.seriesType=dB.pie3d}}Xq.type="pie3d",Xq.seriesType=dB.pie3d,Xq.transformerConstructor=Kq;class $q extends Gq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:LB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:LB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class qq extends gW{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="rose",this.seriesType=dB.rose,this._canStack=!0}}qq.type="rose",qq.seriesType=dB.rose,qq.transformerConstructor=$q;class Zq extends Gq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Rj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Jq extends gW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="radar",this.seriesType=dB.radar,this._canStack=!0}}Jq.type="radar",Jq.seriesType=dB.radar,Jq.transformerConstructor=Zq;class Qq extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Rj(e,pH(this.type,t))})),this._transformAxisSpec(t)}}class tZ extends gW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="common",this._canStack=!0}}tZ.type="common",tZ.transformerConstructor=Qq;class eZ extends vW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class iZ extends gW{constructor(){super(...arguments),this.transformerConstructor=eZ,this._canStack=!0}}iZ.transformerConstructor=eZ;class sZ extends eZ{transformSpec(t){super.transformSpec(t),cH(t)}}class nZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="histogram",this.seriesType=dB.bar}}nZ.type="histogram",nZ.seriesType=dB.bar,nZ.transformerConstructor=sZ;class rZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="histogram3d",this.seriesType=dB.bar3d}}rZ.type="histogram3d",rZ.seriesType=dB.bar3d,rZ.transformerConstructor=sZ;class aZ extends Vq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class oZ extends gW{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="circularProgress",this.seriesType=dB.circularProgress,this._canStack=!0}}oZ.type="circularProgress",oZ.seriesType=dB.circularProgress,oZ.transformerConstructor=aZ;class lZ extends Vq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:dB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===dB.gauge||t.type===dB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===dB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class hZ extends gW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="gauge",this.seriesType=dB.gaugePointer}}hZ.type="gauge",hZ.seriesType=dB.gaugePointer,hZ.transformerConstructor=lZ;class cZ extends fW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dZ extends gW{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}dZ.transformerConstructor=cZ;class uZ extends cZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class pZ extends dZ{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}pZ.type="wordCloud",pZ.seriesType=dB.wordCloud,pZ.transformerConstructor=uZ;class gZ extends cZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class mZ extends dZ{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="wordCloud3d",this.seriesType=dB.wordCloud3d}}mZ.type="wordCloud3d",mZ.seriesType=dB.wordCloud3d,mZ.transformerConstructor=gZ;class fZ extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class vZ extends gW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="funnel",this.seriesType=dB.funnel}}vZ.type="funnel",vZ.seriesType=dB.funnel,vZ.transformerConstructor=fZ;class _Z extends gW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="funnel3d",this.seriesType=dB.funnel3d}}_Z.type="funnel3d",_Z.seriesType=dB.funnel3d,_Z.transformerConstructor=fZ;class yZ extends vW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=DN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=DN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class bZ extends gW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="linearProgress",this.seriesType=dB.linearProgress,this._canStack=!0}}bZ.type="linearProgress",bZ.seriesType=dB.linearProgress,bZ.transformerConstructor=yZ;class xZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),cH(t)}}class SZ extends gW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="rangeColumn",this.seriesType=dB.rangeColumn}}SZ.type="rangeColumn",SZ.seriesType=dB.rangeColumn,SZ.transformerConstructor=xZ;class AZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class kZ extends gW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="rangeColumn3d",this.seriesType=dB.rangeColumn3d}}kZ.type="rangeColumn3d",kZ.seriesType=dB.rangeColumn3d,kZ.transformerConstructor=AZ;class MZ extends fW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:RB,i=p(t.endAngle)?t.endAngle:e+ee(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=dB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class TZ extends gW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="sunburst",this.seriesType=dB.sunburst}}TZ.type="sunburst",TZ.seriesType=dB.sunburst,TZ.transformerConstructor=MZ;class wZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=dB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CZ extends gW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="circlePacking",this.seriesType=dB.circlePacking}}CZ.type="circlePacking",CZ.seriesType=dB.circlePacking,CZ.transformerConstructor=wZ;class EZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class PZ extends gW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="treemap",this.seriesType=dB.treemap}}PZ.type="treemap",PZ.seriesType=dB.treemap,PZ.transformerConstructor=EZ;class BZ extends NW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),cH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class RZ extends VW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="waterfall",this.seriesType=dB.waterfall}}RZ.type="waterfall",RZ.seriesType=dB.waterfall,RZ.transformerConstructor=BZ;class LZ extends vW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),cH(t)}}class OZ extends gW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="boxPlot",this.seriesType=dB.boxPlot}}OZ.type="boxPlot",OZ.seriesType=dB.boxPlot,OZ.transformerConstructor=LZ;class IZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class DZ extends gW{constructor(){super(...arguments),this.transformerConstructor=IZ,this.type="sankey",this.seriesType=dB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}DZ.type="sankey",DZ.seriesType=dB.sankey,DZ.transformerConstructor=IZ;class FZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),cH(t)}}class jZ extends gW{constructor(){super(...arguments),this.transformerConstructor=FZ,this.type="rangeArea",this.seriesType=dB.rangeArea}}jZ.type="rangeArea",jZ.seriesType=dB.rangeArea,jZ.transformerConstructor=FZ;class zZ extends vW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class HZ extends gW{constructor(){super(...arguments),this.transformerConstructor=zZ,this.type="heatmap",this.seriesType=dB.heatmap}}HZ.type="heatmap",HZ.seriesType=dB.heatmap,HZ.transformerConstructor=zZ;class NZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=dB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class VZ extends gW{constructor(){super(...arguments),this.transformerConstructor=NZ,this.type="correlation",this.seriesType=dB.correlation}}VZ.type="correlation",VZ.seriesType=dB.correlation,VZ.transformerConstructor=NZ;function GZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mz(t.style)),B(t.textStyle)||Rj(s.textStyle,mz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mz(s.background.style),s}const WZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},UZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:kD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class YZ extends WG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=ZF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new GH(this._option,e),this._initSelectedData(),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(oB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Rj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}YZ.specKey="legends";class KZ extends YZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Gz(this._option.dataSet,"discreteLegendFilter",UZ),Gz(this._option.dataSet,"discreteLegendDataMake",WZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return oB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iz(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=GZ(s)),B(n.focusIconStyle)||mz(n.focusIconStyle),n.shape&&(n.shape=uz(n.shape)),n.label&&(n.label=uz(n.label)),n.value&&(n.value=uz(n.value)),n.background&&(n.background=uz(n.background)),JF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),JF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),JF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mz(r.railStyle),B(r.sliderStyle)||mz(r.sliderStyle)):(B(r.textStyle)||mz(r.textStyle),r.handler&&uz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Rj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return fP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(hP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(hP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(hP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=LN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=LN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}KZ.specKey="legends",KZ.type=r.discreteLegend;const XZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},$Z=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function qZ(t){return"color"===t||"size"===t}const ZZ={color:xP,size:AP},JZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],QZ=[2,10];class tJ extends YZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return qZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{qZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Gz(this._option.dataSet,"continuousLegendFilter",$Z),Gz(this._option.dataSet,"continuousLegendDataMake",XZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iz(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iz(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?JZ:QZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Rj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=GZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=mz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=mz(r.style)),B(a.style)||(w.trackStyle=mz(a.style)),w.startText=uz(o),w.endText=uz(l),w.handlerText=uz(h),B(c)||(w.sizeBackground=mz(c)),d.visible&&!B(d.style)&&(Rj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return ZZ[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}tJ.specKey="legends",tJ.type=r.continuousLegend;class eJ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Lz(n,a,!0))&&void 0!==e?e:[],...null!==(i=xz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Gw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=cV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=cV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(yV(s).every((t=>{var e;return!cV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=cV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=vV(t,i,s),m=_V(t,i,s),f=Rj({},I(e[t]),m),v=g.title,_=xV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=mV(f.title,Object.assign(Object.assign({},v),_)):f.title=mV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=bV(y);f.content=fV(f.content,(e=>xV(e,f,u.shape,t)))}else f.content=fV(y,(t=>xV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=CV(a,t,e),l=!!p(o)&&!1!==AV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class iJ extends eJ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class sJ extends eJ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class nJ extends eJ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const rJ=t=>p(t)&&!y(t),aJ=t=>p(t)&&y(t);class oJ extends GG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Rj({},this._theme,s.style),s.offset=Rj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=cV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}class lJ extends WG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=oJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&rJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&aJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&hN.globalConfig.uniqueTooltip&&l&&hN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?kV.canvas:kV.dom,n=fz.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new sJ(this),dimension:new iJ(this),group:new nJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(nb(i)||rb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=lV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(aJ(t)){if(rJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>vz(t,e[i])))))return!1}else{if(aJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&si(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}lJ.type=r.tooltip,lJ.transformerConstructor=oJ,lJ.specKey="tooltip";var hJ,cJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(hJ||(hJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(cJ||(cJ={}));const dJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class uJ extends WG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{dJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){Sz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=hB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=UN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=XN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=$N(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),GN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}pJ.specKey="crosshair",pJ.type=r.cartesianCrosshair;class gJ extends uJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:qt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=hB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Rj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=IN(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=IN(s.getSpec())),c.angle=a.angle,c.axis=s,Rj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=LN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=LN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:se(o,s,i),end:se(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},se(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ne(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=se(t,r,p),f=se(t,r,g),v=Re([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(qt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},se(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),GN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}gJ.specKey="crosshair",gJ.type=r.polarCrosshair;const mJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},fJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class vJ extends WG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Lt(s/n)>=.5:Lt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=Mz(t),this._isHorizontal="horizontal"===Tz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(Nw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};oB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=Nw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else oB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Wz(s,"dataview",ga),Gz(s,"dataFilterComputeDomain",fJ);const n=new ya(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new GH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(Nw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&Nw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Nw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new cC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Gz(this._option.dataSet,"dataFilterWithNewDomain",mJ),oB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>Nw(this._stateScale.type)},level:eH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Gw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Gw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(vJ,TU);class _J extends GG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Rj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class yJ extends vJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=_J,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new BC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Nw(t.type)||e[0]!==e[1])&&(!Gw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new hE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mz(g.style)},selectedBackgroundStyle:mz(this._spec.selectedBackground.style),dragMaskStyle:mz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Rj(mz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Rj(mz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=LN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}yJ.type=r.dataZoom,yJ.transformerConstructor=_J,yJ.specKey="dataZoom";class bJ extends vJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=QP(this._start,e)&&QP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}bJ.type=r.scrollBar,bJ.specKey="scrollBar";const xJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class SJ extends WG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==SJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Gz(this._option.dataSet,"indicatorFilter",xJ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new GH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Rj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?sj(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?sj(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},gz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new TP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}SJ.type=r.indicator,SJ.specKey="indicator";const AJ=["sum","average","min","max","variance","standardDeviation","median"];function kJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function MJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&kJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=JF(t.x)?EJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function TJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&kJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=JF(t.y)?EJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function wJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&kJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function CJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&kJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function EJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function PJ(t){return AJ.includes(t)}function BJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=MJ(t,m,n,d,h,a),i=TJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=MJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=TJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function RJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=wJ(t,l,n,r),i=CJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=wJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=CJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function LJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=JF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=JF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&kJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&kJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function OJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&kJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&kJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function IJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=EJ(e,r)),e+=s,JF(i)&&(i=EJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=EJ(e,s)),JF(i)&&(i=EJ(i,n)),{x:e,y:i}}))}function DJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function FJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},mz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},zJ(mz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=zJ(mz(n),i)),t}return{visible:!1}}function jJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function zJ(t,e){return d(t)?t(e):t}function HJ(t,e){return d(t)?t(e):t}function NJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function VJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function GJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function WJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function UJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>KJ(i,t,e))):s.x=KJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>KJ(i,t,e))):s.y=KJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>KJ(i,t,e))):s.angle=KJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>KJ(i,t,e))):s.radius=KJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=KJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const YJ={min:(t,e)=>tB(t[0].latestData,e.field),max:(t,e)=>eB(t[0].latestData,e.field),sum:function(t,e){return iB(t[0].latestData,e.field)},average:function(t,e){return sB(t[0].latestData,e.field)},variance:function(t,e){return nB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(nB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function KJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return YJ[i](e,{field:s})}return t}class XJ extends WG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&PJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&PJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&PJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&PJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&PJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new va;return e.registerParser("array",s),new ya(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=hB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=QF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function $J(t,e){return function(t,e,i){const{predict:s}=Sb(t,(t=>t[e]),(t=>t[i])),n=tB(t,e),r=eB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function qJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class ZJ extends XJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=VJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:zJ(mz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:FJ(y,this._markerData),state:{line:jJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:jJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:jJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:jJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:jJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:mz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:mz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=VJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerRegression",$J),Gz(this._option.dataSet,"markerFilter",qJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ya(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}ZJ.specKey="markLine";class JJ extends ZJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=VJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=BJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=LJ(i,r,d,e.coordinatesOffset):c&&(y=IJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(JF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=VJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}JJ.type=r.markLine,JJ.coordinateType="cartesian";class QJ extends ZJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=VJ(this._spec);return e||i?new JE(t):new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=VJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=RJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>se(m,t.radius,t.angle)))}}else u&&(p=OJ(i,r,a),g={points:p.map((t=>se(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=VJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}QJ.type=r.polarMarkLine,QJ.coordinateType="polar";class tQ extends WG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=ZF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new kP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}tQ.type=r.title,tQ.specKey=r.title;class eQ extends XJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=GJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:zJ(mz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:FJ(u,this._markerData),state:{area:jJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:jJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:jJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=GJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerFilter",qJ);const c=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}eQ.specKey="markArea";class iQ extends eQ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=GJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=BJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=BJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=LJ(i,r,d,e.coordinatesOffset):c&&(u=IJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=GJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}iQ.type=r.markArea,iQ.coordinateType="cartesian";class sQ extends eQ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=GJ(this._spec);return i||e||s?new QE(t):new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=GJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=RJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=OJ(i,r,c),u={points:d.map((t=>se(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=GJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}sQ.type=r.polarMarkArea,sQ.coordinateType="polar";const nQ=t=>mz(Object.assign({},t)),rQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mz(t.style))}),aQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=nQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=nQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mz(Object.assign({},y)));var y;const b=rQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=rQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=rQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=rQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},oQ=t=>"left"===t||"right"===t,lQ=t=>"top"===t||"bottom"===t;class hQ extends WG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},aQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},aQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new HP(t):this._playerComponent=new GP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=oQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=oQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=oQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=lQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):oQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):lQ(this._orient)?this._maxSize():t.height}_computeDx(t){return oQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return lQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}hQ.specKey="player",hQ.type=r.player;class cQ extends WG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}cQ.type=r.label;class dQ extends dY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}dQ.type="text",dQ.constructorType="label";const uQ=()=>{fz.registerMark(dQ.constructorType,dQ),SO()};class pQ extends GG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class gQ extends cQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=pQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),oB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Rj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=YU[t])&&void 0!==i?i:YU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:KU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}gQ.type=r.label,gQ.specKey="label",gQ.transformerConstructor=pQ;class mQ extends cQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[OD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Rj({textStyle:{pickable:!0===this._spec.interactive},position:fQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[DD]))},a))}})).encode((e=>KU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function fQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}mQ.type=r.totalLabel,mQ.specKey="totalLabel";class vQ extends XJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=WJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:HJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:HJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:zJ(B.style,this._markerData)},state:{line:jJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:jJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:jJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:jJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:jJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:jJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:jJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:jJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:jJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:jJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=mz(zJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=zJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=FJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=zJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mz(z.style)}):{visible:!1};return new eP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:NJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:NJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=WJ(t);if(!(p(t.coordinate)||e||i||s))return;Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerFilter",qJ);const{options:n}=this._computeOptions(),r=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}vQ.specKey="markPoint";class _Q extends vQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=BJ(i,s,s,s,o)[0][0]:r?l=LJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=IJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=WJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}_Q.type=r.markPoint,_Q.coordinateType="cartesian";class yQ extends vQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=RJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:se({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}yQ.type=r.polarMarkPoint,yQ.coordinateType="polar";class bQ extends vQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}bQ.type=r.geoMarkPoint,bQ.coordinateType="geo";const xQ="inBrush",SQ="outOfBrush";class AQ extends WG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),xQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),SQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new KP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(NP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,SQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(NP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(NP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(xQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(xQ),i.addState(SQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(xQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(xQ),i.addState(SQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ze(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ze(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(xQ),i.removeState(SQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}AQ.type=r.brush,AQ.specKey="brush";class kQ extends WG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${pB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=vG({},_G(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Jt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Jt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}kQ.type=r.customMark,kQ.specKey="customMark";function MQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function TQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function wQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:TQ(t.rect),anchorCandidates:LQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>MQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tMQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function CQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Ue(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=BQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ci(r,s,i);if(!BQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],EQ(PQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=EQ(PQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=RQ(t.rect,a,0),t}));return wQ(h)}function EQ(t){return t>180?t-360:t}function PQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function BQ(t,e){for(let i=0;i{const{x:r,y:a}=RQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class OQ extends WG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ya(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:eH.copyDataView},!1),this._data=new GH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new eP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=ej(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Cu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Pg(mz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=kg(mz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=yp(mz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=yp(mz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=RQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):wQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}OQ.type=r.mapLabel,OQ.specKey="mapLabel";class IQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>DQ(t))),a=n.filter((t=>!DQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>DQ(t))),h=o.filter((t=>!DQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function DQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}IQ.type="grid";hN.useRegisters([()=>{aI(),oI(),IG(),jG(),sN(),tN(),aW(),sW(),fz.registerSeries(cW.type,cW),fz.registerChart(yW.type,yW)},()=>{aI(),oI(),IG(),xW(),jG(),AW(),aW(),sW(),fz.registerSeries(MW.type,MW),fz.registerChart(wW.type,wW)},()=>{HW(),fz.registerChart(VW.type,VW)},()=>{eU(),fz.registerChart(sU.type,sU)},()=>{VY(),fz.registerChart(Yq.type,Yq)},()=>{aK(),fz.registerChart(qq.type,qq)},()=>{gK(),fz.registerChart(Jq.type,Jq)},()=>{HW(),fz.registerChart(nZ.type,nZ)},()=>{RU(),fz.registerChart(Hq.type,Hq)},()=>{dq(),fz.registerSeries(pq.type,pq),DY(),MK(),iK(),fz.registerChart(hZ.type,hZ)},()=>{gX(),fz.registerChart(pZ.type,pZ)},()=>{OX(),fz.registerChart(vZ.type,vZ)},()=>{sY(),fz.registerChart(RZ.type,RZ)},()=>{hY(),jG(),tN(),aW(),sW(),fz.registerSeries(cY.type,cY),fz.registerChart(OZ.type,OZ)},()=>{fz.registerSeries(wK.type,wK),DY(),MK(),eN(),nK(),iK(),fz.registerChart(oZ.type,oZ)},()=>{OK(),fz.registerChart(bZ.type,bZ)},()=>{xY(),fz.registerChart(SZ.type,SZ)},()=>{xW(),aW(),sW(),fz.registerSeries(kY.type,kY),fz.registerChart(jZ.type,jZ)},()=>{w$(),fz.registerChart(TZ.type,TZ)},()=>{R$(),fz.registerChart(CZ.type,CZ)},()=>{aq(),fz.registerChart(PZ.type,PZ)},()=>{tq(),fz.registerChart(DZ.type,DZ)},()=>{bq(),fz.registerChart(HZ.type,HZ)},()=>{Pq(),fz.registerChart(VZ.type,VZ)},()=>{fz.registerChart(tZ.type,tZ)},sW,aW,()=>{$G(),fz.registerComponent(oW.type,oW)},()=>{$G(),fz.registerComponent(lW.type,lW)},()=>{$G(),fz.registerComponent(hW.type,hW)},nK,iK,()=>{fz.registerComponent(KZ.type,KZ)},()=>{fz.registerComponent(tJ.type,tJ)},()=>{fz.registerComponent(lJ.type,lJ)},()=>{fz.registerComponent(pJ.type,pJ)},()=>{fz.registerComponent(gJ.type,gJ)},()=>{fz.registerComponent(yJ.type,yJ)},()=>{fz.registerComponent(bJ.type,bJ)},()=>{fz.registerComponent(SJ.type,SJ)},EU,()=>{fz.registerComponent(JJ.type,JJ),XE()},()=>{fz.registerComponent(iQ.type,iQ),qE()},()=>{fz.registerComponent(_Q.type,_Q),tP()},()=>{fz.registerComponent(QJ.type,QJ),JE._animate=PE,XE()},()=>{fz.registerComponent(sQ.type,sQ),QE._animate=RE,qE()},()=>{fz.registerComponent(yQ.type,yQ),tP()},()=>{fz.registerComponent(bQ.type,bQ),tP()},()=>{fz.registerComponent(tQ.type,tQ)},()=>{fz.registerComponent(hQ.type,hQ)},()=>{WO(),uQ(),YG(),fz.registerComponent(gQ.type,gQ,!0)},()=>{WO(),uQ(),YG(),fz.registerComponent(mQ.type,mQ,!0)},()=>{fz.registerComponent(AQ.type,AQ)},()=>{fz.registerComponent(kQ.type,kQ)},()=>{fz.registerComponent(OQ.type,OQ)},()=>{th.load(pT)},()=>{fz.registerLayout(IQ.type,IQ)},iG,yN,qR,$R]),hN.useRegisters([()=>{gA(th)}]),t.ARC_END_ANGLE=MB,t.ARC_K=TB,t.ARC_MIDDLE_ANGLE=wB,t.ARC_QUADRANT=CB,t.ARC_RADIAN=EB,t.ARC_RATIO=AB,t.ARC_START_ANGLE=kB,t.ARC_TRANSFORM_VALUE=SB,t.AxisSyncPlugin=wN,t.BASE_EVENTS=pD,t.CORRELATION_SIZE=bD,t.CORRELATION_X=_D,t.CORRELATION_Y=yD,t.CanvasTooltipHandler=eG,t.DEFAULT_CHART_HEIGHT=mB,t.DEFAULT_CHART_WIDTH=gB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=WD,t.DEFAULT_DATA_INDEX=SD,t.DEFAULT_DATA_KEY=AD,t.DEFAULT_DATA_SERIES_FIELD=kD,t.DEFAULT_GRADIENT_CONFIG=UD,t.DEFAULT_LABEL_ALIGN=vB,t.DEFAULT_LABEL_LIMIT=fB,t.DEFAULT_LABEL_TEXT=_B,t.DEFAULT_LABEL_VISIBLE=yB,t.DEFAULT_LABEL_X=bB,t.DEFAULT_LABEL_Y=xB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=VD,t.DEFAULT_MEASURE_CANVAS_ID=xD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=GD,t.DEFAULT_SERIES_STYLE_NAME=MD,t.DomTooltipHandler=tG,t.Factory=fz,t.FormatterPlugin=_N,t.GradientType=ND,t.MediaQuery=gN,t.POLAR_DEFAULT_RADIUS=LB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=BB,t.POLAR_START_ANGLE=RB,t.POLAR_START_RADIAN=PB,t.PREFIX=pB,t.SEGMENT_FIELD_END=jD,t.SEGMENT_FIELD_START=FD,t.STACK_FIELD_END=ED,t.STACK_FIELD_END_OffsetSilhouette=LD,t.STACK_FIELD_END_PERCENT=BD,t.STACK_FIELD_KEY=wD,t.STACK_FIELD_START=CD,t.STACK_FIELD_START_OffsetSilhouette=RD,t.STACK_FIELD_START_PERCENT=PD,t.STACK_FIELD_TOTAL=OD,t.STACK_FIELD_TOTAL_PERCENT=ID,t.STACK_FIELD_TOTAL_TOP=DD,t.ThemeManager=qj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=hN,t.WaterfallDefaultSeriesField=vD,t.builtinThemes=zj,t.computeActualDataScheme=zF,t.darkTheme=Mj,t.dataScheme=nj,t.default=hN,t.defaultThemeName=Hj,t.getActualColor=NF,t.getColorSchemeBySeries=UF,t.getDataScheme=jF,t.getMergedTheme=Xj,t.getTheme=Uj,t.hasThemeMerged=Gj,t.isColorKey=VF,t.isProgressiveDataColorScheme=GF,t.isTokenKey=Sj,t.lightTheme=kj,t.queryColorFromColorScheme=HF,t.queryToken=xj,t.registerCanvasTooltipHandler=iG,t.registerChartPlugin=pN,t.registerDomTooltipHandler=()=>{QV(tG)},t.registerFormatPlugin=yN,t.registerMediaQuery=()=>{pN(gN)},t.registerTheme=Wj,t.removeTheme=Yj,t.themeExist=Kj,t.themes=Nj,t.token=Aj,t.transformColorSchemeToStandardStruct=WF,t.version="1.11.12",t.vglobal=O_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/harmony_vchart/library/oh-package.json5 b/packages/harmony_vchart/library/oh-package.json5 index 9b7ffad34e..41da8fb571 100644 --- a/packages/harmony_vchart/library/oh-package.json5 +++ b/packages/harmony_vchart/library/oh-package.json5 @@ -1,6 +1,6 @@ { name: '@visactor/harmony-vchart', - version: '1.11.11', + version: '1.11.12', description: '@visactor/vchart 针对 harmonyOS 打造的图表库,拥有非常酷炫的动画能力,近20种图表类型,以及原生的渲染性能', main: 'Index.ets', author: { diff --git a/packages/harmony_vchart/library/src/main/ets/vchart_dist.js b/packages/harmony_vchart/library/src/main/ets/vchart_dist.js index c800a6cdda..4bf0f01758 100644 --- a/packages/harmony_vchart/library/src/main/ets/vchart_dist.js +++ b/packages/harmony_vchart/library/src/main/ets/vchart_dist.js @@ -17525,20 +17525,21 @@ class Wrapper { this.frame.lines.push(line), this.frame.actualHeight += line.height, this.y += line.height, this.lineBuffer.length = 0, this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0; } deal(paragraph) { - paragraph instanceof RichTextIcon ? "horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : 0 === this.lineBuffer.length ? (this.store(paragraph), this.send()) : (this.send(), this.deal(paragraph)) : "number" != typeof this.width || this.width < 0 || (paragraph.newLine && this.send(), 0 !== paragraph.text.length && ("horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : this.lineWidth === this[this.directionKey.width] ? (this.send(), this.deal(paragraph)) : this.cut(paragraph))); + let singleLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1; + paragraph instanceof RichTextIcon ? "horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : 0 === this.lineBuffer.length ? (this.store(paragraph), this.send()) : (this.send(), this.deal(paragraph)) : "number" != typeof this.width || this.width < 0 || (paragraph.newLine && this.send(), 0 !== paragraph.text.length && ("horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : this.lineWidth === this[this.directionKey.width] ? (this.send(), this.deal(paragraph)) : this.cut(paragraph, singleLine))); } - cut(paragraph) { + cut(paragraph, singleLine) { const availableWidth = this[this.directionKey.width] - this.lineWidth || 0, guessIndex = Math.ceil(availableWidth / paragraph[this.directionKey.width] * paragraph.length) || 0, index = getStrByWithCanvas(paragraph.text, availableWidth, paragraph.character, guessIndex, "break-word" === this.frame.wordBreak); if (0 !== index) { const [p1, p2] = seperateParagraph(paragraph, index); - this.store(p1), this.deal(p2); + this.store(p1), singleLine ? this.send() : this.deal(p2); } else 0 !== this.lineBuffer.length && (this.send(), this.deal(paragraph)); } } -const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", ...GRAPHIC_UPDATE_TAG_KEY]; +const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY]; class RichText extends Graphic { constructor(params) { super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE; @@ -17710,7 +17711,7 @@ class RichText extends Graphic { skip = !1; for (let i = 0; i < paragraphs.length; i++) { const p = paragraphs[i]; - skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0); + skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p, !0), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0), wrapper.send(); } } else for (let i = 0; i < paragraphs.length; i++) wrapper.deal(paragraphs[i]); wrapper.send(); @@ -17751,10 +17752,11 @@ class RichText extends Graphic { let pickIcon; return frameCache.icons.forEach(icon => { var _a, _b; - icon.AABBBounds.containsPoint({ + const bounds = icon.AABBBounds.clone(); + bounds.translate(icon._marginArray[3], icon._marginArray[0]), bounds.containsPoint({ x: point.x - x, y: point.y - y - }) && (pickIcon = icon, pickIcon.globalX = (null !== (_a = pickIcon.attribute.x) && void 0 !== _a ? _a : 0) + x, pickIcon.globalY = (null !== (_b = pickIcon.attribute.y) && void 0 !== _b ? _b : 0) + y); + }) && (pickIcon = icon, pickIcon.globalX = (null !== (_a = pickIcon.attribute.x) && void 0 !== _a ? _a : 0) + x + icon._marginArray[3], pickIcon.globalY = (null !== (_b = pickIcon.attribute.y) && void 0 !== _b ? _b : 0) + y + icon._marginArray[0]); }), pickIcon; } getNoWorkAnimateAttr() { @@ -19858,7 +19860,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution(); const halfPi = pi$1 / 2; -function createRectPath(path, x, y, width, height, rectCornerRadius) { +function createRectPath(path, x, y, width, height, rectCornerRadius, edgeCb) { let cornerRadius; if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$1(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs$1(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) { const cornerRadiusArr = rectCornerRadius; @@ -19890,27 +19892,28 @@ function createRectPath(path, x, y, width, height, rectCornerRadius) { rightBottomPoint2 = [rightBottom[0], rightBottom[1] - _cornerRadius[2]], leftBottomPoint1 = [leftBottom[0] + _cornerRadius[3], leftBottom[1]], leftBottomPoint2 = [leftBottom[0], leftBottom[1] - _cornerRadius[3]]; - if (path.moveTo(leftTopPoint1[0], leftTopPoint1[1]), path.lineTo(rightTopPoint1[0], rightTopPoint1[1]), !arrayEqual(rightTopPoint1, rightTopPoint2)) { + if (path.moveTo(leftTopPoint1[0], leftTopPoint1[1]), edgeCb && edgeCb[0] ? edgeCb[0](leftTopPoint1[0], leftTopPoint1[1], rightTopPoint1[0], rightTopPoint1[1]) : path.lineTo(rightTopPoint1[0], rightTopPoint1[1]), !arrayEqual(rightTopPoint1, rightTopPoint2)) { + edgeCb && edgeCb[0] && path.moveTo(rightTopPoint1[0], rightTopPoint1[1]); const centerX = rightTopPoint1[0], centerY = rightTopPoint1[1] + _cornerRadius[1]; path.arc(centerX, centerY, _cornerRadius[1], -halfPi, 0, !1); } - if (path.lineTo(rightBottomPoint2[0], rightBottomPoint2[1]), !arrayEqual(rightBottomPoint1, rightBottomPoint2)) { + if (edgeCb && edgeCb[1] ? edgeCb[1](rightTopPoint2[0], rightTopPoint2[1], rightBottomPoint2[0], rightBottomPoint2[1]) : path.lineTo(rightBottomPoint2[0], rightBottomPoint2[1]), !arrayEqual(rightBottomPoint1, rightBottomPoint2)) { const centerX = rightBottomPoint2[0] - _cornerRadius[2], centerY = rightBottomPoint2[1]; - path.arc(centerX, centerY, _cornerRadius[2], 0, halfPi, !1); + edgeCb && edgeCb[1] && path.moveTo(rightBottomPoint2[0], rightBottomPoint2[1]), path.arc(centerX, centerY, _cornerRadius[2], 0, halfPi, !1); } - if (path.lineTo(leftBottomPoint1[0], leftBottomPoint1[1]), !arrayEqual(leftBottomPoint1, leftBottomPoint2)) { + if (edgeCb && edgeCb[2] ? edgeCb[2](rightBottomPoint1[0], rightBottomPoint1[1], leftBottomPoint1[0], leftBottomPoint1[1]) : path.lineTo(leftBottomPoint1[0], leftBottomPoint1[1]), !arrayEqual(leftBottomPoint1, leftBottomPoint2)) { const centerX = leftBottomPoint1[0], centerY = leftBottomPoint1[1] - _cornerRadius[3]; - path.arc(centerX, centerY, _cornerRadius[3], halfPi, pi$1, !1); + edgeCb && edgeCb[2] && path.moveTo(leftBottomPoint1[0], leftBottomPoint1[1]), path.arc(centerX, centerY, _cornerRadius[3], halfPi, pi$1, !1); } - if (path.lineTo(leftTopPoint2[0], leftTopPoint2[1]), !arrayEqual(leftTopPoint1, leftTopPoint2)) { + if (edgeCb && edgeCb[3] ? edgeCb[3](leftBottomPoint2[0], leftBottomPoint2[1], leftTopPoint2[0], leftTopPoint2[1]) : path.lineTo(leftTopPoint2[0], leftTopPoint2[1]), !arrayEqual(leftTopPoint1, leftTopPoint2)) { const centerX = leftTopPoint1[0], centerY = leftTopPoint1[1] + _cornerRadius[0]; - path.arc(centerX, centerY, _cornerRadius[0], pi$1, pi$1 + halfPi, !1); + edgeCb && edgeCb[3] && path.moveTo(leftTopPoint2[0], leftTopPoint2[1]), path.arc(centerX, centerY, _cornerRadius[0], pi$1, pi$1 + halfPi, !1); } - return path.closePath(), path; + return !edgeCb && path.closePath(), path; } var __decorate$1w = undefined && undefined.__decorate || function (decorators, target, key, desc) { @@ -19999,14 +20002,24 @@ let SplitRectAfterRenderContribution = class { y1: y1, x: originX = groupAttribute.x, y: originY = groupAttribute.y, - stroke = groupAttribute.stroke + stroke = groupAttribute.stroke, + cornerRadius = groupAttribute.cornerRadius } = rect.attribute; let { width: width, height: height } = rect.attribute; if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0, Array.isArray(stroke) && stroke.some(s => !1 === s)) { - if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), context.beginPath(), context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y), stroke[1] ? context.lineTo(x + width, y + height) : context.moveTo(x + width, y + height), stroke[2] ? context.lineTo(x, y + height) : context.moveTo(x, y + height), stroke[3]) { + if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), !(0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num))) { + let lastStroke, + lastStrokeI = 0; + return createRectPath(context, x, y, width, height, cornerRadius, new Array(4).fill(0).map((_, i) => (x1, y1, x2, y2) => { + stroke[i] && (lastStrokeI === i - 1 && stroke[i] === lastStroke || (context.setStrokeStyle(rect, Object.assign(Object.assign({}, rect.attribute), { + stroke: stroke[i] + }), x, y, groupAttribute), context.beginPath(), context.moveTo(x1, y1), lastStroke = stroke[i]), lastStrokeI = i, context.lineTo(x2, y2), context.stroke(), 3 === i && context.beginPath()); + })), void context.stroke(); + } + if (context.beginPath(), context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y), stroke[1] ? context.lineTo(x + width, y + height) : context.moveTo(x + width, y + height), stroke[2] ? context.lineTo(x, y + height) : context.moveTo(x, y + height), stroke[3]) { const adjustY = stroke[0] ? y - context.lineWidth / 2 : y; context.lineTo(x, adjustY); } else context.moveTo(x, y); @@ -20915,9 +20928,9 @@ let DefaultCanvasAreaRender = class extends BaseRender { data = this.valid(area, areaAttribute, fillCb, strokeCb); if (!data) return; const { - doFill: doFill, - doStroke: doStroke + doFill: doFill } = data, + doStroke = data.doStroke && data.sVisible, { clipRange = areaAttribute.clipRange, closePath: closePath, @@ -21734,7 +21747,9 @@ let DefaultCanvasGroupRender = class { clip: clip, baseOpacity = 1 } = group.attribute; - clip ? context.save() : context.highPerformanceSave(), context.baseGlobalAlpha *= baseOpacity; + clip ? context.save() : context.highPerformanceSave(); + const baseGlobalAlpha = context.baseGlobalAlpha; + context.baseGlobalAlpha *= baseOpacity; const groupAttribute = getTheme$1(group, null == params ? void 0 : params.theme).group, lastModelMatrix = context.modelMatrix; if (context.camera) { @@ -21748,7 +21763,7 @@ let DefaultCanvasGroupRender = class { scrollY = groupAttribute.scrollY } = group.attribute; let p; - (scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.drawingCb && (p = params.drawingCb()), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha /= baseOpacity, p && p.then ? p.then(() => { + (scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.drawingCb && (p = params.drawingCb()), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha = baseGlobalAlpha, p && p.then ? p.then(() => { clip ? context.restore() : context.highPerformanceRestore(); }) : clip ? context.restore() : context.highPerformanceRestore(); } @@ -21881,7 +21896,7 @@ class ShadowRootDrawItemInterceptorContribution { const m = graphic.globalTransMatrix.getInverse(); drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds); } - return drawContribution.renderGroup(graphic.shadowRoot, drawContext, graphic.parent.globalTransMatrix), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && (drawContribution.dirtyBounds.copy(tempDirtyBounds), drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds)), !0; + return drawContribution.renderGroup(graphic.shadowRoot, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && (drawContribution.dirtyBounds.copy(tempDirtyBounds), drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds)), !0; } } class DebugDrawItemInterceptorContribution { @@ -25558,7 +25573,7 @@ function isMobileLikeMode(mode) { return isMiniAppLikeMode(mode) || mode === 'mobile-browser'; } function isMiniAppLikeMode(mode) { - return mode.includes('miniApp') || mode === 'lynx' || mode === 'wx'; + return mode.includes('miniApp') || mode === 'lynx' || mode === 'wx' || mode === 'harmony'; } let VChartId = 0; @@ -26480,7 +26495,7 @@ let BrowserContext2d = class { opacity = defaultParams.opacity, fill = defaultParams.fill } = attribute; - fillOpacity > 1e-12 && opacity > 1e-12 ? (_context.globalAlpha = fillOpacity * opacity * this.baseGlobalAlpha, _context.fillStyle = createColor(this, fill, params, offsetX, offsetY)) : _context.globalAlpha = fillOpacity * opacity * this.baseGlobalAlpha; + _context.globalAlpha = fillOpacity * opacity * this.baseGlobalAlpha, fillOpacity > 1e-12 && opacity > 1e-12 && (_context.fillStyle = createColor(this, fill, params, offsetX, offsetY)); } setShadowBlendStyle(params, attribute, defaultParams) { if (Array.isArray(defaultParams)) { @@ -26523,7 +26538,7 @@ let BrowserContext2d = class { strokeOpacity = defaultParams.strokeOpacity, opacity = defaultParams.opacity } = attribute; - if (strokeOpacity > 1e-12 && opacity > 1e-12) { + if (_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, strokeOpacity > 1e-12 && opacity > 1e-12) { const { lineWidth = defaultParams.lineWidth, stroke = defaultParams.stroke, @@ -26532,7 +26547,7 @@ let BrowserContext2d = class { lineCap = defaultParams.lineCap, miterLimit = defaultParams.miterLimit } = attribute; - _context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit; + _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit; } } setTextStyleWithoutAlignBaseline(params, defaultParams, z) { @@ -34525,6 +34540,21 @@ function getPolarAngleLabelPosition(angle, center, radius, labelOffset, inside, labelPoint = getVerticalCoord(point, getCircleVerticalVector(labelOffset, point, center, inside)); return getCircleLabelPosition(labelPoint, getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside), text, style); } +function getCirclePoints(center, count, radius, startAngle, endAngle) { + const points = [], + range = endAngle - startAngle; + for (let i = 0; i < count; i++) { + const angle = startAngle + i * range / count; + points.push(polarToCartesian$1(center, radius, angle)); + } + return points; +} +function getPolygonPath(points, closed) { + let path = ""; + return 0 === points.length || (points.forEach((point, index) => { + 0 === index ? path = `M${point.x},${point.y}` : path += `L${point.x},${point.y}`; + }), closed && (path += "Z")), path; +} const dispatchHoverState = (e, container, lastHover) => { const target = e.target; @@ -35546,19 +35576,27 @@ class CircleAxis extends AxisBase { center: center, innerRadius = 0, line = {}, - inside = !1 + inside = !1, + sides: sides } = this.attribute; - let arcRadius = radius, + let lineGraphic, + arcRadius = radius, arcInnerRadius = innerRadius; - inside && innerRadius > 0 && (arcRadius = innerRadius, arcInnerRadius = 0); - const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { + if (inside && innerRadius > 0 && (arcRadius = innerRadius, arcInnerRadius = 0), isValidNumber$1(sides) && sides >= 3) { + const gridPoints = getCirclePoints(center, sides, arcRadius, startAngle, endAngle); + lineGraphic = graphicCreator.path(Object.assign(Object.assign({}, line.style), { + path: getPolygonPath(gridPoints, !0) + })); + } else { + const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle: startAngle, endAngle: endAngle, radius: arcRadius, innerRadius: arcInnerRadius - }), line.style), - axisLine = graphicCreator.circle(arcAttrs); - axisLine.name = AXIS_ELEMENT_NAME.line, axisLine.id = this._getNodeId("line"), isEmpty(line.state) || (axisLine.states = merge$2({}, DEFAULT_STATES$1, line.state)), container.add(axisLine); + }), line.style); + lineGraphic = graphicCreator.circle(arcAttrs); + } + lineGraphic.name = AXIS_ELEMENT_NAME.line, lineGraphic.id = this._getNodeId("line"), isEmpty(line.state) || (lineGraphic.states = merge$2({}, DEFAULT_STATES$1, line.state)), container.add(lineGraphic); } getTitleAttribute() { var _a, _b, _c; @@ -35712,7 +35750,7 @@ class GroupTransition extends ACustomAnimate { onStart() { let duration = this.duration, easing = this.easing; - Object.keys(this._newElementAttrMap).forEach(id => { + this._newElementAttrMap && Object.keys(this._newElementAttrMap).forEach(id => { var _a; const { node: node, @@ -37114,12 +37152,6 @@ const ticks = (scale, op) => { return convertDomainToTickData(scale.domain()); }; -function getLinePath(points, closed) { - let path = ""; - return 0 === points.length || (points.forEach((point, index) => { - 0 === index ? path = `M${point.x},${point.y}` : path += `L${point.x},${point.y}`; - }), closed && (path += "Z")), path; -} function getArcPath(center, points, reverse, closed) { let path = ""; if (!center || 0 === points.length) return path; @@ -37142,7 +37174,7 @@ function getRegionPath(from, to, attribute) { const fromStart = from[0], toEnd = reversePoints[0], center = attribute.center; - regionPath = getLinePath(from, !!closed), nextPath = getLinePath(reversePoints, !!closed); + regionPath = getPolygonPath(from, !!closed), nextPath = getPolygonPath(reversePoints, !!closed); const toEndRadius = PointService.distancePP(toEnd, center), fromStartRadius = PointService.distancePP(fromStart, center); regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`, nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`; @@ -37151,7 +37183,7 @@ function getRegionPath(from, to, attribute) { center: center } = attribute; regionPath = getArcPath(center, from, !1, !!closed), nextPath = getArcPath(center, reversePoints, !0, !!closed); - } else "line" !== type && "polygon" !== type || (regionPath = getLinePath(from, !!closed), nextPath = getLinePath(reversePoints, !!closed)); + } else "line" !== type && "polygon" !== type || (regionPath = getPolygonPath(from, !!closed), nextPath = getPolygonPath(reversePoints, !!closed)); return closed ? regionPath += nextPath : (nextPath = "L" + nextPath.substring(1), regionPath += nextPath, regionPath += "Z"), regionPath; } class BaseGrid extends AbstractComponent { @@ -37212,7 +37244,7 @@ class BaseGrid extends AbstractComponent { points: points } = item; let path = ""; - if ("line" === type || "polygon" === type) path = getLinePath(points, !!closed);else if ("circle" === type) { + if ("line" === type || "polygon" === type) path = getPolygonPath(points, !!closed);else if ("circle" === type) { const { center: center } = this.attribute; @@ -37238,7 +37270,7 @@ class BaseGrid extends AbstractComponent { x: points[0].x + dir_x * ratio, y: points[0].y + dir_y * ratio }); - const path = getLinePath(nextPoints, !!closed), + const path = getPolygonPath(nextPoints, !!closed), deltaX = abs$1(nextPoints[0].x - nextPoints[1].x), deltaY = abs$1(nextPoints[0].y - nextPoints[1].y), shape = graphicCreator.path(Object.assign({ @@ -37288,15 +37320,6 @@ BaseGrid.defaultAttributes = { } }; -function getCirclePoints(center, count, radius, startAngle, endAngle) { - const points = [], - range = endAngle - startAngle; - for (let i = 0; i < count; i++) { - const angle = startAngle + i * range / count; - points.push(polarToCartesian$1(center, radius, angle)); - } - return points; -} loadLineAxisGridComponent(); class LineAxisGrid extends BaseGrid { constructor(attributes, options) { @@ -37311,12 +37334,13 @@ class LineAxisGrid extends BaseGrid { gridPoints = [point, this.getVerticalCoord(point, length, !0)]; } else if ("circle" === gridType || "polygon" === gridType) { const { - center: center, - sides = 6, - startAngle = POLAR_START_ANGLE$1, - endAngle = POLAR_END_ANGLE$1 - } = this.attribute; - gridPoints = getCirclePoints(center, sides, PointService.distancePP(center, point), startAngle, endAngle); + center: center, + sides = 6, + startAngle = POLAR_START_ANGLE$1, + endAngle = POLAR_END_ANGLE$1 + } = this.attribute, + distance = PointService.distancePP(center, point); + gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle); } return gridPoints; } @@ -40703,12 +40727,13 @@ let DiscreteLegend$1 = class DiscreteLegend extends LegendBase { _createPager(compStyle) { var _a, _b; const { - disableTriggerEvent: disableTriggerEvent, - maxRow: maxRow - } = this.attribute; + disableTriggerEvent: disableTriggerEvent, + maxRow: maxRow + } = this.attribute, + estimateTotal = num => num <= 99 ? 99 : num <= 999 ? 999 : 9999; return this._itemContext.isHorizontal ? new Pager(Object.assign(Object.assign({ layout: 1 === maxRow ? "horizontal" : "vertical", - total: 99 + total: estimateTotal(this._itemContext.pages) }, merge$2({ handler: { preShape: "triangleUp", @@ -40719,7 +40744,7 @@ let DiscreteLegend$1 = class DiscreteLegend extends LegendBase { disableTriggerEvent: disableTriggerEvent })) : new Pager(Object.assign({ layout: "horizontal", - total: 99, + total: estimateTotal(this._itemContext.pages), disableTriggerEvent: disableTriggerEvent, defaultCurrent: null === (_b = this.attribute.pager) || void 0 === _b ? void 0 : _b.defaultCurrent }, compStyle)); @@ -55871,10 +55896,6 @@ const getPolarDimensionInfo = (chart, pos) => { if (!chart) { return null; } - const series = getFirstSeries(chart.getRegionsInIndex(), 'polar'); - if (!series) { - return null; - } const { x, y } = pos; const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos); const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos); @@ -56019,10 +56040,6 @@ const getCartesianDimensionInfo = (chart, pos, isTooltip) => { if (!chart) { return null; } - const series = getFirstSeries(chart.getRegionsInIndex(), 'cartesian'); - if (!series) { - return null; - } const { x, y } = pos; const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : []; const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : []; @@ -57550,7 +57567,8 @@ function mergeUpdateResult(target, ...sources) { reRender: merge('reRender'), reSize: merge('reSize'), reTransformSpec: merge('reTransformSpec'), - changeTheme: merge('changeTheme') + changeTheme: merge('changeTheme'), + changeBackground: merge('changeBackground') }); return target; } @@ -59678,9 +59696,11 @@ let Layout$1 = class Layout { const regionWidth = Math.max(Math.min(regionRelativeTotalWidth, ...regionItems.map(region => { var _a; return (_a = region.maxWidth) !== null && _a !== void 0 ? _a : Number.MAX_VALUE; })), 0); const regionHeight = Math.max(Math.min(regionRelativeTotalHeight, ...regionItems.map(region => { var _a; return (_a = region.maxHeight) !== null && _a !== void 0 ? _a : Number.MAX_VALUE; })), 0); regionItems.forEach(region => { + const width = regionWidth - region.layoutPaddingLeft - region.layoutPaddingRight; + const height = regionHeight - region.layoutPaddingTop - region.layoutPaddingBottom; region.setLayoutRect({ - width: regionWidth, - height: regionHeight + width: width, + height: height }); region.setLayoutStartPosition({ x: this.leftCurrent + region.layoutOffsetX + region.layoutPaddingLeft, @@ -61604,7 +61624,7 @@ class VChart { return this._beforeRender(option); } _reCompile(updateResult, morphConfig) { - var _a, _b, _c, _d, _e, _f, _g, _h; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; if (updateResult.reMake) { this._releaseData(); this._initDataSet(); @@ -61615,7 +61635,10 @@ class VChart { this._setCurrentTheme(); this._setFontFamilyTheme((_b = this._currentTheme) === null || _b === void 0 ? void 0 : _b.fontFamily); } - (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.releaseGrammar(((_d = this._option) === null || _d === void 0 ? void 0 : _d.animation) === false || ((_e = this._spec) === null || _e === void 0 ? void 0 : _e.animation) === false); + else if (updateResult.changeBackground) { + (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.setBackground(this._getBackground()); + } + (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.releaseGrammar(((_e = this._option) === null || _e === void 0 ? void 0 : _e.animation) === false || ((_f = this._spec) === null || _f === void 0 ? void 0 : _f.animation) === false); this._userEvents.forEach(e => { var _a; return (_a = this._event) === null || _a === void 0 ? void 0 : _a.on(e.eType, e.query, e.handler); }); if (updateResult.reSize) { this._doResize(); @@ -61624,11 +61647,14 @@ class VChart { else { if (updateResult.changeTheme) { this._setCurrentTheme(); - this._setFontFamilyTheme((_f = this._currentTheme) === null || _f === void 0 ? void 0 : _f.fontFamily); + this._setFontFamilyTheme((_g = this._currentTheme) === null || _g === void 0 ? void 0 : _g.fontFamily); + } + else if (updateResult.changeBackground) { + (_h = this._compiler) === null || _h === void 0 ? void 0 : _h.setBackground(this._getBackground()); } if (updateResult.reCompile) { - (_g = this._compiler) === null || _g === void 0 ? void 0 : _g.clear({ chart: this._chart, vChart: this }, !this._option.animation || !this._spec.animation); - (_h = this._compiler) === null || _h === void 0 ? void 0 : _h.compile({ chart: this._chart, vChart: this }, {}); + (_j = this._compiler) === null || _j === void 0 ? void 0 : _j.clear({ chart: this._chart, vChart: this }, !this._option.animation || !this._spec.animation); + (_k = this._compiler) === null || _k === void 0 ? void 0 : _k.compile({ chart: this._chart, vChart: this }, {}); } if (updateResult.reSize) { const { width, height } = this.getCurrentSize(); @@ -61899,6 +61925,10 @@ class VChart { if (!isEqual$1(lastSpec.theme, this._spec.theme)) { result.changeTheme = true; } + else if (!isEqual$1(this._spec.background, lastSpec.background)) { + result.reMake = true; + result.changeBackground = true; + } const reSize = this._shouldChartResize(lastSpec); result.reSize = reSize; (_b = (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.getVGrammarView()) === null || _b === void 0 ? void 0 : _b.updateLayoutTag(); @@ -66818,7 +66848,7 @@ const registerCanvasTooltipHandler = () => { registerComponentPlugin(CanvasTooltipHandler); }; -const version = "1.11.11"; +const version = "1.11.12"; const addVChartProperty = (data, op) => { const context = op.beforeCall(); @@ -70744,7 +70774,7 @@ class LinearAxisMixin { rangeSize = isX ? this._option.getChartViewRect().width : this._option.getChartViewRect().height; } tickCount = tick.tickCount({ - rangeSize, + axisLength: rangeSize, labelStyle: this._spec.label && this._spec.label.style }); } @@ -72534,9 +72564,6 @@ class BaseChart extends CompilableBase { var _a, _b; this._paddingSpec = normalizeLayoutPaddingSpec((_a = this._spec.padding) !== null && _a !== void 0 ? _a : (_b = this._option) === null || _b === void 0 ? void 0 : _b.getTheme().padding); this._updateLayoutRect(this._viewBox); - if (!isEqual$1(this._spec.background, oldSpec.background)) { - result.reMake = true; - } } updateDataSpec() { if (!this._spec.data) { @@ -78380,7 +78407,11 @@ const pie = (originData, op) => { if (!data || data.length === 0) { return data; } - const { angleField, startAngle, endAngle, minAngle, asStartAngle, asEndAngle, asMiddleAngle, asRadian, asRatio, asQuadrant, asK } = op; + const { asStartAngle, asEndAngle, asMiddleAngle, asRadian, asRatio, asQuadrant, asK } = op; + const angleField = op.angleField(); + const startAngle = op.startAngle(); + const endAngle = op.endAngle(); + const minAngle = op.minAngle(); const appendArcInfo = (data, startAngle, angle) => { data[asStartAngle] = startAngle; data[asEndAngle] = startAngle + angle; @@ -78673,12 +78704,57 @@ class PieSeriesSpecTransformer extends BaseSeriesSpecTransformer { } } +const getPolarAxisInfo = (spec, chartSpec) => { + var _a, _b, _c, _d, _e, _f; + const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : (spec.orient === 'angle' ? 'band' : 'linear'); + const componentName = `${ComponentTypeEnum.polarAxis}-${axisType}`; + const startAngleFromSpec = (_b = spec.startAngle) !== null && _b !== void 0 ? _b : chartSpec.startAngle; + const endAngleFromSpec = (_c = spec.endAngle) !== null && _c !== void 0 ? _c : chartSpec.endAngle; + return { + axisType, + componentName, + startAngle: startAngleFromSpec !== null && startAngleFromSpec !== void 0 ? startAngleFromSpec : POLAR_START_ANGLE, + endAngle: endAngleFromSpec !== null && endAngleFromSpec !== void 0 ? endAngleFromSpec : (isValid$1(startAngleFromSpec) ? startAngleFromSpec + 360 : POLAR_END_ANGLE), + center: isValid$1(chartSpec.center) + ? chartSpec.center + : isValid$1(chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerX) || isValid$1(chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerY) + ? { + x: chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerX, + y: chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerY + } + : undefined, + outerRadius: (_f = (_e = (_d = spec.radius) !== null && _d !== void 0 ? _d : chartSpec.outerRadius) !== null && _e !== void 0 ? _e : chartSpec.radius) !== null && _f !== void 0 ? _f : POLAR_DEFAULT_RADIUS, + layoutRadius: chartSpec.layoutRadius + }; +}; +const computeLayoutRadius = (layoutRadius, getLayoutRect, getCenter, startAngle = 0, endAngle = 0 * Math.PI) => { + if (isNumber$1(layoutRadius)) { + return layoutRadius; + } + else if (isFunction$1(layoutRadius)) { + return layoutRadius(getLayoutRect(), getCenter()); + } + const rect = getLayoutRect(); + if (layoutRadius === 'auto' && rect.width > 0 && rect.height > 0) { + return calculateMaxRadius(rect, getCenter(), startAngle, endAngle); + } + return Math.min(rect.width / 2, rect.height / 2); +}; + class BasePieSeries extends PolarSeries { constructor() { super(...arguments); this.transformerConstructor = PieSeriesSpecTransformer; this._pieMarkName = "pie"; this._pieMarkType = "arc"; + this.getCenter = () => { + var _a, _b, _c, _d; + const { width, height } = this._region.getLayoutRect(); + return { + x: (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.centerX) !== null && _b !== void 0 ? _b : width / 2, + y: (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.centerY) !== null && _d !== void 0 ? _d : height / 2 + }; + }; this._startAngle = POLAR_START_RADIAN; this._endAngle = POLAR_END_RADIAN; this._pieMark = null; @@ -78695,14 +78771,6 @@ class BasePieSeries extends PolarSeries { return polarToCartesian$1(center, (radius + innerRadius) / 2, angle); }; } - getCenter() { - var _a, _b, _c, _d; - const { width, height } = this._region.getLayoutRect(); - return { - x: (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.centerX) !== null && _b !== void 0 ? _b : width / 2, - y: (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.centerY) !== null && _d !== void 0 ? _d : height / 2 - }; - } _buildMarkAttributeContext() { super._buildMarkAttributeContext(); this._markAttributeContext.getCenter = () => ({ @@ -78739,10 +78807,10 @@ class BasePieSeries extends PolarSeries { viewData.transform({ type: 'pie', options: { - angleField: this._angleField[0], - startAngle: this._startAngle, - endAngle: this._endAngle, - minAngle: isValid$1(this._spec.minAngle) ? degreeToRadian(this._spec.minAngle) : 0, + angleField: () => this._angleField[0], + startAngle: () => this._startAngle, + endAngle: () => this._endAngle, + minAngle: () => (isValid$1(this._spec.minAngle) ? degreeToRadian(this._spec.minAngle) : 0), asStartAngle: ARC_START_ANGLE, asEndAngle: ARC_END_ANGLE, asRatio: ARC_RATIO, @@ -78777,6 +78845,9 @@ class BasePieSeries extends PolarSeries { endAngleScale(datum) { return field$2(ARC_END_ANGLE)(datum); } + _computeLayoutRadius() { + return computeLayoutRadius(this._spec.layoutRadius, this.getLayoutRect, this.getCenter, this._startAngle, this._endAngle); + } initMarkStyle() { const pieMark = this._pieMark; if (pieMark) { @@ -78893,28 +78964,23 @@ class BasePieSeries extends PolarSeries { } _compareSpec(spec, prevSpec, ignoreCheckKeys) { ignoreCheckKeys = ignoreCheckKeys !== null && ignoreCheckKeys !== void 0 ? ignoreCheckKeys : { data: true }; - ignoreCheckKeys.centerX = true; - ignoreCheckKeys.centerX = true; - ignoreCheckKeys.centerY = true; - ignoreCheckKeys.centerOffset = true; - ignoreCheckKeys.radius = true; - ignoreCheckKeys.innerRadius = true; - ignoreCheckKeys.cornerRadius = true; - ignoreCheckKeys.startAngle = true; - ignoreCheckKeys.endAngle = true; - ignoreCheckKeys.padAngle = true; - const { centerX, centerY, centerOffset, radius, innerRadius, cornerRadius, startAngle, endAngle, padAngle } = prevSpec; + const defaultIgnoreKeys = [ + 'centerX', + 'centerY', + 'centerOffset', + 'radius', + 'innerRadius', + 'cornerRadius', + 'startAngle', + 'endAngle', + 'padAngle' + ]; + defaultIgnoreKeys.forEach(key => { + ignoreCheckKeys[key] = true; + }); const result = super._compareSpec(spec, prevSpec, ignoreCheckKeys); spec = spec !== null && spec !== void 0 ? spec : {}; - if (spec.centerY !== centerY || - spec.centerX !== centerX || - spec.centerOffset !== centerOffset || - spec.radius !== radius || - spec.innerRadius !== innerRadius || - spec.cornerRadius !== cornerRadius || - spec.startAngle !== startAngle || - spec.endAngle !== endAngle || - spec.padAngle !== padAngle) { + if (defaultIgnoreKeys.some(key => spec[key] !== prevSpec[key])) { result.reRender = true; result.change = true; } @@ -79188,30 +79254,6 @@ class RoseSeriesSpecTransformer extends BaseSeriesSpecTransformer { } } -const getPolarAxisInfo = (spec, chartSpec) => { - var _a, _b, _c, _d, _e, _f; - const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : (spec.orient === 'angle' ? 'band' : 'linear'); - const componentName = `${ComponentTypeEnum.polarAxis}-${axisType}`; - const startAngleFromSpec = (_b = spec.startAngle) !== null && _b !== void 0 ? _b : chartSpec.startAngle; - const endAngleFromSpec = (_c = spec.endAngle) !== null && _c !== void 0 ? _c : chartSpec.endAngle; - return { - axisType, - componentName, - startAngle: startAngleFromSpec !== null && startAngleFromSpec !== void 0 ? startAngleFromSpec : POLAR_START_ANGLE, - endAngle: endAngleFromSpec !== null && endAngleFromSpec !== void 0 ? endAngleFromSpec : (isValid$1(startAngleFromSpec) ? startAngleFromSpec + 360 : POLAR_END_ANGLE), - center: isValid$1(chartSpec.center) - ? chartSpec.center - : isValid$1(chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerX) || isValid$1(chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerY) - ? { - x: chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerX, - y: chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.centerY - } - : undefined, - outerRadius: (_f = (_e = (_d = spec.radius) !== null && _d !== void 0 ? _d : chartSpec.outerRadius) !== null && _e !== void 0 ? _e : chartSpec.radius) !== null && _f !== void 0 ? _f : POLAR_DEFAULT_RADIUS, - layoutRadius: chartSpec.layoutRadius - }; -}; - class PolarAxis extends AxisComponent { get center() { return this._center; @@ -79255,7 +79297,9 @@ class PolarAxis extends AxisComponent { } const specInfos = []; let angleAxisIndex; + let radiusAxisIndex; const radiusAxisSpecInfos = []; + const angleAxisSpecInfos = []; axesSpec.forEach((s, i) => { if (!isValidPolarAxis(s)) { return; @@ -79276,14 +79320,19 @@ class PolarAxis extends AxisComponent { specInfos.push(info); if (s.orient === 'radius') { radiusAxisSpecInfos.push(info); + radiusAxisIndex = i; } else { + angleAxisSpecInfos.push(info); angleAxisIndex = i; } }); radiusAxisSpecInfos.forEach(info => { info.angleAxisIndex = angleAxisIndex; }); + angleAxisSpecInfos.forEach(info => { + info.radiusAxisIndex = radiusAxisIndex; + }); return specInfos; } static createComponent(specInfo, options) { @@ -79331,6 +79380,9 @@ class PolarAxis extends AxisComponent { const region = (_a = this.getRegions()) === null || _a === void 0 ? void 0 : _a[0]; return region ? region.getLayoutStartPoint() : pos; }; + this.getRefLayoutRect = () => { + return this.getRegions()[0].getLayoutRect(); + }; this._coordinateType = 'polar'; } setAttrFromSpec() { @@ -79427,7 +79479,7 @@ class PolarAxis extends AxisComponent { coordToPoint: this.coordToPoint.bind(this), pointToCoord: this.pointToCoord.bind(this), center: this.getCenter.bind(this), - layoutRadius: this.computeLayoutRadius.bind(this), + layoutRadius: this._computeLayoutRadius.bind(this), getScale, getAxisId: () => this.id, getSpec: () => this._spec @@ -79518,6 +79570,7 @@ class PolarAxis extends AxisComponent { return this._startAngle; } _layoutAngleAxis() { + var _a, _b, _c; const center = this.getCenter(); const radius = this.computeLayoutOuterRadius(); const innerRadius = this.computeLayoutInnerRadius(); @@ -79525,7 +79578,9 @@ class PolarAxis extends AxisComponent { const items = this.getLabelItems(angleRange); const commonAttrs = Object.assign(Object.assign({}, this.getLayoutStartPoint()), { inside: this._spec.inside, center, radius, - innerRadius, startAngle: this._startAngle, endAngle: this._endAngle }); + innerRadius, startAngle: this._startAngle, endAngle: this._endAngle, sides: ((_c = (_b = (_a = this._getRelatedAxis(this._option.radiusAxisIndex)) === null || _a === void 0 ? void 0 : _a.getSpec()) === null || _b === void 0 ? void 0 : _b.grid) === null || _c === void 0 ? void 0 : _c.smooth) + ? undefined + : this.getScale().domain().length }); const attrs = Object.assign(Object.assign({}, commonAttrs), { title: { text: this._spec.title.text || this._dataFieldText }, items, orient: 'angle' }); @@ -79548,44 +79603,29 @@ class PolarAxis extends AxisComponent { text: this._spec.title.text || this._dataFieldText }, items, orient: 'radius' }); if ((_a = this._spec.grid) === null || _a === void 0 ? void 0 : _a.visible) { - attrs.grid = Object.assign({ items: items[0], type: ((_b = this._spec.grid) === null || _b === void 0 ? void 0 : _b.smooth) ? 'circle' : 'polygon', center, closed: true, sides: (_c = this._getRelatedAngleAxis()) === null || _c === void 0 ? void 0 : _c.getScale().domain().length, startAngle: this._startAngle, endAngle: this._endAngle }, commonAttrs); + attrs.grid = Object.assign({ items: items[0], type: ((_b = this._spec.grid) === null || _b === void 0 ? void 0 : _b.smooth) ? 'circle' : 'polygon', center, closed: true, sides: (_c = this._getRelatedAxis(this._option.angleAxisIndex)) === null || _c === void 0 ? void 0 : _c.getScale().domain().length, startAngle: this._startAngle, endAngle: this._endAngle }, commonAttrs); } this._update(attrs); } - _getRelatedAngleAxis() { - const index = this._option.angleAxisIndex; + _getRelatedAxis(index) { if (isValid$1(index)) { return this._option.getComponentByIndex(this.specKey, index); } return undefined; } - computeLayoutRadius() { - const layoutRect = this.getRefLayoutRect(); - if (isNumber$1(this._spec.layoutRadius)) { - return this._spec.layoutRadius; - } - else if (isFunction$1(this._spec.layoutRadius)) { - return this._spec.layoutRadius(layoutRect, this.getCenter()); - } - const { width, height } = layoutRect; - if (this._spec.layoutRadius === 'auto' && width > 0 && height > 0) { - return calculateMaxRadius(layoutRect, this.getCenter(), this._startAngle, this._endAngle); - } - return Math.min(width / 2, height / 2); + _computeLayoutRadius() { + return computeLayoutRadius(this._spec.layoutRadius, this.getRefLayoutRect, this.getCenter, this._startAngle, this._endAngle); } computeLayoutOuterRadius() { var _a; const radius = (_a = this._spec.outerRadius) !== null && _a !== void 0 ? _a : this._spec.radius; const outerRadius = radius !== null && radius !== void 0 ? radius : this.getRefSeriesRadius().outerRadius; - return this.computeLayoutRadius() * outerRadius; + return this._computeLayoutRadius() * outerRadius; } computeLayoutInnerRadius() { var _a; const innerRadius = (_a = this._spec.innerRadius) !== null && _a !== void 0 ? _a : this.getRefSeriesRadius().innerRadius; - return this.computeLayoutRadius() * innerRadius; - } - getRefLayoutRect() { - return this.getRegions()[0].getLayoutRect(); + return this._computeLayoutRadius() * innerRadius; } getRefSeriesRadius() { let outerRadius = POLAR_DEFAULT_RADIUS; @@ -84226,7 +84266,7 @@ class FunnelSeries extends BaseSeries { else { this._funnelAlign = ['left', 'right'].includes(this._spec.funnelAlign) ? this._spec.funnelAlign : 'center'; } - if (this._spec.categoryField) { + if (!this._seriesField && this._spec.categoryField) { this.setSeriesField(this._spec.categoryField); } } @@ -89115,12 +89155,12 @@ class GaugeSeries extends ProgressLikeSeries { _getAngleValueStartWithoutMask(datum) { const startAngle = this._getAngleValueStartWithoutPadAngle(datum); const endAngle = this._getAngleValueEndWithoutPadAngle(datum); - return Math.min(startAngle + this._padAngle / 2, (startAngle + endAngle) / 2); + return clamper(startAngle, (startAngle + endAngle) / 2)(startAngle + (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2)); } _getAngleValueEndWithoutMask(datum) { const startAngle = this._getAngleValueStartWithoutPadAngle(datum); const endAngle = this._getAngleValueEndWithoutPadAngle(datum); - return Math.max(endAngle - this._padAngle / 2, (startAngle + endAngle) / 2); + return clamper(endAngle, (startAngle + endAngle) / 2)(endAngle - (endAngle > startAngle ? 1 : -1) * Math.abs(this._padAngle / 2)); } _getAngleValueStartWithoutPadAngle(datum) { return isValid$1(datum[SEGMENT_FIELD_START]) @@ -91479,7 +91519,7 @@ class BasePieChartSpecTransformer extends PolarChartSpecTransformer { return false; } _getDefaultSeriesSpec(spec) { - return Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { categoryField: spec.categoryField || spec.seriesField, valueField: spec.valueField || spec.angleField, center: spec.center, centerOffset: spec.centerOffset, cornerRadius: spec.cornerRadius, padAngle: spec.padAngle, minAngle: spec.minAngle }); + return Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { categoryField: spec.categoryField || spec.seriesField, valueField: spec.valueField || spec.angleField, center: spec.center, centerOffset: spec.centerOffset, cornerRadius: spec.cornerRadius, padAngle: spec.padAngle, minAngle: spec.minAngle, layoutRadius: spec.layoutRadius }); } } @@ -93107,6 +93147,10 @@ class BaseLegend extends BaseComponent { } getBoundsInRect(rect, fullSpace) { if (!this._visible) { + if (this._legendComponent && this._legendComponent.parent) { + this._legendComponent.parent.removeChild(this._legendComponent); + this._legendComponent = null; + } return { x1: 0, y1: 0, x2: 0, y2: 0 }; } const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 }; @@ -100339,9 +100383,10 @@ class Brush extends BaseComponent { return data; } _extendDatumOutOfBrush(elementsMap) { + var _a; const data = []; for (const elementKey in elementsMap) { - data.push(elementsMap[elementKey].data[0]); + data.push((_a = elementsMap[elementKey].data) === null || _a === void 0 ? void 0 : _a[0]); } return data; } diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 5af55847cc..060e08964b 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "1.11.11", + "version": "1.11.12", "description": "VChart 飞书小程序组件", "main": "index.js", "files": [ diff --git a/packages/lark-vchart/src/vchart/index.js b/packages/lark-vchart/src/vchart/index.js index a57ced9648..1c51451f12 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(Mt.source,"g");function wt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Lt=Math.abs,Ot=Math.atan2,It=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Vt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Yt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Kt(t,e){return Ut(t+e,10**Math.max(Yt(t),Yt(e)))}function Xt(t,e){return Ut(t-e,10**Math.max(Yt(t),Yt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class qt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Zt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Jt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Jt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Qt extends Jt{}function te(t){return t*(Math.PI/180)}function ee(t){return 180*t/Math.PI}const ie=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function se(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ne(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function re(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ae(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=re(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new oe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new oe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new oe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ee(r.rotateDeg),r}}class le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function he(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ce(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const de=/^#([0-9a-f]{3,8})$/,ue={transparent:4294967040},pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return S(t)?new ye(t>>16,t>>8&255,255&t,1):y(t)?new ye(t[0],t[1],t[2]):new ye(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ve(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class _e{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof _e?t:new _e(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(ue[t]))return function(t){return S(t)?new ye(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ye(t[0],t[1],t[2],t[3]):new ye(255,255,255,1)}(ue[t]);if(p(pe[t]))return me(pe[t]);const e=`${t}`.trim().toLowerCase(),i=de.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ye((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=he(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ye(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=_e.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ye(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=ce(this.color.r,this.color.g,this.color.b),r=he(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ye(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=de.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new ye((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?me(s):8===n?new ye(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=pe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _e(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ve(t.color.r),this.color.g=ve(t.color.g),this.color.b=ve(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ye{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${ge(this.r)+ge(this.g)+ge(this.b)+(1===this.opacity?"":ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ye(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ce});function Se(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ae,ke,Me,Te,we,Ce,Ee,Pe;function Be(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Le(t,e,i){return null===t?e:null===e?t:(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,i&&(Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>=Ce||ke<=we||Me>=Pe||Te<=Ee?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ae,we),y1:Math.max(Me,Ee),x2:Math.min(ke,Ce),y2:Math.min(Te,Pe)})}var Oe;function Ie(t,e,i){return!(t&&e&&(i?(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee]),Ae>Ce||kePe||Tee.x2||t.x2e.y2||t.y2ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),t.x>=Ae&&t.x<=ke&&t.y>=Me&&t.y<=Te):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Fe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function je(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function ze(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function He(t,e){const i=e?t.angle:te(t.angle),s=ze(t);return[je({x:t.x1,y:t.y1},i,s),je({x:t.x2,y:t.y1},i,s),je({x:t.x2,y:t.y2},i,s),je({x:t.x1,y:t.y2},i,s)]}let Ne,Ve,Ge,We;function Ue(t){return Ne=1/0,Ve=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ne>t.x&&(Ne=t.x),Get.y&&(Ve=t.y),Wee&&r>s||rn?o:0}function qe(t,e){return Math.abs(t-e)0&&Ke(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Je=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";const ti=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ei(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ii(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function si(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const ni=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ri=6371008.8,ai={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ri,kilometers:6371.0088,kilometres:6371.0088,meters:ri,metres:ri,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ri/1852,radians:1,yards:6967335.223679999};function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function hi(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===De(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ci(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=te(t[0]),r=te(t[1]),a=te(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ai[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:ee(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:ee(l)}}class di{static getInstance(){return di.instance||(di.instance=new di),di.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let pi;function gi(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class mi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vi(t){let e;if(e=fi.exec(t))return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const _i=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class yi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}newFormat(t){const e=vi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):bi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=bi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?_i[8+pi/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=vi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=ui(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=_i[8+n/3];return function(t){return s(r*t)+a}}}const bi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gi(100*t,e),r:gi,s:function(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(pi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+ui(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function xi(){return new Si}function Si(){this.reset()}Si.prototype={constructor:Si,reset:function(){this.s=this.t=0},add:function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},valueOf:function(){return this.s}};var Ai=new Si;function ki(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Mi=1e-6,Ti=Math.PI,wi=Ti/2,Ci=Ti/4,Ei=2*Ti,Pi=180/Ti,Bi=Ti/180,Ri=Math.abs,Li=Math.atan,Oi=Math.atan2,Ii=Math.cos,Di=Math.exp,Fi=Math.log,ji=Math.pow,zi=Math.sin,Hi=Math.sign||function(t){return t>0?1:t<0?-1:0},Ni=Math.sqrt,Vi=Math.tan;function Gi(t){return t>1?0:t<-1?Ti:Math.acos(t)}function Wi(t){return t>1?wi:t<-1?-wi:Math.asin(t)}function Ui(){}function Yi(t,e){t&&Xi.hasOwnProperty(t.type)&&Xi[t.type](t,e)}var Ki={Feature:function(t,e){Yi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sTi?t+Math.round(-t/Ei)*Ei:t,e]}function os(t,e,i){return(t%=Ei)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Ti?e-Ei:e<-Ti?e+Ei:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Ii(t),s=zi(t),n=Ii(e),r=zi(e);function a(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*i+o*s;return[Oi(l*n-c*r,o*i-h*s),Wi(c*n+l*r)]}return a.invert=function(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*n-l*r;return[Oi(l*n+h*r,o*i+c*s),Wi(c*i-o*s)]},a}function ds(t,e){(e=Qi(e))[0]-=t,ns(e);var i=Gi(-e[1]);return((-e[2]<0?-i:i)+Ei-Mi)%Ei}function us(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ui,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return Ri(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function fs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ss(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function As(t,e,i,s){return function(n){var r,a,o,l=e(n),h=us(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=Ss(a);var t=function(t,e){var i=bs(e),s=e[1],n=zi(s),r=[zi(i),-Ii(i),0],a=0,o=0;ys.reset(),1===n?s=wi+Mi:-1===n&&(s=-wi-Mi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Ti,w=m*x;if(ys.add(Oi(w*k*zi(M),f*S+w*Ii(M))),a+=T?A+k*Ei:A,T^p>=i^y>=i){var C=es(Qi(u),Qi(_));ns(C);var E=es(r,C);ns(E);var P=(T^A>=0?-1:1)*Wi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Mi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ks))}return u}}function ks(t){return t.length>1}function Ms(t,e){return((t=t.x)[0]<0?t[1]-wi-Mi:wi-t[1])-((e=e.x)[0]<0?e[1]-wi-Mi:wi-e[1])}1===(vs=xs).length&&(_s=vs,vs=function(t,e){return xs(_s(t),e)});var Ts=As((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ti:-Ti,l=Ri(r-i);Ri(l-Ti)0?wi:-wi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ti&&(Ri(i-n)Mi?Li((zi(e)*(r=Ii(s))*zi(i)-zi(s)*(n=Ii(e))*zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*wi,s.point(-Ti,n),s.point(0,n),s.point(Ti,n),s.point(Ti,0),s.point(Ti,-n),s.point(0,-n),s.point(-Ti,-n),s.point(-Ti,0),s.point(-Ti,n);else if(Ri(t[0]-e[0])>Mi){var r=t[0]0,n=Ri(e)>Mi;function r(t,i){return Ii(t)*Ii(i)>e}function a(t,i,s){var n=[1,0,0],r=es(Qi(t),Qi(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=es(n,r),u=ss(n,h);is(u,ss(r,c));var p=d,g=ts(u,p),m=ts(p,p),f=g*g-m*(ts(u,u)-1);if(!(f<0)){var v=Ni(f),_=ss(p,(-g-v)/m);if(is(_,u),_=Ji(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ri(_[0]-b)Ti^(b<=_[0]&&_[0]<=x)){var T=ss(p,(-g+v)/m);return is(T,u),[_,Ji(T)]}}}function o(e,i){var n=s?t:Ti-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return As(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Ti:-Ti),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ps(e,p)||ps(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Ii(e),o=zi(e),l=s*i;null==n?(n=e+s*Ei,r=e-l/2):(n=ds(a,n),r=ds(a,r),(s>0?nr)&&(n+=s*Ei));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ri(s[0]-t)0?0:3:Ri(s[0]-i)0?2:1:Ri(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=us(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Ss(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ms(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Es,Math.min(Cs,g)),m=Math.max(Es,Math.min(Cs,m))],b=[r=Math.max(Es,Math.min(Cs,r)),a=Math.max(Es,Math.min(Cs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Bs(t){return t}var Rs,Ls,Os,Is,Ds=xi(),Fs=xi(),js={point:Ui,lineStart:Ui,lineEnd:Ui,polygonStart:function(){js.lineStart=zs,js.lineEnd=Vs},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=Ui,Ds.add(Ri(Fs)),Fs.reset()},result:function(){var t=Ds/2;return Ds.reset(),t}};function zs(){js.point=Hs}function Hs(t,e){js.point=Ns,Rs=Os=t,Ls=Is=e}function Ns(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Vs(){Ns(Rs,Ls)}var Gs=js,Ws=1/0,Us=Ws,Ys=-Ws,Ks=Ys;var Xs,$s,qs,Zs,Js={point:function(t,e){tYs&&(Ys=t);eKs&&(Ks=e)},lineStart:Ui,lineEnd:Ui,polygonStart:Ui,polygonEnd:Ui,result:function(){var t=[[Ws,Us],[Ys,Ks]];return Ys=Ks=-(Us=Ws=1/0),t}},Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln=0,hn={point:cn,lineStart:dn,lineEnd:gn,polygonStart:function(){hn.lineStart=mn,hn.lineEnd=fn},polygonEnd:function(){hn.point=cn,hn.lineStart=dn,hn.lineEnd=gn},result:function(){var t=ln?[an/ln,on/ln]:rn?[sn/rn,nn/rn]:en?[Qs/en,tn/en]:[NaN,NaN];return Qs=tn=en=sn=nn=rn=an=on=ln=0,t}};function cn(t,e){Qs+=t,tn+=e,++en}function dn(){hn.point=un}function un(t,e){hn.point=pn,cn(qs=t,Zs=e)}function pn(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,cn(qs=t,Zs=e)}function gn(){hn.point=cn}function mn(){hn.point=vn}function fn(){_n(Xs,$s)}function vn(t,e){hn.point=_n,cn(Xs=qs=t,$s=Zs=e)}function _n(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,an+=(n=Zs*t-qs*e)*(qs+t),on+=n*(Zs+e),ln+=3*n,cn(qs=t,Zs=e)}var yn=hn;function bn(t){this._context=t}bn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ei)}},result:Ui};var xn,Sn,An,kn,Mn,Tn=xi(),wn={point:Ui,lineStart:function(){wn.point=Cn},lineEnd:function(){xn&&En(Sn,An),wn.point=Ui},polygonStart:function(){xn=!0},polygonEnd:function(){xn=null},result:function(){var t=+Tn;return Tn.reset(),t}};function Cn(t,e){wn.point=En,Sn=kn=t,An=Mn=e}function En(t,e){kn-=t,Mn-=e,Tn.add(Ni(kn*kn+Mn*Mn)),kn=t,Mn=e}var Pn=wn;function Bn(){this._string=[]}function Rn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ln(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Zi(t,i(s))),s.result()}return r.area=function(t){return Zi(t,i(Gs)),Gs.result()},r.measure=function(t){return Zi(t,i(Pn)),Pn.result()},r.bounds=function(t){return Zi(t,i(Js)),Js.result()},r.centroid=function(t){return Zi(t,i(yn)),yn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Bs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Bn):new bn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function On(t){return function(e){var i=new In;for(var s in t)i[s]=t[s];return i.stream=e,i}}function In(){}function Dn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Zi(i,t.stream(Js)),e(Js.result()),null!=s&&t.clipExtent(s),t}function Fn(t,e,i){return Dn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function jn(t,e,i){return Fn(t,[[0,0],e],i)}function zn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Hn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Bn.prototype={_radius:4.5,_circle:Rn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Rn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},In.prototype={constructor:In,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Nn=16,Vn=Ii(30*Bi);function Gn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Ni(b*b+x*x+S*S),k=Wi(S/=A),M=Ri(Ri(S)-1)e||Ri((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Bi:0,E()):[f*Pi,v*Pi,_*Pi]},w.angle=function(t){return arguments.length?(y=t%360*Bi,E()):y*Pi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Gn(o,T=t*t),P()):Ni(T)},w.fitExtent=function(t,e){return Fn(w,t,e)},w.fitSize=function(t,e){return jn(w,t,e)},w.fitWidth=function(t,e){return zn(w,t,e)},w.fitHeight=function(t,e){return Hn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function $n(t){var e=0,i=Ti/3,s=Xn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Bi,i=t[1]*Bi):[e*Pi,i*Pi]},n}function qn(t,e){var i=zi(t),s=(i+zi(e))/2;if(Ri(s)2?t[2]*Bi:0),e.invert=function(e){return(e=t.invert(e[0]*Bi,e[1]*Bi))[0]*=Pi,e[1]*=Pi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===sr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function rr(t){return Vi((wi+t)/2)}function ar(t,e){var i=Ii(t),s=t===e?zi(t):Fi(i/Ii(e))/Fi(rr(e)/rr(t)),n=i*ji(rr(t),s)/s;if(!s)return sr;function r(t,e){n>0?e<-wi+Mi&&(e=-wi+Mi):e>wi-Mi&&(e=wi-Mi);var i=n/ji(rr(e),s);return[i*zi(s*t),n-i*Ii(s*t)]}return r.invert=function(t,e){var i=n-e,r=Hi(s)*Ni(t*t+i*i),a=Oi(t,Ri(i))*Hi(i);return i*s<0&&(a-=Ti*Hi(t)*Hi(i)),[a/s,2*Li(ji(n/r,1/s))-wi]},r}function or(t,e){return[t,e]}function lr(t,e){var i=Ii(t),s=t===e?zi(t):(i-Ii(e))/(e-t),n=i/s+t;if(Ri(s)Mi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},vr.invert=tr(Wi),_r.invert=tr((function(t){return 2*Li(t)})),yr.invert=function(t,e){return[-e,2*Li(Di(t))-wi]};var Sr={exports:{}},Ar=function(t,e){this.p1=t,this.p2=e};Ar.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ar.prototype.run=function(){return this.p2[0]-this.p1[0]},Ar.prototype.slope=function(){return this.rise()/this.run()},Ar.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ar.prototype.isVertical=function(){return!isFinite(this.slope())},Ar.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ar.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ar.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ar.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ar.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var kr=Ar,Mr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new kr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Mr(t.slice(0,s),e),o=Mr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Tr=Mr;!function(t){var e=Tr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Cr(Br,e),{tolerance:s}=i;return wr(t,s)};var Lr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Lr||(Lr={}));const Or=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+zr(e,6):zr(e,4))+"-"+zr(t.getUTCMonth()+1,2)+"-"+zr(t.getUTCDate(),2)+(r?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"."+zr(r,3)+"Z":n?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"Z":s||i?"T"+zr(i,2)+":"+zr(s,2)+"Z":"")}function Nr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Dr;if(h)return h=!1,Ir;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.DSV;const i=Cr(Wr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Nr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Vr(t)},Kr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Gr(t)};function Xr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return $r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return $r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zr(t);default:throw new Error("unknown GeoJSON type")}}function $r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qr(t.properties),e.geometry=Zr(t.geometry),e}function qr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=qr(s):e[i]=s})),e):e}function Zr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Zr(t)})),e):(e.coordinates=Jr(t.coordinates),e)}function Jr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Jr(t)}))}function Qr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ta(t){for(var e,i,s=Qr(t),n=0,r=1;r0}function ea(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Xr(t));var r=[];switch(t.type){case"GeometryCollection":return ia(t,(function(t){na(t,s)})),t;case"FeatureCollection":return ea(t,(function(t){ea(na(t,s),(function(t){r.push(t)}))})),li(r)}return na(t,s)}function na(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ia(t,(function(t){na(t,e)})),t;case"LineString":return ra(Qr(t),e),t;case"Polygon":return aa(Qr(t),e),t;case"MultiLineString":return Qr(t).forEach((function(t){ra(t,e)})),t;case"MultiPolygon":return Qr(t).forEach((function(t){aa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ra(t,e){ta(t)===e&&t.reverse()}function aa(t,e){ta(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=oa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},da=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.GEO;const i=Cr(ha,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ca(t))})):e.push(ca(t))})),e})(t);let o=t.features;return a&&(o=sa(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=la.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=la.bounds(t);t.bbox=e}})),t.features=o,t},ua={},pa=(t,e,i)=>{i.type=Lr.GEO;const s=Cr(ha,ua,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return xr(a,t)}))}:xr(a,o));var a,o;return da(r,s,i)},ga=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ma=0;function fa(){return ma>1e8&&(ma=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ma++}class va{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:fa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const _a="_data-view-diff-rank";class ya{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:fa("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[_a]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[_a]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[_a]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Or),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ba{static GenAutoIncrementId(){return ba.auto_increment_id++}}ba.auto_increment_id=0;class xa{constructor(t){this.id=ba.GenAutoIncrementId(),this.registry=t}}const Sa="named",Aa="inject",ka="multi_inject",Ma="inversify:tagged",Ta="inversify:paramtypes";class wa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Sa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ca=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ea(e,0,s,t)}}function Ba(t){return e=>(i,s,n)=>Pa(new wa(t,e))(i,s,n)}const Ra=Ba(Aa),La=Ba(ka);function Oa(){return function(t){return Ca.defineMetadata(Ta,null,t),t}}function Ia(t){return Pa(new wa(Sa,t))}const Da="Singleton",Fa="Transient",ja="ConstantValue",za="DynamicValue",Ha="Factory",Na="Function",Va="Instance",Ga="Invalid";class Wa{constructor(t,e){this.id=ba.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ga,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wa(this.serviceIdentifier,this.scope);return t.activated=t.scope===Da&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ua{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ca.getMetadata(Ta,t),userGeneratedMetadata:Ca.getMetadata(Ma,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ya=(Ka=Sa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ka&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const qa=Symbol("ContributionProvider");class Za{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ja(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).inSingletonScope().whenTargetNamed(e)}class Qa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class to extends Qa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const eo=Symbol.for("EnvContribution"),io=Symbol.for("VGlobal");var so=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},no=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ro=function(t,e){return function(i,s){e(i,s,t)}};let ao=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ba.GenAutoIncrementId(),this.hooks={onSetEnv:new to(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ao=so([Oa(),ro(0,Ra(qa)),ro(0,Ia(eo)),no("design:paramtypes",[Object])],ao);const oo=Bt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,mo,fo,vo,_o,yo;var bo,xo,So,Ao,ko,Mo,To,wo,Co;function Eo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Po(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=te(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Lo(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Go extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Wo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Uo(t,e,i){const s=null!=e?e:Lt(i[i.length-1].x-i[0].x)>Lt(i[i.length-1].y-i[0].y)?To.ROW:To.COLUMN;return"monotoneY"===t?new Go(t,s):new Vo(t,s)}class Yo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ko(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new Yo(n,s),t),n}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("basis",i,t);return function(t,e){Wo(t,e)}(new $o(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneX",i,t);return function(t,e){Wo(t,e)}(new el(n,s),t),n}function nl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneY",i,t);return function(t,e){Wo(t,e)}(new il(n,s),t),n}let rl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function al(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Lt(t[t.length-1].x-t[0].x)>Lt(t[t.length-1].y-t[0].y)?To.ROW:To.COLUMN);return function(t,e){Wo(t,e)}(new rl(r,e,n),t),r}class ol extends Yo{lineEnd(){this.context.closePath()}}function ll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new ol(n,s),t),n}function hl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function cl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Ko(i,n);const o=Uo(t,r,i);return Wo(new e(o,s,a),i),o}}const dl=cl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ul=cl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function pl(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}class gl extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[];Bo(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Lo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===To.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.y-e.p1.y)}if(this.direction===To.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const ml=["l",0,0,0,0,0,0,0];function fl(t,e,i){const s=ml[0]=t[0];if("a"===s||"A"===s)ml[1]=e*t[1],ml[2]=i*t[2],ml[3]=t[3],ml[4]=t[4],ml[5]=t[5],ml[6]=e*t[6],ml[7]=i*t[7];else if("h"===s||"H"===s)ml[1]=e*t[1];else if("v"===s||"V"===s)ml[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Rl=Object.assign(Object.assign({},kl),{points:[],cornerRadius:0,closePath:!0}),Ll=Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ol=Object.assign(Object.assign({},kl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},kl),xl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dl=Object.assign(Object.assign(Object.assign({},kl),xl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kl),{fill:!0,cornerRadius:0}),jl=Object.assign(Object.assign({},Fl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const zl=new class{},Hl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Nl=!0,Vl=!1,Gl=/\w|\(|\)|-/,Wl=/[.?!,;:/,。?!、;:]/,Ul=/\S/;function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=zl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Kl(t,a)),a}function Kl(t,e){let i=e;for(;Gl.test(t[i-1])&&Gl.test(t[i])||Wl.test(t[i]);)if(i--,i<=0)return e;return i}function Xl(t,e){const i=zl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var $l=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Il.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Kl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Kl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=$l([Oa()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Oa()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Fa,this.options=e,this.id=ba.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ua}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Sa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wa(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new $a(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Aa],multiInject:s[ka]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case ja:case Na:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Da&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,zl.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-xh&&txh||t<-xh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Rt)<0&&(t+=Rt),t}function fh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Ah=[-1,-1,-1],kh=[-1,-1];function Mh(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Th(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Ah);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Ah);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ah[0]=-l,Ah[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=Ah[0]+t&&a<=Ah[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=Ah[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=fh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Bh[0]=S,Bh[1]=A,Ph(Bh,Boolean(a[6])),S=Bh[0],A=Bh[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case po.M:u=f,p=v,c=u,d=p;break;case po.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=fh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case po.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=fh(c,d,o,l,s,n),i){if(yh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ch(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case po.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=fh(o,p,o,l,s,n),h+=fh(u,l,u,p,s,n);break;case po.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=fh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new to(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=zl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Oh([Oa(),Ih("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=zl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Lh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:xl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Qe(Object.assign({defaultFontParams:{fontFamily:xl.fontFamily,fontSize:xl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Oa(),Nh(0,Ra(qa)),Nh(0,Ia(Jl)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new oe;let Uh=class{constructor(){this.matrix=new oe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Oa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:Ml,area:Tl,circle:wl,line:Pl,path:Bl,symbol:Ol,text:Il,rect:Ll,polygon:Rl,richtext:Dl,richtextIcon:jl,image:Fl,group:Cl,glyph:El},Kh=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const $h={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Kh.forEach((t=>{this._defaultTheme[t]=Object.create($h[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Kh.forEach((s=>{const n=Object.create($h[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Kh.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ba.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class uc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{static Avaliable(){return!!zl.global.getRequestAnimationFrame()}avaliable(){return gc.Avaliable()}tick(t,e){zl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var mc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(mc||(mc={}));class fc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-fc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*fc.bounceIn(2*t):.5*fc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}fc.quadIn=fc.getPowIn(2),fc.quadOut=fc.getPowOut(2),fc.quadInOut=fc.getPowInOut(2),fc.cubicIn=fc.getPowIn(3),fc.cubicOut=fc.getPowOut(3),fc.cubicInOut=fc.getPowInOut(3),fc.quartIn=fc.getPowIn(4),fc.quartOut=fc.getPowOut(4),fc.quartInOut=fc.getPowInOut(4),fc.quintIn=fc.getPowIn(5),fc.quintOut=fc.getPowOut(5),fc.quintInOut=fc.getPowInOut(5),fc.backIn=fc.getBackIn(1.7),fc.backOut=fc.getBackOut(1.7),fc.backInOut=fc.getBackInOut(1.7),fc.elasticIn=fc.getElasticIn(1,.3),fc.elasticOut=fc.getElasticOut(1,.3),fc.elasticInOut=fc.getElasticInOut(1,.3*1.5);class vc{constructor(){this.id=ba.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ao.END?this.removeAnimate(e):e.status===Ao.RUNNING||e.status===Ao.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ao.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const _c=new vc;class yc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class bc extends yc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let xc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ba.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new Sc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&ko.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:So.ANIMATE_PLAY})}runCb(t){const e=new bc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===Ao.RUNNING&&(this.status=Ao.PAUSED)}resume(){this.status===Ao.PAUSED&&(this.status=Ao.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Sc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ao.RUNNING&&(this.status=Ao.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ao.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};xc.mode=ko.NORMAL,xc.interpolateMap=new Map;class Sc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Ac(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?fc[i]:i,n=this._addStep(e,null,s);return n.type=Mo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?fc[i]:i,r=this._addStep(e,null,n);return r.type=Mo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=Mo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Mo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Ac(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Ac{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Mc="cubicOut",Tc=1e3,wc="quadInOut";var Cc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Cc||(Cc={}));const Ec=[!1,!1,!1,!1],Pc=[0,0,0,0],Bc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Pc[0]=t[0],Pc[2]=t[0],Pc[1]=t[1],Pc[3]=t[1],Pc):t:t:0,Rc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Lc=[1,2,3,0,1,2,3,0];function Oc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Rc[0].x=i,Rc[1].y=i,Rc[2].x=-i,Rc[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(It(t)*i,jt(t)*i),s.add(It(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:zc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}zc.TimeOut=1e3/60;const Hc=new zc,Nc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Vc extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Yt(this.fromNumber),Yt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Gc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Gc||(Gc={}));class Wc extends yc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Ic(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Uc extends yc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:So.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:So.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Yc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=zl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Kc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=zl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Xc extends yc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class $c extends yc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?fc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function qc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Zc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{pt(e,s)&&pt(i,n)||t.push(e,i,s,n,s,n)};function sd(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function nd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function od(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),cd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},dd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Jt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return cd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return cd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);dd(n[0],s,i),dd(n[1],e-s,i)}};var ud;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ud||(ud={}));class pd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ud.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ud.Color1){const e=pd.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=_e.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];pd.store1[t]=e,pd.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=pd.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=_e.parseColorString(t);return n&&(pd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],pd.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===ud.Color1){if(pd.store1[t])return;pd.store1[t]=i,pd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(pd.store255[t])return;pd.store255[t]=i,pd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function gd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function md(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>fd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):fd(t,e,i,s,n)}function fd(t,e,i,s,n){if(!t||!e)return t&&gd(t)||e&&gd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=pd.Get(t,ud.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=pd.Get(e,ud.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:gd(a)})))});return o?md(r,l,i,s,n):md(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),gd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}pd.store255={},pd.store1={};const vd=[0,0,0,0],_d=[0,0,0,0];function yd(t,e,i){return pd.Get(t,ud.Color255,vd),pd.Get(e,ud.Color255,_d),`rgba(${Math.round(vd[0]+(_d[0]-vd[0])*i)},${Math.round(vd[1]+(_d[1]-vd[1])*i)},${Math.round(vd[2]+(_d[2]-vd[2])*i)},${vd[3]+(_d[3]-vd[3])*i})`}const bd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=md(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},xd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?sd(t):[],n=sd(e);i&&s&&(i.fromTransform&&nd(s,i.fromTransform.clone().getInverse()),nd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Ad=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],kd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Ad.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?pd.Get(t[n],ud.Color255):t[n],to:"string"==typeof r?pd.Get(r,ud.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class Md extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;xd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&bd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Td=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Sd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=kd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new Md({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Tc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wc)),c};class wd extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;xd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&bd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Cd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Fc.includes(t))(i)||(e[i]=t[i])})),e},Ed=(t,e,i)=>{const s=Cd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=zl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Pd=(t,e,i)=>{const s=[],n=i?null:Cd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Cd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ad(t.attribute),n=od(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(zl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=od(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=od(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ld(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ld(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(zl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:hd(i)}];const s=[];return dd(i,e,s),s})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return dd(r,e,h),h})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=sd(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(zl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Ed(t,s,e),s};class Rd{static GetImage(t,e){var i;const s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Rd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Rd.cache.set(t,s),s.dataPromise=zl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Rd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Rd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=zl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=zl.global.loadBlob(t):"json"===e&&(i.dataPromise=zl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Rd.isLoading&&Rd.toLoadAueue.length){Rd.isLoading=!0;const t=Rd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Rd.cache.set(i,n),n.dataPromise=zl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()})).catch((t=>{console.error(t),Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()}))}}),0)}static loadImage(t,e){const i=Ld(t,Rd.toLoadAueue);if(-1!==i)return Rd.toLoadAueue[i].marks.push(e),void Rd.loading();Rd.toLoadAueue.push({url:t,marks:[e]}),Rd.loading()}static improveImageLoading(t){const e=Ld(t,Rd.toLoadAueue);if(-1!==e){const t=Rd.toLoadAueue.splice(e,1);Rd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ld(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Qt,this._updateTag=bo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Hd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Hd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Hd.x=n,Hd.y=r;return Hd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new oe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(zl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Mc),c&&this.setAttributes(c,!1,{type:So.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:So.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bo.UPDATE_SHAPE_AND_BOUNDS)===bo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=bo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=bo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&bo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,scaleX:i=vl.scaleX,scaleY:s=vl.scaleY,angle:n=vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=It(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),zl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Od.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:So.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=md(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Jh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:zl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new gl).fromString(t):this.pathProxy=new gl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",zl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Vd.mixin(hc);class Gd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Wd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Yd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Kd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Wd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Gd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Xd(t,e){return $d(t)}function $d(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let eu=0;function iu(){return eu++}var su;function nu(t){const e=[];let i=0,s="";for(let n=0;nru.set(t,!0)));const au=new Map;function ou(t){if(ru.has(t))return!0;if(au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>au.set(t,!0)));const lu=iu(),hu=iu(),cu=iu(),du=iu(),uu=iu(),pu=iu(),gu=iu(),mu=iu(),fu=iu(),vu=iu();iu();const _u=iu();iu();const yu=iu(),bu=iu(),xu=iu(),Su=Symbol.for("GraphicService"),Au=Symbol.for("GraphicCreator"),ku={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Mu=Object.keys(ku);var Tu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tu||(Tu={}));let wu=class t extends Vd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=pu,this._childUpdateTag=bo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,dx:i=vl.dx,dy:s=vl.dy,scaleX:n=vl.scaleX,scaleY:r=vl.scaleY,angle:a=vl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Jh(this).group;this._AABBBounds.clear();const i=zl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Bc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),zl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),zl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,zl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{zl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=zl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cu(t){return new wu(t)}wu.NOWORK_ANIMATE_ATTR=Nd;class Eu extends wu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Pu=Symbol.for("TransformUtil"),Bu=Symbol.for("GraphicUtil"),Ru=Symbol.for("LayerService"),Lu=Symbol.for("StaticLayerHandlerContribution"),Ou=Symbol.for("DynamicLayerHandlerContribution"),Iu=Symbol.for("VirtualLayerHandlerContribution");var Du,Fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zu=Du=class{static GenerateLayerId(){return`${Du.idprefix}_${Du.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=zl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(Lu):"dynamic"===t?th.get(Ou):th.get(Iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Eu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Du.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};zu.idprefix="visactor_layer",zu.prefix_count=0,zu=Du=Fu([Oa(),ju("design:paramtypes",[])],zu);var Hu=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Dh).to(jh),t(Bu).to(Vh).inSingletonScope(),t(Pu).to(Uh).inSingletonScope(),t(Ru).to(zu).inSingletonScope()}));function Nu(t,e){return!(!t&&!e)}function Vu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Gu(t,e,i){return i&&t*e>0}function Wu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Uu(t,e){return t*e>0}function Yu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Ku(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $u(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Lt(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*It(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*It(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*It(f),P=n*jt(f),B=r*It(_),R=r*jt(_);let L,O,I,D;if((T>Ct||M>Ct)&&(L=n*It(v),O=n*jt(v),I=r*It(b),D=r*jt(b),hCt){const t=Ft(x,w),r=Ft(S,w),o=Xu(I,D,E,P,n,t,Number(c)),l=Xu(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,n,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*It(Ot(l.y01,l.x01)),s+l.cy+r*jt(Ot(l.y01,l.x01))):e.moveTo(i+L,s+n*jt(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*It(v),s+n*jt(v));if(!(r>Ct)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>Ct){const t=Ft(k,C),n=Ft(A,C),o=Xu(B,R,L,O,r,-n,Number(c)),l=Xu(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,r,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*It(Ot(l.y01,l.x01)),s+l.cy+t*jt(Ot(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*It(b),s+r*jt(b))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class qu{static GetCanvas(){try{return qu.canvas||(qu.canvas=zl.global.createCanvas({})),qu.canvas}catch(t){return null}}static GetCtx(){if(!qu.ctx){const t=qu.GetCanvas();qu.ctx=t.getContext("2d")}return qu.ctx}}class Zu extends le{static getInstance(){return Zu._instance||(Zu._instance=new Zu),Zu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=qu.GetCanvas(),s=qu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Zu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ju{static GetSize(t){for(let e=0;e=t)return Ju.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ju.GenKey(t,e,i,s,n),l=Ju.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ju.GenKey(t,e,i,s,n);Ju.cache[l]?Ju.cache[l].push({width:a,height:o,pattern:r}):Ju.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ju.cache={},Ju.ImageSize=[20,40,80,160,320,640,1280,2560];const Qu=Symbol.for("ArcRenderContribution"),tp=Symbol.for("AreaRenderContribution"),ep=Symbol.for("CircleRenderContribution"),ip=Symbol.for("GroupRenderContribution"),sp=Symbol.for("ImageRenderContribution"),np=Symbol.for("PathRenderContribution"),rp=Symbol.for("PolygonRenderContribution"),ap=Symbol.for("RectRenderContribution"),op=Symbol.for("SymbolRenderContribution"),lp=Symbol.for("TextRenderContribution"),hp=Symbol.for("InteractiveSubRenderContribution"),cp=["radius","startAngle","endAngle",...Dd];class dp extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=du}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Jh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateCircleAABBBounds(i,Jh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,cp)}needUpdateTag(t){return super.needUpdateTag(t,cp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new gl;return o.arc(0,0,n,r,a),o}clone(){return new dp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function up(t){return new dp(t)}function pp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function gp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}dp.NOWORK_ANIMATE_ATTR=Nd;class fp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=xu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Jh(this).text;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Jh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Nc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=zl.graphicUtil.textMeasure,k=new fp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===su.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=gp(x,o),M=mp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Jh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Nc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=zl.graphicUtil.textMeasure,y=new fp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Jh(this).text,a=zl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Nc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=gp(x,o),e=this.cache.verticalList.length*b,i=mp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>nu(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===su.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const k=gp(x,o),M=this.cache.verticalList.length*b,T=mp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yp(t){return new _p(t)}_p.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Nd),_p.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_p.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class bp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function xp(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Sp=new class extends bp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return xp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return xp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Ap=new class extends bp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function kp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Mp=new class extends bp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return kp(t,e/2+n,i,s,r)}};function Tp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var wp=new class extends bp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Tp(t,e/2+n,i,s)}};class Cp extends bp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Ep=new Cp;var Pp=new class extends Cp{constructor(){super(...arguments),this.type="triangle"}};const Bp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Rp=Math.sin(Bt/10)*Bp,Lp=-Math.cos(Bt/10)*Bp;function Op(t,e,i,s){const n=Rp*e,r=Lp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ip=new class extends bp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};const Dp=zt(3);function Fp(t,e,i,s){const n=e,r=n/Dp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var jp=new class extends bp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Fp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Fp(t,e/2+n,i,s)}};function zp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Hp=new class extends bp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return zp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return zp(t,e/2+n,i,s)}};function Np(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Vp=new class extends bp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};const Gp=-.5,Wp=zt(3)/2,Up=1/zt(12);function Yp(t,e,i,s){const n=e/2,r=e*Up,a=n,o=e*Up+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Gp*n-Wp*r+i,Wp*n+Gp*r+s),t.lineTo(Gp*a-Wp*o+i,Wp*a+Gp*o+s),t.lineTo(Gp*l-Wp*h+i,Wp*l+Gp*h+s),t.lineTo(Gp*n+Wp*r+i,Gp*r-Wp*n+s),t.lineTo(Gp*a+Wp*o+i,Gp*o-Wp*a+s),t.lineTo(Gp*l+Wp*h+i,Gp*h-Wp*l+s),t.closePath(),!1}var Kp=new class extends bp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Yp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Yp(t,e/2+n,i,s)}};var Xp=new class extends bp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends bp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var qp=new class extends bp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Zp=zt(3);function Jp(t,e,i,s){const n=e*Zp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Qp=new class extends Cp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Jp(t,e/2/Zp,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/2/Zp+n,i,s)}};function tg(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var eg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return tg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return tg(t,e/4+n,i,s)}};function ig(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var sg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return ig(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ig(t,e/4+n,i,s)}};function ng(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var rg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return ng(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ng(t,e/4+n,i,s)}};function ag(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var og=new class extends bp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ag(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ag(t,e/4+n,i,s)}};function lg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var hg=new class extends bp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return lg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return lg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function cg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var dg=new class extends bp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return cg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return cg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ug(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var pg=new class extends bp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return ug(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ug(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function mg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var fg=new class extends bp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?mg(t,e,i,s):gg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?mg(t,e+2*n,i,s):gg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const vg=new Qt;class _g{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;vg.x1=s.bounds.x1*t,vg.y1=s.bounds.y1*t,vg.x2=s.bounds.x2*t,vg.y2=s.bounds.y2*t,e.union(vg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const yg={};[Sp,Ap,Mp,wp,Qp,Pp,Ip,jp,Hp,Vp,Kp,Xp,$p,Ep,qp,eg,sg,rg,og,fg,hg,dg,pg].forEach((t=>{yg[t.type]=t}));const bg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},xg=new Qt,Sg=["symbolType","size",...Dd];let Ag=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Jh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=yg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=bg[i]||i,!0===((n=i).startsWith("{const e=(new gl).fromString(t.d),i={};Mu.forEach((e=>{t[e]&&(i[ku[e]]=t[e])})),r.push({path:e,attribute:i}),xg.union(e.bounds)}));const a=xg.width(),o=xg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new _g(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new gl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new _g(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Jh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateSymbolAABBBounds(i,Jh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new gl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new gl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.userSymbolMap={},Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Nd);const Mg=["segments","points","curveType","curveTension",...Dd];let Tg=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=mu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}doUpdateAABBBounds(){const t=Jh(this).line;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateLineAABBBounds(e,Jh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.attribute,e=new gl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const Cg=["width","x1","y1","height","cornerRadius",...Dd];class Eg extends Vd{constructor(t){super(t),this.type="rect",this.numberType=_u}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Jh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRectAABBBounds(e,Jh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ad(t),r=new gl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Nd;class Bg extends Vd{constructor(t){super(t),this.type="glyph",this.numberType=uu,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=zl.graphicService.updateGlyphAABBBounds(this.attribute,Jh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Bg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Nd;class Lg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Hl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Og{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Nc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Vl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Nl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Ig=["width","height","image",...Dd];class Dg extends Vd{constructor(t){super(t),this.type="image",this.numberType=gu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Jh(this).image;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateImageAABBBounds(e,Jh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Fl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ig)}needUpdateTag(t){return super.needUpdateTag(t,Ig)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Nd);class jg extends Dg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Bc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Bc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fl.width,height:e=Fl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class zg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Hl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Ul.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof jg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Xl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof jg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Hl[this.direction]}store(t){if(t instanceof jg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new zg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof jg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,s=Yl(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==s){const[e,i]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character),new Og(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Dd];class Vg extends Vd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Jh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRichTextAABBBounds(e,Jh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Lg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Hg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i,n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s)})),n}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Nd);const Wg=["path","customPath",...Dd];class Ug extends Vd{constructor(t){super(t),this.type="path",this.numberType=fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Jh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof gl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof gl?this.cache:t.path)}doUpdateAABBBounds(){const t=Jh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePathAABBBounds(e,Jh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new gl).fromString(t.path):t.customPath&&(this.cache=new gl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}toCustomPath(){return(new gl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Nd);const Kg=["segments","points","curveType","curveTension",...Dd];class Xg extends Vd{constructor(t){super(t),this.type="area",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Jh(this).area;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateAreaAABBBounds(e,Jh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){const t=new gl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Dd];class Zg extends Vd{constructor(t){super(t),this.type="arc",this.numberType=lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Jh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Jh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ie(e),i=e+r,s&&Lt(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Jh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Lt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Vt(Number(l)/o*jt(g)),n=Vt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Jh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateArcAABBBounds(i,Jh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}getDefaultAttribute(t){return Jh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Lt(i-e),a=i>e;if(n=Rt-Ct)o.moveTo(0+n*It(e),0+n*jt(e)),o.arc(0,0,n,e,i,!a),s>Ct&&(o.moveTo(0+s*It(i),0+s*jt(i)),o.arc(0,0,s,i,e,a));else{const t=n*It(e),r=n*jt(e),l=s*It(i),h=s*jt(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Nd);const Qg=["points","cornerRadius",...Dd];class tm extends Vd{constructor(t){super(t),this.type="polygon",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Jh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePolygonAABBBounds(e,Jh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){const t=this.attribute.points,e=new gl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new tm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tm.NOWORK_ANIMATE_ATTR}}function em(t){return new tm(t)}tm.NOWORK_ANIMATE_ATTR=Nd;class im extends wu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function sm(t){return new im(t)}class nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class rm extends nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;tu(i,s+(r+o)/2,!0,a)}return i}}class am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};function um(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function pm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function gm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),um(t,t,[n+o,r+l,a+h]),um(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),um(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=lm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}um(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),um(i,i,[-s[0],-s[1],0]),gm(t,t,i)}}let fm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new to(["graphic"]),onSetStage:new to(["graphic","stage"]),onRemove:new to(["graphic"]),onRelease:new to(["graphic"]),onAddIncremental:new to(["graphic","group","stage"]),onClearIncremental:new to(["graphic","group","stage"]),beforeUpdateAABBBounds:new to(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new to(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Qt,this.tempAABBBounds2=new Qt,this._rectBoundsContribitions=[new nm],this._symbolBoundsContribitions=[new rm],this._imageBoundsContribitions=[new nm],this._circleBoundsContribitions=[new nm],this._arcBoundsContribitions=[new nm],this._pathBoundsContribitions=[new nm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new lo(t);return Lo(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=mp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=gp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){tu(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Zt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Rt-Ct?i.set(-a,-a,a,a):Oc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=Ct?i.set(0,0,0,0):Math.abs(l-h)>Rt-Ct?i.set(-n,-n,n,n):(Oc(h,l,n,i),Oc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){tu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;tu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Zt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};fm=hm([Oa(),dm(0,Ra(Au)),cm("design:paramtypes",[Object])],fm);const vm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let _m,ym;function bm(t){return _m||(_m=vm.CreateGraphic("text",{})),_m.initAttributes(t),_m.AABBBounds}const xm={x:0,y:0,z:0,lastModelMatrix:null};class Sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Gu(o,l,n),p=Uu(o,c),g=Nu(n,r),m=Vu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;xm.x=n,xm.y=r,xm.z=a,xm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=lm.allocate(),n=lm.allocate();mm(n,t,e),gm(s,d||s,n),xm.x=0,xm.y=0,xm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),lm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,xm.z=a,i.setTransformForCurrent()}else if(p)xm.x=0,xm.y=0,xm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,this.transformWithoutTranslate(i,xm.x,xm.y,xm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),xm.x=0,xm.y=0,xm.z=0;return xm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Gu(d,u,h),y=Uu(d,g),b=Nu(h),x=Vu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Lo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&lm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Am=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class km{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(km.IsGradientStr(t))try{const e=Am(t)[0];if(e){if("linear"===e.type)return km.ParseLinear(e);if("radial"===e.type)return km.ParseRadial(e);if("conic"===e.type)return km.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Mm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};class Pm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Lh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Lh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Bm=new Pm;let Rm=class{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Rm=wm([Oa(),Em(0,Ra(qa)),Em(0,Ia(hp)),Cm("design:paramtypes",[Object])],Rm);class Lm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Lh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Lh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Om=new Lm;const Im=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),$u(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),$u(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Dm=Om,Fm=Bm;const jm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},zm=Om,Hm=Bm;const Nm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vm=Et/2;function Gm(t,e,i,s,n,r){let a;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))a=[r=Lt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Lt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Lt(t[0]),i=Lt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Lt(a[0]),a[1]=Lt(a[1]),a[2]=Lt(a[2]),a[3]=Lt(a[3])}}else a=[0,0,0,0];if(s<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,s,n);const[o,l,h,c]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],d=Math.min(s/2,n/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],m=[l[0]-u[1],l[1]],f=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],y=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(m[0],m[1]),!q(m,f)){const e=m[0],i=m[1]+u[1];t.arc(e,i,u[1],-Vm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Vm,!1)}if(t.lineTo(y[0],y[1]),!q(y,b)){const e=y[0],i=y[1]-u[3];t.arc(e,i,u[3],Vm,Et,!1)}if(t.lineTo(g[0],g[1]),!q(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],Et,Et+Vm,!1)}return t.closePath(),t}var Wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Um{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Gm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Gm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Ym=class{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ym=Wm([Oa()],Ym);let Km=class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke}=t.attribute;let{width:v,height:_}=t.attribute;if(v=(null!=v?v:u-g)||0,_=(null!=_?_:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+v,s):e.moveTo(i+v,s),f[1]?e.lineTo(i+v,s+_):e.moveTo(i+v,s+_),f[2]?e.lineTo(i,s+_):e.moveTo(i,s+_),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Km=Wm([Oa()],Km);const Xm=new Um,$m=Om,qm=Bm;const Zm=new class extends Um{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Bc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Gm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Qm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},tf=Om,ef=Bm;var sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rf=function(t,e){return function(i,s){e(i,s,t)}};let af=class extends Sm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=lu,this.builtinContributions=[Im,Fm,Dm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Lt(d-c),p=d>c;let g=!1;if(nCt||C>Ct)&&(D=n*It(x),F=n*jt(x),j=r*It(A),z=r*jt(A),uCt){const t=Ft(k,P),r=Ft(M,P),a=Xu(j,z,R,L,n,t,Number(p)),o=Xu(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>Ct)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>Ct){const t=Ft(w,B),n=Ft(T,B),a=Xu(O,I,D,F,r,-n,Number(p)),o=Xu(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Ot(a.y01,a.x01),Ot(a.y11,a.x11),!p);const t=Ot(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*It(A),s+r*jt(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Lt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Ec[s]=t,i&&(i=!(null!==(e=Ec[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ec[e]=!!t[e],i&&(i=!!Ec[e]);else Ec[0]=!1,Ec[1]=!1,Ec[2]=!1,Ec[3]=!1;return{isFullStroke:i,stroke:Ec}})(d);if((v||C)&&(e.beginPath(),$u(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),$u(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Lt(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),md(o.color,l.color,h,!1)}(0,0,h,n);a||Gu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};af=sf([Oa(),rf(0,Ra(qa)),rf(0,Ia(Qu)),nf("design:paramtypes",[Object])],af);var of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(i,s){e(i,s,t)}};let cf=class extends Sm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=du,this.builtinContributions=[jm,Hm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function df(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function uf(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),df(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=To.ROW:"y"===s?m=To.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gf=class extends Sm{constructor(){super(...arguments),this.numberType=mu}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=pl(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function mf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function ff(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),df(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),df(t,l,1,s),o=!1):o=!0}t.closePath()}gf=pf([Oa()],gf);const vf=new class extends Lm{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:jc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:jc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_f=Bm;var yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xf=function(t,e){return function(i,s){e(i,s,t)}};function Sf(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}let Af=class extends Sm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=cu,this.builtinContributions=[vf,_f],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S,doStroke:A}=x,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Sf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Sf(e,C,{curveTension:b}),n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=To.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Lt(E.x-P.x),L=Lt(E.y-P.y);B=null==E.x1?To.ROW:null==E.y1?To.COLUMN:Number.isFinite(R+L)?R>L?To.ROW:To.COLUMN:To.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),mf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),mf(t,e,i,s),e.length=0,i.length=0)}n=o})),mf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?To.ROW:To.COLUMN,Number.isFinite(u)||(h=To.COLUMN),Number.isFinite(p)||(h=To.ROW);const g=i*(h===To.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Sm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Mf,kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Lo(t.pathShape.commandList,e,i,s,1,1,g);else{Lo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(np)),wf("design:paramtypes",[Object])],Ef);var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rf=function(t,e){return function(i,s){e(i,s,t)}};let Lf=class extends Sm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=_u,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Wu(g,m,k,M,c),w=Yu(g,v,k,M),C=Nu(c,d),E=Vu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Gm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(ap)),Bf("design:paramtypes",[Object])],Lf);var Of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Df=function(t,e){return function(i,s){e(i,s,t)}};let Ff=class extends Sm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bu,this.builtinContributions=[Qm,ef,tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Ff=Of([Oa(),Df(0,Ra(qa)),Df(0,Ia(op)),If("design:paramtypes",[Object])],Ff);const jf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Qt)}allocate(t,e,i,s){if(!this.pools.length)return(new Qt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Qt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const zf=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=jf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=bm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Gm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&jf.free(C),w()}};var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Sm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xu,this.builtinContributions=[zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Nc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=om.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),om.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=gp(l,f),_=mp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Wf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Sm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=vu,this.builtinContributions=[Xf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Wf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Uf(d,u),b=Uf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Yf(h,_,y,d,u),A=Yf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Uf(k,M),w=Yf(h,Uf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(rp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=pu}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Wu(u,f,p,g,h),k=Yu(u,v,p,g),M=Nu(h,c),T=Vu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Gm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Nm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave(),n.baseGlobalAlpha*=a;const o=Jh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=lm.allocate(),i=lm.allocate();mm(i,t,o),gm(e,l||e,i),n.modelMatrix=e,lm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&n.translate(h,c),s&&s.drawingCb&&(d=s.drawingCb()),n.modelMatrix!==l&&lm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};iv=Qf([Oa(),ev(0,Ra(qa)),ev(0,Ia(ip)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];let ov=class extends Sm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=gu,this.builtinContributions=[Zm,Jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Gm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,av[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Rd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};ov=sv([Oa(),rv(0,Ra(qa)),rv(0,Ia(sp)),nv("design:paramtypes",[Object])],ov);const lv=Symbol.for("IncrementalDrawContribution"),hv=Symbol.for("ArcRender"),cv=Symbol.for("AreaRender"),dv=Symbol.for("CircleRender"),uv=Symbol.for("GraphicRender"),pv=Symbol.for("GroupRender"),gv=Symbol.for("LineRender"),mv=Symbol.for("PathRender"),fv=Symbol.for("PolygonRender"),vv=Symbol.for("RectRender"),_v=Symbol.for("SymbolRender"),yv=Symbol.for("TextRender"),bv=Symbol.for("RichTextRender"),xv=Symbol.for("GlyphRender"),Sv=Symbol.for("ImageRender"),Av=Symbol.for("DrawContribution");var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tv=Symbol.for("DrawItemInterceptor"),wv=new Qt,Cv=new Qt;class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){wv.copy(s.dirtyBounds),Cv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(wv),s.backupDirtyBounds.copy(Cv)),!0}}class Pv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Bv=class{constructor(){this.order=1,this.interceptors=[new Ev,new Lv,new Rv,new Pv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===hu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&lm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};const Fv=Symbol.for("RenderService");let jv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jv=Ov([Oa(),Dv(0,Ra(Av)),Iv("design:paramtypes",[Object])],jv);var zv=new xa((t=>{t(Fv).to(jv)}));const Hv=Symbol.for("PickerService"),Nv=Symbol.for("GlobalPickerService");var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Gv=Symbol.for("PickItemInterceptor");let Wv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=om.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Wv=Vv([Oa()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Uv=Vv([Oa()],Uv);let Yv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===hu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Yv=Vv([Oa()],Yv);var Kv=new xa(((t,e,i)=>{i(Hv)||(t(Nv).toSelf(),t(Hv).toService(Nv)),t(Yv).toSelf().inSingletonScope(),t(Gv).toService(Yv),t(Wv).toSelf().inSingletonScope(),t(Gv).toService(Wv),t(Uv).toSelf().inSingletonScope(),t(Gv).toService(Uv),Ja(t,Gv)})),Xv=new xa((t=>{t(Su).to(fm).inSingletonScope(),t(Au).toConstantValue(vm)}));const $v=Symbol.for("AutoEnablePlugins"),qv=Symbol.for("PluginService");var Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qv=function(t,e){return function(i,s){e(i,s,t)}};let t_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound($v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};t_=Zv([Oa(),Qv(0,Ra(qa)),Qv(0,Ia($v)),Jv("design:paramtypes",[Object])],t_);var e_=new xa((t=>{t(qv).to(t_),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,$v)})),i_=new xa((t=>{Ja(t,eo)})),s_=new xa((t=>{t(Jl).to(Ql).inSingletonScope(),Ja(t,Jl)})),n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let a_=class{constructor(){this.type="static",this.offscreen=!1,this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};a_=n_([Oa(),r_("design:paramtypes",[])],a_);var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let h_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=zl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};h_=o_([Oa(),l_("design:paramtypes",[])],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=sh({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};u_=c_([Oa(),d_("design:paramtypes",[])],u_);var p_=new xa((t=>{t(a_).toSelf(),t(u_).toSelf(),t(h_).toSelf(),t(Lu).toService(a_),t(Ou).toService(u_),t(Iu).toService(h_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function m_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return g_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function v_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Jt,this.backupDirtyBounds=new Jt,this.global=zl.global,this.layerService=zl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,om.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,kl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ie(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=jf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=om.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):m_(t,kl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jf.free(n),om.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(lv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends gf{constructor(){super(...arguments),this.numberType=mu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Gu(u,p,c),_=Uu(u,g),y=Nu(c),b=Vu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Oa()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Af{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Gu(u,d,c),m=Nu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Oa()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let B_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new to([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,kl.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield f_(t,kl.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};B_=w_([Oa(),E_(0,La(uv)),E_(1,Ra(A_)),E_(2,Ra(M_)),E_(3,Ra(qa)),E_(3,Ia(Tv)),C_("design:paramtypes",[Array,Object,Object,Object])],B_);var R_=new xa((t=>{t(Pm).toSelf().inSingletonScope(),t(Lm).toSelf().inSingletonScope(),t(Av).to(x_),t(lv).to(B_),t(pv).to(iv).inSingletonScope(),t(uv).toService(pv),Ja(t,ip),t(Rm).toSelf().inSingletonScope(),Ja(t,hp),Ja(t,uv),t(Bv).toSelf().inSingletonScope(),t(Tv).toService(Bv),Ja(t,Tv)}));function L_(){L_.__loaded||(L_.__loaded=!0,th.load(Hu),th.load(Xv),th.load(zv),th.load(Kv),th.load(e_),function(t){t.load(i_),t.load(s_),t.load(p_)}(th),function(t){t.load(R_)}(th))}L_.__loaded=!1,L_();const O_=th.get(io);zl.global=O_;const I_=th.get(Bu);zl.graphicUtil=I_;const D_=th.get(Pu);zl.transformUtil=D_;const F_=th.get(Su);zl.graphicService=F_;const j_=th.get(Ru);zl.layerService=j_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),zl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class H_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),zl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){zl.graphicService.hooks.onAddIncremental.taps=zl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onClearIncremental.taps=zl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,zl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class V_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.unTap(this.key),zl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?zl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:zl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=ni(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Jh(t).text)}getTransformOfText(t){const e=Jh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=ti(h,c);o=t.x,l=t.y}const p=zl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));zl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===zl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&zl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===zl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const G_=new Qt;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(G_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(G_,t.parent&&t.parent.globalTransMatrix)))})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),zl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.taps=zl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const U_=new Qt;class Y_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ba.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Qt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Jh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&U_.copy(s)})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(U_.equals(i)||this.tryLayout(t,!1))})),zl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const K_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===mc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=mc.INITIAL,zl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),zl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:gc},{mode:"timeout",cons:pc},{mode:"manual",cons:uc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==mc.INITIAL&&(this.status=mc.PAUSE,!0)}resume(){return this.status!==mc.INITIAL&&(this.status=mc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===mc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===mc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=mc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=mc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};K_.addTimeline(_c),K_.setFPS(60);class X_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=pd.Get(e,ud.Color1),this.ambient=i;const s=zt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Ft(Dt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?pd.Get(e,ud.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function $_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function q_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Z_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&zl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ey="white";class iy extends wu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ey}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=zl.global,!this.global.env&&Q_()&&this.global.setEnv("browser"),this.window=th.get(Dh),this.renderService=th.get(Fv),this.pluginService=th.get(qv),this.layerService=th.get(Ru),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ey,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||K_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new vc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new X_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Z_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new H_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Jt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Y_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new V_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new ty))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=th.get(Hv));const i=this.pickerService.pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry=new oe(1,0,0,1,0,0),ay={x:0,y:0};let oy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this.path=new gl,this._clearMatrix=new oe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ay),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,ay.x,ay.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ay);const i=Mm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,ay.x,ay.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ry,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};oy=sy([Oa(),ny("design:paramtypes",[Object,Number])],oy);var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cy={WIDTH:500,HEIGHT:500,DPR:1};let dy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=cy.WIDTH,height:n=cy.HEIGHT,dpr:r=cy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};dy.env="browser",dy=ly([Oa(),hy("design:paramtypes",[Object])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let py=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Qt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};py=uy([Oa()],py);var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fy=class{constructor(){this._uid=ba.GenAutoIncrementId(),this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};fy=gy([Oa(),my("design:paramtypes",[])],fy);var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yy=function(t,e){return function(i,s){e(i,s,t)}};let by=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=zl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Qt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new oe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=lm.allocate();if(pm(i,e),a){if(i){const t=lm.allocate();r.modelMatrix=gm(t,a,i),lm.free(i)}}else pm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&lm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),om.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function xy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&xy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&xy(t,a,i,s,n))}function Sy(t,e){const i=t.length-1,s=[t[0]];return xy(t,0,i,e,s),s.push(t[i]),s}by=vy([Oa(),yy(0,Ra(qa)),yy(0,Ia(Gv)),_y("design:paramtypes",[Object])],by);let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(af).toSelf().inSingletonScope(),t(hv).to(af).inSingletonScope(),t(uv).toService(hv),t(Qu).toService(Rm),Ja(t,Qu))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(Lf).toSelf().inSingletonScope(),t(vv).to(Lf).inSingletonScope(),t(uv).toService(vv),t(Km).toSelf(),t(Ym).toSelf(),t(ap).toService(Km),t(ap).toService(Ym),t(ap).toService(Rm),Ja(t,ap))}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(gf).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(gv).to(gf).inSingletonScope(),t(uv).toService(gv))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(Af).toSelf().inSingletonScope(),t(cv).to(Af).inSingletonScope(),t(uv).toService(cv),t(tp).toService(Rm),Ja(t,tp),t(M_).toSelf().inSingletonScope())}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(Ff).toSelf().inSingletonScope(),t(_v).to(Ff).inSingletonScope(),t(uv).toService(_v),t(op).toService(Rm),Ja(t,op))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(cf).toSelf().inSingletonScope(),t(dv).to(cf).inSingletonScope(),t(uv).toService(dv),t(ep).toService(Rm),Ja(t,ep))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(yv).to(Gf).inSingletonScope(),t(uv).toService(yv),t(lp).toService(Rm),Ja(t,lp))}));let Fy=!1;const jy=new xa((t=>{Fy||(Fy=!0,t(Ef).toSelf().inSingletonScope(),t(mv).to(Ef).inSingletonScope(),t(uv).toService(mv),t(np).toService(Rm),Ja(t,np))}));let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(fv).to(Jf).inSingletonScope(),t(uv).toService(fv),t(rp).toService(Rm),Ja(t,rp))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vy=class{constructor(){this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Vy=Ny([Oa()],Vy);let Gy=!1;const Wy=new xa((t=>{Gy||(Gy=!0,t(xv).to(Vy).inSingletonScope(),t(uv).toService(xv))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=class extends Sm{constructor(){super(),this.numberType=yu,this.builtinContributions=[zf],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Gu(o,l,!0),d=Gu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Gm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};Ky=Uy([Oa(),Yy("design:paramtypes",[])],Ky);let Xy=!1;const $y=new xa((t=>{Xy||(Xy=!0,t(bv).to(Ky).inSingletonScope(),t(uv).toService(bv))}));let qy=!1;const Zy=new xa((t=>{qy||(qy=!0,t(Sv).to(ov).inSingletonScope(),t(uv).toService(Sv),t(sp).toService(Rm),Ja(t,sp))}));const Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Q_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),db=t=>e=>R(e,t),ub=t=>{at.getInstance().error(t)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ub("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ub("Access path missing closing bracket: "+t),a&&ub("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return cb((i&&i.get||db)(s),[n],e||n)},gb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>pb(t,e,i)));return t=>s.map((e=>e(t)))}return pb(t,e,i)};gb("id");const mb=cb((function(t){return t}),[],"identity"),fb=cb((function(){return 0}),[],"zero");cb((function(){return 1}),[],"one"),cb((function(){return!0}),[],"true"),cb((function(){return!1}),[],"false"),cb((function(){return{}}),[],"emptyObject");const vb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>_b(t,r,n)))))},yb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function bb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function xb(t,e,i,s,n){let r=0,a=0;return bb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Sb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;bb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xb(t,e,i,n,h)}}function Ab(t){return"horizontal"===t}function kb(t){return"vertical"===t}const Mb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Tb extends wu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,Mb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Mb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const tx=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},ex=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ix extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||tx(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=ex(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=ex(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=tx(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ac.now()-i>this.config.press.time&&ex(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rx=[0,0,0];let ax=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},_l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},xl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this._clearMatrix=new oe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new oe(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ju.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=zl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:xl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:xl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=Tm(this,l,t,i,s)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=Mm(this,l,this.dpr),r.strokeStyle=Tm(this,h,t,i,s),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=pp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=pp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};ax.env="browser",ax=sx([Oa(),nx("design:paramtypes",[Object,Number])],ax);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hx=class extends dy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=zl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ax(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function cx(t,e){return new xa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}hx.env="browser",hx=ox([Oa(),lx("design:paramtypes",[Object])],hx);const dx=cx(hx,ax);var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let mx=class extends by{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Lh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vx=class{constructor(){this.type="group",this.numberType=pu}contains(t,e,i){return!1}};vx=fx([Oa()],vx);const _x=new xa(((t,e,i,s)=>{_x.__vloaded||(_x.__vloaded=!0,t(Zb).to(vx).inSingletonScope(),t(Jb).toService(Zb),Ja(t,Jb))}));_x.__vloaded=!1;var yx=_x;const bx=new xa(((t,e,i,s)=>{i(mx)||t(mx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(mx):t(Hv).toService(mx)}));var xx,Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=xx=class extends fy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${xx.idprefix}_${xx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=zl.global,this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:xx.GenerateCanvasId(),canvasControled:!0};this.canvas=new hx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new hx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};kx.env="browser",kx.idprefix="visactor_window",kx.prefix_count=0,kx=xx=Sx([Oa(),Ax("design:paramtypes",[])],kx);const Mx=new xa((t=>{t(kx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(kx))).whenTargetNamed(kx.env)}));var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends py{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Qt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ba.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Tx([Oa(),wx("design:paramtypes",[])],Px);const Bx=new xa((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(eo).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(dx),t.load(Mx),e&&function(t){t.load(yx),t.load(bx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ox=class extends ax{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};Ox.env="feishu",Ox=Lx([Oa()],Ox);var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fx=class extends dy{constructor(t){super(t)}init(){this._context=new Ox(this,this._dpr)}release(){}};Fx.env="feishu",Fx=Ix([Oa(),Dx("design:paramtypes",[Object])],Fx);const jx=cx(Fx,Ox);var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};class Vx{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Gx=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new Vx}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Fx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Gx.env="feishu",Gx=zx([Oa(),Nx(0,Ra(io)),Hx("design:paramtypes",[Object])],Gx);const Wx=new xa((t=>{t(Gx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Gx))).whenTargetNamed(Gx.env)}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends by{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new oy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xx=Ux([Oa(),Kx(0,Ra(qa)),Kx(0,Ia(wb)),Kx(1,Ra(qa)),Kx(1,Ia(Gv)),Yx("design:paramtypes",[Object,Object])],Xx);const $x=new xa((t=>{$x.__vloaded||($x.__vloaded=!0,Ja(t,wb))}));$x.__vloaded=!1;var qx=$x,Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([Oa(),Qx(0,Ra(hv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new xa(((t,e,i,s)=>{eS||(eS=!0,t(Cb).to(tS).inSingletonScope(),t(wb).toService(Cb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};aS=sS([Oa(),rS(0,Ra(cv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new xa(((t,e,i,s)=>{oS||(oS=!0,t(Eb).to(aS).inSingletonScope(),t(wb).toService(Eb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([Oa(),dS(0,Ra(dv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new xa(((t,e,i,s)=>{pS||(pS=!0,t(Pb).to(uS).inSingletonScope(),t(wb).toService(Pb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};_S=mS([Oa(),vS(0,Ra(xv)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(jb).to(_S).inSingletonScope(),t(_S).toService(jb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};SS=xS([Oa()],SS);let AS=!1;const kS=new xa(((t,e,i,s)=>{AS||(AS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([Oa(),wS(0,Ra(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new xa(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(wb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OS=BS([Oa(),LS(0,Ra(fv)),RS("design:paramtypes",[Object])],OS);let IS=!1;const DS=new xa(((t,e,i,s)=>{IS||(IS=!0,t(Fb).to(OS).inSingletonScope(),t(wb).toService(Fb))}));var FS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zS=function(t,e){return function(i,s){e(i,s,t)}};let HS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};HS=FS([Oa(),zS(0,Ra(mv)),jS("design:paramtypes",[Object])],HS);let NS=!1;const VS=new xa(((t,e,i,s)=>{NS||(NS=!0,t(Lb).to(HS).inSingletonScope(),t(wb).toService(Lb))}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},US=function(t,e){return function(i,s){e(i,s,t)}};const YS=new Qt;let KS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;YS.setValue(i.x1,i.y1,i.x2,i.y2),YS.expand(-r/2),h=!YS.containsPoint(e)}}return s.highPerformanceRestore(),h}};KS=GS([Oa(),US(0,Ra(vv)),WS("design:paramtypes",[Object])],KS);let XS=!1;const $S=new xa(((t,e,i,s)=>{XS||(XS=!0,t(Ob).to(KS).inSingletonScope(),t(wb).toService(Ob))}));let qS=!1;const ZS=new xa(((t,e,i,s)=>{qS||(qS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};eA=JS([Oa(),tA(0,Ra(_v)),QS("design:paramtypes",[Object])],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Ib).to(eA).inSingletonScope(),t(wb).toService(Ib))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class{constructor(){this.type="text",this.numberType=xu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};rA=nA([Oa()],rA);let aA=!1;const oA=new xa(((t,e,i,s)=>{aA||(aA=!0,t(Db).to(rA).inSingletonScope(),t(wb).toService(Db))})),lA=new xa(((t,e,i,s)=>{i(Xx)||t(Xx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(Xx):t(Hv).toService(Xx)}));class hA{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uA=class extends py{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new hA(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};uA=cA([Oa(),dA("design:paramtypes",[])],uA);const pA=new xa((t=>{pA.isFeishuBound||(pA.isFeishuBound=!0,t(uA).toSelf().inSingletonScope(),t(eo).toService(uA))}));function gA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];gA.__loaded||(gA.__loaded=!0,t.load(pA),t.load(jx),t.load(Wx),e&&function(t){t.load(qx),t.load(lA),t.load(iS),t.load(lS),t.load(gS),t.load(bS),t.load(kS),t.load(PS),t.load(DS),t.load(VS),t.load($S),t.load(ZS),t.load(sA),t.load(oA)}(t))}pA.isFeishuBound=!1,gA.__loaded=!1;var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends ax{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vA.env="node",vA=mA([Oa(),fA("design:paramtypes",[Object,Number])],vA);var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bA=class extends dy{constructor(t){super(t)}init(){this._context=new vA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bA.env="node",bA=_A([Oa(),yA("design:paramtypes",[Object])],bA);const xA=cx(bA,vA);var SA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,s){e(i,s,t)}};let MA=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new bA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};MA.env="node",MA=SA([Oa(),kA(0,Ra(io)),AA("design:paramtypes",[Object])],MA);const TA=new xa((t=>{t(MA).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(MA))).whenTargetNamed(MA.env)}));var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CA=class extends py{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};CA=wA([Oa()],CA);const EA=new xa((t=>{EA.isNodeBound||(EA.isNodeBound=!0,t(CA).toSelf().inSingletonScope(),t(eo).toService(CA))}));function PA(t){PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(xA),t.load(TA))}EA.isNodeBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([Oa(),LA(0,Ra(hv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new xa(((t,e,i,s)=>{IA||(IA=!0,t(zb).to(OA).inSingletonScope(),t(Jb).toService(zb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Qt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([Oa(),zA(0,Ra(vv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new xa(((t,e,i,s)=>{VA||(VA=!0,t(Ub).to(NA).inSingletonScope(),t(Jb).toService(Ub))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends Sm{};UA=WA([Oa()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Jh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([Oa(),XA(0,Ra(gv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new xa(((t,e,i,s)=>{qA||(qA=!0,t(Gb).to($A).inSingletonScope(),t(Jb).toService(Gb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([Oa(),tk(0,Ra(cv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new xa(((t,e,i,s)=>{ik||(ik=!0,t(Hb).to(ek).inSingletonScope(),t(Jb).toService(Hb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Jh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&lm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([Oa(),ak(0,Ra(_v)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new xa(((t,e,i,s)=>{lk||(lk=!0,t(Yb).to(ok).inSingletonScope(),t(Jb).toService(Yb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([Oa(),uk(0,Ra(dv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new xa(((t,e,i,s)=>{gk||(gk=!0,t(Nb).to(pk).inSingletonScope(),t(Jb).toService(Nb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Jh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=mp(a,u,n),v=gp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&lm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([Oa(),_k(0,Ra(yv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new xa(((t,e,i,s)=>{bk||(bk=!0,t(Kb).to(yk).inSingletonScope(),t(Jb).toService(Kb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([Oa(),kk(0,Ra(mv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new xa(((t,e,i,s)=>{Tk||(Tk=!0,t(Wb).to(Mk).inSingletonScope(),t(Jb).toService(Wb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([Oa(),Pk(0,Ra(fv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new xa(((t,e,i,s)=>{Rk||(Rk=!0,t(Xb).to(Bk).inSingletonScope(),t(Jb).toService(Xb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([Oa(),Dk(0,Ra(xv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new xa(((t,e,i,s)=>{jk||(jk=!0,t(qb).to(Fk).inSingletonScope(),t(Jb).toService(qb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([Oa(),Vk(0,Ra(bv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t($b).to(Gk).inSingletonScope(),t(Jb).toService($b))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([Oa()],Kk);let Xk=!1;const $k=new xa(((t,e,i,s)=>{Xk||(Xk=!0,t(Vb).to(Kk).inSingletonScope(),t(Jb).toService(Vb))})),qk=Q_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,vm.RegisterGraphicCreator("arc",Jg),th.load(ky),th.load(qk?DA:iS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,vm.RegisterGraphicCreator("area",$g),th.load(Py),th.load(qk?sk:lS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,vm.RegisterGraphicCreator("circle",up),th.load(Oy),th.load(qk?mk:gS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,vm.RegisterGraphicCreator("glyph",Rg),th.load(Wy),th.load(qk?zk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,vm.RegisterGraphicCreator("group",Cu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,vm.RegisterGraphicCreator("image",Fg),th.load(Zy),th.load(qk?$k:kS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,vm.RegisterGraphicCreator("line",wg),th.load(Cy),th.load(qk?ZA:PS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,vm.RegisterGraphicCreator("path",Yg),th.load(jy),th.load(qk?wk:VS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,vm.RegisterGraphicCreator("polygon",em),th.load(Hy),th.load(qk?Lk:DS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,vm.RegisterGraphicCreator("rect",Pg),th.load(Ty),th.load(qk?GA:$S))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,vm.RegisterGraphicCreator("richtext",Gg),th.load($y),th.load(qk?Uk:ZS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,vm.RegisterGraphicCreator("shadowRoot",sm))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,vm.RegisterGraphicCreator("symbol",kg),th.load(Ry),th.load(qk?hk:sA))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,vm.RegisterGraphicCreator("text",yp),th.load(Dy),th.load(qk?xk:oA))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:xt,throttle:St};MM();let LM=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===O_.env?(O_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===O_.env?(O_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ei(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ei(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new _e(t).toHex(),o=new _e(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=_e.getColorBrightness(new _e(e));return _e.getColorBrightness(new _e(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:bm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=bm({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?vm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),vm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:Gke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>we&&keEe&&TeAe&&CeMe&&PeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([Oa()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([Oa()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([Oa()],uT);const pT=new xa(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(hp).toService(hT)),i(dT)||(t(dT).toSelf(),t($v).toService(dT)),i(uT)||(t(uT).toSelf(),t($v).toService(uT))}));class gT extends Tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=se(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Vc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Tb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Ie(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=vm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new gl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==So.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===So.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,xo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=ti(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,l+c)||gt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new gl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Tb{getStartAngle(){return re(this._startAngle)}getEndAngle(){return re(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=vm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=vm.line;Y(i)[0].cornerRadius&&(t=vm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=vm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=vm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function lw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function hw(t,e,i,s){const n=bm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const pw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},gw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,mw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class fw extends Tb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=pw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=vm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=vm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=vm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=vm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=vm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=vm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=vm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Lt(s[0])>Lt(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function vw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function _w(t,e){return Ie(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=He(t,i),r=He(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=ze(t),l=ze(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:te(t.angle);let m=i?t.angle+Pt:te(90-t.angle);const f=i?e.angle:te(e.angle);let v=i?e.angle+Pt:te(90-e.angle);m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Fe(n,i)+Fe(n,s))/2>Fe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const yw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&bw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function bw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function xw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Aw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Tw(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},ww(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),vw(e)}function Mw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Tw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function ww(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Cw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Ew(){aM(),cM(),_M(),kM()}var Pw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Tw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return ww(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=te(e)})),kw(i,t),!Aw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(Sw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),vw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:yw[n]||yw.parity;if(s.length>=3&&xw(s,r)){do{s=a(s,r)}while(s.length>=3&&xw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&bw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=vm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ei(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Bw.defaultAttributes=aw,U(Bw,Cw);class Rw{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return se(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Lw,Ow=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=vm.circle(c);d.name=sw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},rw,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Ow(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Iw.defaultAttributes=aw,U(Iw,Rw);class Dw extends yc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=Tt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=Tt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:At(i,s)})),r=Tt.lastIndex;return r{jw[t]=!0}));const Gw=t=>-Math.log(-t),Ww=t=>-Math.exp(-t),Uw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Yw=t=>10===t?Uw:t===Math.E?Math.exp:e=>Math.pow(t,e),Kw=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Xw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$w=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function qw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Zw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Jw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Qw(t,e,i,s){return 1===i&&(i=0),Jw(t,i,s)*(e/(1-i))}function tC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function eC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class nC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=tC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const rC=Symbol("implicit");class aC extends nC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Lw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=rC}clone(){const t=(new aC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==rC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class lC extends aC{constructor(t){super(),this.type=Lw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Qw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:oC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return oC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new lC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:hC}=xe;function cC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=_e.parseColorString(e)){const e=hC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?hC(t,e):e instanceof _e?hC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class dC extends nC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Vw,this._piecewise=Zw,this._interpolate=cC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?eC:Zw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Vw),this.rescale(i)):this._clamp!==Vw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const uC=Math.sqrt(50),pC=Math.sqrt(10),gC=Math.sqrt(2),mC=[1,2,5,10],fC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=bC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?_C(0,-(e-1)/s,s):_C((e-1)/s,0,s)},vC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return fC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return fC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=_C(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=_C(t,e,l);return n&&r.reverse(),r})),bC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=mC[0];return i>=uC?s=mC[3]:i>=pC?s=mC[2]:i>=gC&&(s=mC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function xC(t,e,i){const s=(e-t)/Math.max(0,i);return bC(s)}function SC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=xC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function kC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const MC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),TC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),wC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=yC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?MC(t,e,n):MC(t,e,sC(n)),h=MC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),CC=ft(((t,e,i,s,n)=>SC(s(t),s(e),i).map((t=>sC(n(t))))));class EC extends dC{constructor(){super(...arguments),this.type=Lw.Linear}clone(){return(new EC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return vC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=yC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return SC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=kC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=AC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=AC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=AC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function PC(t){return e=>-t(-e)}function BC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class RC extends dC{constructor(){super(Kw(10),Yw(10)),this.type=Lw.Log,this._limit=BC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new RC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Kw(this._base),s=Yw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=PC(i),this._pows=PC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Gw,this.untransformer=Ww):(this._logs=i,this._pows=s,this._limit=BC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Vw}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return TC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class LC extends EC{constructor(){super(Xw(1),$w(1)),this.type=Lw.Symlog,this._const=1}clone(){return(new LC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Xw(t),this.untransformer=$w(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return TC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class OC{constructor(){this.type=Lw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new OC).domain(this._domain).range(this._range).unknown(this._unknown)}}const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Qt(t).expand(i/2),n=new Qt(e).expand(i/2);return s.intersects(n)};function FC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function jC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=te(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=zC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=zC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=zC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=zC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Qt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},NC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=se({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Qt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},VC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&FC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},GC=(t,e,i,s)=>HC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),WC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},UC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!WC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?UC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},XC=(t,e)=>{if(zw(t.type))return((t,e)=>{if(!zw(t.type))return IC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return IC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=HC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&jC(n,i);)n=VC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return IC(h)})(t,e);if(Nw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=GC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=YC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=GC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=NC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)})(t,e)}return IC(t.domain())};function $C(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function qC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=qt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function ZC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=$C(t,!!n),o=$C(r,!!n);const h=qt.distancePP(s,l),c=qt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=qC(e,t,!1,!!n),o=qC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=$C(t,!!n),o=$C(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class JC extends Tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=$C(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=qC(t,o,!1,!!a)}const u=vm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=$C(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=vm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(QC,Cw);var tE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(eE,Rw);const iE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",sE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},nE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var rE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(rE||(rE={}));var aE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=rE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=rE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=rE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===O_.env&&(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===rE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===rE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=rE.endHandler):h+=l:this._activeTag===rE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===rE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===O_.env&&(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=aE(i,["formatMethod"]),{formatMethod:a}=s,o=aE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Jt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},nE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},nE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},nE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},nE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Sy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var hE,cE,dE,uE;function pE(){aM(),tT()}function gE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function mE(t,e){const{dx:i,dy:s}=gE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}lE.defaultAttributes=sE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(hE||(hE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(cE||(cE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(dE||(dE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(uE||(uE={}));class fE extends Tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=pw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=vm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=vm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=vm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function vE(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function _E(t,e,i,s){t&&(vE(t.startSymbol,e,i,s),t.lines.forEach((t=>vE(t,e,i,s))),vE(t.line,e,i,s),vE(t.endSymbol,e,i,s))}function yE(t,e,i,s){t&&(vE(t.getTextShape(),e,i,s),vE(t.getBgRect(),e,i,s))}function bE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function xE(t,e,i,s){t&&(bE(t.startSymbol,e,i,s),t.lines.forEach((t=>bE(t,e,i,s))),bE(t.line,e,i,s),bE(t.endSymbol,e,i,s))}function SE(t,e,i,s){t&&(bE(t.getTextShape(),e,i,s),bE(t.getBgRect(),e,i,s))}function AE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;vE(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),vE(t.endSymbol,s+r+a,o,n),vE(e.getTextShape(),s+r+a+o,l,n),vE(e.getBgRect(),s+r+a+o,l,n)}function kE(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}function ME(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function TE(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function wE(t,e,i,s,n,r){var a;_E(t,n,s,r),vE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?yE(i,n,s,r):vE(i,n,s,r)}function CE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;vE(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),vE(e,n+o+l,h,r),vE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(vE(i.getTextShape(),n+o+l+h+c,d,r),vE(i.getBgRect(),n+o+l+c,d,r)):vE(i,n+o+l+c,d,r)}function EE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?AE(t,e,s,r,a):"fadeIn"===i&&kE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?AE(t,e,s,n,a):"fadeIn"===i&&kE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?wE(n,r,e,i,s,o):"callIn"===t&&CE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?wE(n,r,e,i,s,a):"callIn"===t&&CE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;xE(t,n,s,r),bE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?SE(i,n,s,r):bE(i,n,s,r)}(n,r,e,t,i,s)}}const LE={type:"clipIn",duration:500,easing:"linear",delay:0},OE={type:"fadeIn",duration:500,easing:"linear",delay:0},IE={type:"callIn",duration:500,easing:"linear",delay:0},DE={type:"fadeOut",duration:500,easing:"linear",delay:0};class FE extends fE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=LE,this.defaultExitAnimation=DE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;mE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const jE=.001,zE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:hE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},NE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:dE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},VE={interactive:!0,label:{position:cE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},GE={interactive:!0,label:{position:dE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},UE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},YE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function KE(){XE._animate=EE}pE(),QT();class XE extends FE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,jE)||FM(Math.abs(e),3*Math.PI/2,jE)?jM(i,e,t):DM(e)?HE.postiveXAxis[t]:HE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function $E(){qE._animate=PE}XE.defaultAttributes=zE,pE(),gM();class qE extends fE{markerAnimate(t){qE._animate&&this._animationConfig&&qE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=vm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}qE.defaultAttributes=VE,pE(),tw();class ZE extends FE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case dE.arcInnerStart:l=s;case dE.arcOuterStart:l=s;break;case dE.arcInnerEnd:l=n;case dE.arcOuterEnd:l=n;break;case dE.center:case dE.arcInnerMiddle:case dE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return WE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}ZE.defaultAttributes=NE,pE(),Jk();class JE extends fE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case dE.center:h=(i+s)/2,c=(n+r)/2;break;case dE.arcInnerStart:h=i,c=n;break;case dE.arcOuterStart:h=s,c=n;break;case dE.arcInnerEnd:h=i,c=r;break;case dE.arcOuterEnd:h=s,c=r;break;case dE.arcInnerMiddle:h=i,c=(n+r)/2;break;case dE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},WE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=vm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function QE(){tP._animate=RE}JE.defaultAttributes=GE,pE(),QT(),tw(),SM(),lM(),cM();class tP extends fE{markerAnimate(t){tP._animate&&this._animationConfig&&tP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=DE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,jE)||FM(Math.abs(s),3*Math.PI/2,jE)?jM(t,s,n):DM(s)?YE.postiveXAxis[n]:YE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=uE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=vm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=vm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=vm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,jE)||FM(d,0,jE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(hP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(hP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===hP.focus||"focus"===o){const s=a.hasState(oP.focus);a.toggleState(oP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover,oP.focus],t),this._setLegendItemState(e,oP.selected,t)})):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover,oP.focus],t),this._setLegendItemState(e,oP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(oP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(oP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(lP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[oP.selected,oP.selectedHover],t),this._setLegendItemState(a,oP.unSelected,t)):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t))}else this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover],t),this._setLegendItemState(e,oP.unSelected,t))}))}this._dispatchLegendEvent(lP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,oP.selected),this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover])):(this._removeLegendItemState(e,[oP.selected,oP.selectedHover]),this._setLegendItemState(e,oP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=nP,spaceRow:h=rP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ei(c);let w;!1===x.visible?(w=vm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,hP.item,t,w)):(w=vm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,hP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?oP.selected:oP.unSelected);const C=vm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=vm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,hP.itemShape,t,w,S.state),s.addState(e?oP.selected:oP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=vm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,hP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,hP.itemLabel,t,w,A.state),D.addState(e?oP.selected:oP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,hP.itemValue,t,w,k.state),r.addState(e?oP.selected:oP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute;return this._itemContext.isHorizontal?new sP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new sP(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=vm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=nP,spaceRow:a=rP}=s,o=this._itemsContainer,{space:l=aP,defaultCurrent:h=1}=n,c=pP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=vm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(oP.selected)?this._setLegendItemState(t,oP.selectedHover,e):this._setLegendItemState(t,oP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===hP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(lP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(oP.unSelectedHover)||t.hasState(oP.selectedHover))&&(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(oP.unSelectedHover)&&!t.hasState(oP.selectedHover)||(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===hP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(lP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(oP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},gP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(oP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var fP;function vP(t){return y(t)?t:[t,t]}function _P(t){return t?"ew-resize":"ns-resize"}mP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:nP,spaceRow:rP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:aP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(fP||(fP={})),dP();class yP extends Tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:vP(d)[0],endValue:vP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=vm.group({x:0,y:0});m.name=fP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=vm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=fP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=vm.group({x:g?v:0,y:g?0:v});m.add(_);const y=vm.group({x:0,y:0});let b;if(y.name=fP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=vm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=fP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=vm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=fP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=vP(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(v.name=fP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=fP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(i.name=fP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=fP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=vm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=fP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":_P(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=vm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=fP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return vm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":_P(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),vm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=vm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=vm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===fP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===fP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===fP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===fP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}yP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},uP(),dP();class bP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function xP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}bP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},uP(),dP(),uM();class SP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=vm.group({x:0,y:0});this._innerView.add(x);const S=new yP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:xP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=vm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}SP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let AP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ei(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};AP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const kP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let MP=class extends Tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(kP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class TP extends Ag{constructor(t){super(t)}}var wP,CP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(wP||(wP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(CP||(CP={}));class EP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},EP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},EP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new TP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new TP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new TP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(wP.OnPlay)},this.pause=()=>{this._dispatchEvent(wP.OnPause)},this.forward=()=>{this._dispatchEvent(wP.OnForward)},this.backward=()=>{this._dispatchEvent(wP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}EP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},EP.defaultAttributes={[CP.Start]:{},[CP.Pause]:{},[CP.Backward]:{},[CP.Forward]:{}};const PP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},BP=[200,10];var RP,LP;!function(t){t.Default="default",t.Reverse="reverse"}(RP||(RP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(LP||(LP={}));const OP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},DP=t=>"top"===t||"bottom"===t;class FP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(DP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:BP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:BP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new yP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return DP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new EP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=DP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:BP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(DP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:DP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:DP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function jP(){dP(),aM(),SM()}FP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},PP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},PP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},PP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},PP),{key:"backward",position:"start"})}},jP();class zP extends FP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:RP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(LP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(OP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===RP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(LP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(LP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(LP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(LP.change),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var HP,NP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};jP();class VP extends FP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(LP.change))},this.play=()=>NP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(LP.play),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(LP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(HP||(HP={}));const GP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},WP=5;const UP={debounce:xt,throttle:St};aM(),gM();let YP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:UP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(HP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(HP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(HP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=GP.trigger,updateTrigger:e=GP.updateTrigger,endTrigger:i=GP.endTrigger,resetTrigger:s=GP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Xe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(HP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(HP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=WP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=vm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},XP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},$P={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Qt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},qP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let ZP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ei(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Nc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>qP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&yg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return KP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return KP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};ZP.defaultAttributes=$P;const JP=pt;function QP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function eB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function iB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function sB(t,e){const i=iB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function nB(t,e){const i=rB(t),s=rB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function rB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function aB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function oB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const lB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var cB,dB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(cB||(cB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dB||(dB={}));const uB="__VCHART",pB=500,gB=500,mB=`${uB}_LABEL_LIMIT`,fB=`${uB}_LABEL_ALIGN`,vB=`${uB}_LABEL_TEXT`,_B=`${uB}_LABEL_VISIBLE`,yB=`${uB}_LABEL_X`,bB=`${uB}_LABEL_Y`,xB=`${uB}_ARC_TRANSFORM_VALUE`,SB=`${uB}_ARC_RATIO`,AB=`${uB}_ARC_START_ANGLE`,kB=`${uB}_ARC_END_ANGLE`,MB=`${uB}_ARC_K`,TB=`${uB}_ARC_MIDDLE_ANGLE`,wB=`${uB}_ARC_QUADRANT`,CB=`${uB}_ARC_RADIAN`,EB=-Math.PI/2,PB=3*Math.PI/2,BB=-90,RB=.6;var LB,OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(LB||(LB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(OB||(OB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(IB||(IB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(DB||(DB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(FB||(FB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(jB||(jB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(zB||(zB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(HB||(HB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(NB||(NB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(VB||(VB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(GB||(GB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WB||(WB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(UB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",UB.AFTER_EVALUATE_DATA="afterEvaluateData",UB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",UB.AFTER_EVALUATE_SCALE="afterEvaluateScale",UB.BEFORE_PARSE_VIEW="beforeParseView",UB.AFTER_PARSE_VIEW="afterParseView",UB.BEFORE_TRANSFORM="beforeTransform",UB.AFTER_TRANSFORM="afterTransform",UB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",UB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",UB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",UB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",UB.BEFORE_STAGE_RESIZE="beforeStageResize",UB.AFTER_STAGE_RESIZE="afterStageResize",UB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",UB.AFTER_VRENDER_DRAW="afterVRenderDraw",UB.BEFORE_MARK_JOIN="beforeMarkJoin",UB.AFTER_MARK_JOIN="afterMarkJoin",UB.BEFORE_MARK_UPDATE="beforeMarkUpdate",UB.AFTER_MARK_UPDATE="afterMarkUpdate",UB.BEFORE_MARK_STATE="beforeMarkState",UB.AFTER_MARK_STATE="afterMarkState",UB.BEFORE_MARK_ENCODE="beforeMarkEncode",UB.AFTER_MARK_ENCODE="afterMarkEncode",UB.BEFORE_DO_LAYOUT="beforeDoLayout",UB.AFTER_DO_LAYOUT="afterDoLayout",UB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",UB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",UB.BEFORE_DO_RENDER="beforeDoRender",UB.AFTER_DO_RENDER="afterDoRender",UB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",UB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",UB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",UB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",UB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",UB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",UB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",UB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",UB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",UB.BEFORE_ELEMENT_STATE="beforeElementState",UB.AFTER_ELEMENT_STATE="afterElementState",UB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",UB.AFTER_ELEMENT_ENCODE="afterElementEncode",UB.ANIMATION_START="animationStart",UB.ANIMATION_END="animationEnd",UB.ELEMENT_ANIMATION_START="elementAnimationStart",UB.ELEMENT_ANIMATION_END="elementAnimationEnd",UB.ALL_ANIMATION_START="allAnimationStart",UB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(YB||(YB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(KB||(KB={}));const XB="__vgrammar_scene_item__",$B=[IB.line,IB.area],qB=[IB.arc3d,IB.rect3d,IB.pyramid3d],ZB="key",JB=[{}],QB=["key"],tR=!0,eR=!0,iR=!1,sR=!0,nR="VGRAMMAR_IMMEDIATE_ANIMATION",rR=0,aR=1e3,oR=0,lR=0,hR=!1,cR=!1,dR="quintInOut",uR={stopWhenStateChange:!1,immediatelyApply:!0},pR="_mo_hide_";function gR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function mR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return gR(t.dependency,e);var i;return[]}function fR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function vR(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function _R(t,e){return yR(t)?t.output():e[t]}const yR=t=>t&&!u(t.grammarType),bR=t=>d(t)?t:e=>e[t];function xR(t){return!!(null==t?void 0:t.scale)}function SR(t){return!!(null==t?void 0:t.field)}function AR(t,e){if(!t)return[];let i=[];return t.scale&&(i=yR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(mR(t,e))}function kR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function MR(t,e,i,s,n){i&&(fR(i)?e.forEach((e=>{const n=vR(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case IB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case IB.group:case IB.rect:case IB.image:return["width","height","y1"].includes(e);case IB.path:case IB.shape:return["path","customPath"].includes(e);case IB.line:return"defined"===e;case IB.area:return["x1","y1","defined"].includes(e);case IB.rule:return["x1","y1"].includes(e);case IB.symbol:return"size"===e;case IB.polygon:return"points"===e;case IB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(xR(l)){const t=_R(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?gb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(SR(l)){const t=gb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=vR(l,s,e.datum,t)}))})))}function TR(t,e,i,s){if(!t)return null;if(fR(t))return vR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(xR(h)){const t=_R(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?gb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(SR(h)){const t=gb(h.field);n[r]=t(e)}else n[r]=vR(h,s,e,i)})),n}class wR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let CR=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};CR._plotMarks={},CR._marks={},CR._components={},CR._graphicComponents={},CR._transforms={},CR._grammars={},CR._glyphs={},CR._animations={},CR._interactions={},CR._graphics={},CR.registerGlyph=(t,e,i,s,n)=>(CR._glyphs[t]=new wR(e,i,s,n),CR._glyphs[t]),CR.registerAnimationType=(t,e)=>{CR._animations[t]=e},CR.getAnimationType=t=>CR._animations[t],CR.registerInteraction=(t,e)=>{CR._interactions[t]=e},CR.registerGraphic=(t,e)=>{CR._graphics[t]=e},CR.getGraphicType=t=>CR._graphics[t],CR.createGraphic=(t,e)=>{const i=CR._graphics[t];return i?i(e):null};const ER=t=>!!IB[t];function PR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=CR.getGraphicType(e)?CR.createGraphic(e,i):CR.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const BR=t=>{t&&(t[XB]=null,t.release(),t.parent&&t.parent.removeChild(t))},RR=["fillOpacity"],LR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const OR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[IB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[IB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[IB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const IR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?OR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(RR.includes(r)?LR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{RR.includes(t)?LR(n,t,e):n[t]=e[t]}));return n},DR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),FR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],jR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(FR);function zR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?jR:FR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>DR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=HR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function HR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let NR=class{constructor(t){this.data=null,this.states=[],this.diffState=OB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));MR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?IR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[XB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?IR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===OB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(BR(this.graphicItem),this.graphicItem[XB]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=bR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(vR(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===OB.unChange&&(this.diffState=OB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,pR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[pR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||this.useStates(this.states),this.mark.markType===IB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new gl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[LB.update],a=e[LB.enter],o=e[LB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===OB.enter?(a&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.update?((n&&a||i)&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.exit&&o&&(i&&MR(this,t,a,s,l),MR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)_b(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[IB.line,IB.area,IB.largeRects,IB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||kR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[LB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=HR(h),e===IB.line||e===IB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>kR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===IB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=zR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=HR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?zR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=TR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=zR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===IB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===IB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(BR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class VR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const GR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class WR extends VR{constructor(t,e){super(t,e),this.type=WR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},WR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}WR.type="element-select",WR.defaultOptions={state:KB.selected,trigger:"click"};class UR extends VR{constructor(t,e){super(t,e),this.type=UR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function YR(t){if(t)return t.type===Lw.Band?t.bandwidth():t.type===Lw.Point?t.step():void 0}UR.type="element-highlight",UR.defaultOptions={highlightState:KB.highlight,blurState:KB.blur,trigger:"pointerover",triggerOff:"pointerout"};class KR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const XR=()=>{U(WR,KR),CR.registerInteraction(WR.type,WR)},$R=()=>{U(UR,KR),CR.registerInteraction(UR.type,UR)},qR=(t,e)=>yR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,ZR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=qR(n,e),i}),{}):t.map((t=>qR(t,e))):t;let JR=-1;class QR extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++JR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(mR(this.spec[e],this.view)),this.spec[e]=t,this.attach(mR(t,this.view)),this.commit(),this}}const tL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=mR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},eL=(t,e)=>{const i=CR.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(gR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>tL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return tL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},iL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=eL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},sL={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class nL extends QR{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!sL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return sL[e.type](t,i,new ya(new va))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?mR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=mR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=mR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=yR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=iL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const rL="window",aL="view",oL={trap:!1},lL="width",hL="height",cL="viewWidth",dL="viewHeight",uL="padding",pL="viewBox",gL="autoFit";function mL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function fL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,mL(t,e,n,s)}class vL{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}return this.nodes.push(t),mL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,fL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class _L{constructor(t){this.list=[],this.ids={},this.idFunc=t||mb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class yL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new _L((t=>t.uid)),this._heap=new vL(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new _L((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const bL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===IB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class xL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Qd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{zl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new iy(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Qb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ix(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function SL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function AL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function kL(t,e,i,s,n){if(n===rL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{AL(t,SL(t),!1)}))}));const e=SL(t);AL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class ML extends QR{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?vR(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},EL=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class PL extends NR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return MR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[XB]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?IR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===OB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=IR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=OR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===IB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return $B.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)_b(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[XB]=null})),this.glyphGraphicItems=null),super.release()}}const BL=t=>t.markType===IB.glyph?new PL(t):new NR(t);function RL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(ZB,i?t.slice().sort(i):t.slice()),{keys:QB,data:s};const n=bR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class LL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?RL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const OL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const IL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class DL extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class FL extends yc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Nd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}xc.mode|=ko.SET_ATTR_IMMEDIATELY;let jL=0;const zL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof yc||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class HL{constructor(t,e,i){this.id=jL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!CR.getAnimationType(e.type))return null;const r=CR.getAnimationType(e.type)(t,n,i);return OL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?IL(t,0,n[i].from,0,s):void 0,e.to[i]=l?IL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),OL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=zL(o);return u(o)||zL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new FL(r.from,r.to,a,t.easing):void 0:new DL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new $c(a,e))}r>0&&t.wait(r)}}function NL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(VL(i,t[i]))})),e}function VL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:rR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:cR,loop:null!==(s=h.loop)&&void 0!==s?s:hR,controlOptions:z({},uR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:aR,delay:null!==(a=h.delay)&&void 0!==a?a:oR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:lR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:dR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:rR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:cR,loop:null!==(d=t.loop)&&void 0!==d?d:hR,controlOptions:z({},uR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:oR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:lR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:dR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function GL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class WL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class UL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=NL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=NL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==OB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=VL(nR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===OB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new HL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===OB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=vR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=GL(t.startTime,e,n),o=GL(t.totalTime,e,n),l=GL(t.oneByOne,e,n),h=GL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=GL(t.delay,e,n),l=GL(t.delayAfter,e,n),h=null!==(i=GL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:GL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===OB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===OB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===nR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===OB.exit&&0===o[OB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class YL extends QR{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new UL(this,{}),this.differ=new LL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===OB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===WB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:JB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===IB.group)return;const e=RL(null!=t?t:JB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(OB.update,t,e,i)}encodeState(t,e,i,s){if(t===OB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(fR(n))this.detach(AR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(AR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(AR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(AR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(AR(i,this.view))):fR(e)?(this.spec.encode[t]=e,this.attach(AR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(AR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=iL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return $B.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==OB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===YB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!fR(n)&&Object.keys(n).forEach((t=>{xR(n[t])&&(e[t]=_R(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];fR(s)||Object.keys(s).forEach((t=>{SR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB];if((null==s?void 0:s.mark)===this){const i=kL(this.view,t,s,0,aL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new UL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=_R(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==IB.group){if(!this.graphicItem){const t=PR(this,IB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||qB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==IB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=bR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>ZB),a=bR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>ZB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===OB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=OB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):BL(this),n.diffState===OB.exit&&(n.diffState=OB.enter,this.animate.getElementAnimators(n,OB.exit).forEach((t=>t.stop("start")))),n.diffState=OB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=OB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:JB;l||this.differ.setCurrentData(RL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=TR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{this.markType===IB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:PR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==IB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=bR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>ZB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=BL(this);e.diffState=OB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=BL(this);i.diffState=OB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==IB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=PR(this,IB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==OB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:OR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=OB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&BR(this.graphicItem),this.detachAll(),super.release()}}let KL=class extends YL{constructor(t,e){super(t,IB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===IB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return OR.rect}evaluateJoin(t){if(!this.elements.length){const t=BL(this);t.updateData(ZB,JB,(()=>""),this.view),this.elements=[t],this.elementMap.set(ZB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return MR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:PR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function XL(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function $L(t,e){return Math.min(t<0?t+e:t-1,e)}function qL(t,e,i){let s=$L(t,i),n=$L(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=$L(Math.max(0,n-1),i)):n=$L(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const ZL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>XL(t,i))),u=l.map((t=>XL(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=qL(e,i,r),{start:h,end:c}=qL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Jt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},JL={[DB.axis]:0,[DB.legend]:1,[DB.slider]:2,[DB.player]:3,[DB.datazoom]:4},QL=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=JL[t.componentType])&&void 0!==s?s:1/0},tO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=yb(r.maxChildWidth,n.width()),o=yb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=CL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dQL(t)-QL(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==IB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=tO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(cL,o),i.updateSignal(dL,l),i.updateSignal(uL,h)}else tO(t,n,a,e);else"grid"===r.display&&ZL(t,n,a);eO(n,e,i)}}))};class iO extends YL{constructor(t,e,i){super(t,IB.glyph,i),this.glyphType=e,this.glyphMeta=CR.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!CR.getGraphicType(IB.glyph))return;const s=CR.createGraphic(IB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(CR.getGraphicType(n[t])){const e=CR.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const sO=Symbol.for("key");class nO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=RL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=RL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=bR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:sO})),r=RL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:sO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==sO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=vR(i.animation.delay,n,o,l),d=vR(i.animation.duration,n,o,l),u=vR(i.animation.oneByOne,n,o,l),p=vR(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Td(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Sd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>kd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Md({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Tc,null!==(l=i.easing)&&void 0!==l?l:wc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new wd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Tc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Td(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class rO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class aO extends rO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===IB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===IB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===IB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===IB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class lO extends YL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=PR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?IB.richtext:IB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}lO.markType=IB.text;const hO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},cO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},dO=Object.assign({},hO);dO.axis=Object.assign({},dO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.circleAxis=Object.assign({},dO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.grid=Object.assign({},dO.grid,{style:{stroke:"#404349"}}),dO.circleGrid=Object.assign({},dO.circleGrid,{style:{stroke:"#404349"}}),dO.rectLabel=Object.assign({},dO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.lineLabel=Object.assign({},dO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.symbolLabel=Object.assign({},dO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.title=Object.assign({},dO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const uO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:cO,components:dO},pO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:cO,components:hO};let gO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};gO._themes=new Map,gO.registerTheme("default",pO),gO.registerTheme("dark",uO);class mO extends YL{constructor(t,e,i,s){super(t,IB.component,i),this._componentDatum={[ZB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:CR.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,ZB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[ZB]+=1}evaluateJoin(t){return this.spec.key=ZB,t?(t[ZB]=this._componentDatum[ZB],this._componentDatum=t):this._componentDatum={[ZB]:this._componentDatum[ZB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class fO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB],n=kL(0,t,s,0,aL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(yR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):ER(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ML(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new nL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=CR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=CR.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case IB.group:n=new KL(this,s);break;case IB.glyph:n=new iO(this,null==i?void 0:i.glyphType,s);break;case IB.component:n=CR.hasComponent(null==i?void 0:i.componentType)?CR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new mO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case IB.text:n=new lO(this,t,s);break;default:n=CR.hasMark(t)?CR.createMark(t,this,s):new YL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(IB.group,t)}glyph(t,e){return this.mark(IB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(IB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.grid,mode:e})}legend(t){return this.mark(IB.component,t,{componentType:DB.legend})}slider(t){return this.mark(IB.component,t,{componentType:DB.slider})}label(t){return this.mark(IB.component,t,{componentType:DB.label})}datazoom(t){return this.mark(IB.component,t,{componentType:DB.datazoom})}player(t){return this.mark(IB.component,t,{componentType:DB.player})}title(t){return this.mark(IB.component,t,{componentType:DB.title})}scrollbar(t){return this.mark(IB.component,t,{componentType:DB.scrollbar})}customized(t,e){const i=CR.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&wL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(BR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++TL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(gO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(lL,t.width),this.updateSignal(hL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=CR.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:lL,value:null!==(s=t[lL])&&void 0!==s?s:0},{id:hL,value:null!==(n=t[hL])&&void 0!==n?n:0},{id:uL,value:CL(null!==(a=null!==(r=t[uL])&&void 0!==r?r:e[uL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:cL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[lL]-i.left-i.right},dependency:[lL,uL]}},{id:dL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[hL]-i.top-i.bottom},dependency:[hL,uL]}},{id:pL,update:{callback:(t,e)=>{const i=CL(e[uL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[cL],i.top+e[dL])},dependency:[cL,dL,uL]}},{id:gL,value:null!==(o=t[gL])&&void 0!==o?o:e[gL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===IB.glyph?{glyphType:t.glyphType}:t.type===IB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=gO.getTheme(t))&&void 0!==e?e:gO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(lL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(hL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(cL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(uL);if(arguments.length){const i=CL(t);return this.updateSignal(e,i),i}return CL(e.output())}autoFit(t){const e=this.getSignalById(gL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(pL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=WB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===IB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||eO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{bL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),bL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=tR,morph:o=eR,morphAll:l=iR,animation:h={},enableExitAnimation:c=sR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:dR,delay:null!==(i=h.delay)&&void 0!==i?i:oR,duration:null!==(s=h.duration)&&void 0!==s?s:aR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:cR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=WB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=WB.reevaluate,this._dataflow.evaluate()),this._layoutState=WB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!wL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return bL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ii(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(lL,t)),e!==this.height()&&(s=!0,this.updateSignal(hL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):ER(t)?(i.markType=t,i.source=e):i.source=t===rL?rL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=gR(l,this),v=EL(((t,e)=>{const s=c===aL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===rL&&(t=kL(0,t,e,0,rL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===aL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,aL,d))return this.addEventListener(d,v,oL),()=>{this.removeEventListener(d,v)}}else if(c===rL)return O_.addEventListener(d,v),this._eventListeners.push({type:d,source:O_,handler:v}),()=>{O_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===O_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=CR.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new xL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new rO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aO((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new yL,this.animate=new oO(this),this._morph=new nO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[aL,rL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:gO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&O_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==IB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&O_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),CR.unregisterRuntimeTransforms(),at.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const vO=()=>{bM(),uM(),CR.registerGraphic(IB.path,Yg)},_O=()=>{bM(),fM(),CR.registerGraphic(IB.rect,Pg)},yO=()=>{bM(),cM(),CR.registerGraphic(IB.rule,wg)},bO=()=>{bM(),SM(),CR.registerGraphic(IB.symbol,kg)},xO=()=>{bM(),kM(),_M(),CR.registerGraphic(IB.text,yp)},SO=()=>{bM(),nM(),CR.registerGraphic(IB.glyph,Rg)},AO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},MO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Ab(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},TO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ab(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},wO=AO(MO),CO=kO(MO);const EO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ab(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},PO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ab(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},BO=AO(EO),RO=kO(EO);const LO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},IO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?OO:LO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},DO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},jO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class zO extends mO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const HO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class NO extends zO{constructor(t,e,i){super(t,DB.axis,e),this.spec.componentType=DB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=TR(n,e,i,s);const h=vR(this.spec.inside,s,e,i),c=vR(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(HO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=vR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case jB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case jB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?jB.circleAxis:jB.lineAxis,this._axisComponentType}}NO.componentType=DB.axis;let VO=class extends mO{constructor(t,e){super(t,DB.label,e),this.spec.componentType=DB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=vR(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=vR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case IB.line:case IB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case IB.rect:case IB.rect3d:case IB.interval:g=p.rectLabel;break;case IB.symbol:case IB.circle:case IB.cell:g=p.symbolLabel;break;case IB.arc:case IB.arc3d:g=p.arcLabel;break;case IB.polygon:case IB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=TR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=TR(i,t,e,d);m.push(z({},f,s))}));else{const t=TR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};VO.componentType=DB.label;const GO=()=>{CR.registerGraphicComponent(DB.label,(t=>new JT(t))),CR.registerComponent(DB.label,VO)};class WO extends zO{constructor(t,e,i){super(t,DB.grid,e),this.spec.componentType=DB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=TR(s,t,e,i);const d=vR(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case zB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case zB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=vR(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(HO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===zB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=vR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case zB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case zB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=zB.circleAxisGrid:this._gridComponentType=zB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case jB.circleAxis:this._gridComponentType=zB.circleAxisGrid;break;case jB.lineAxis:default:this._gridComponentType=zB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?zB.lineAxisGrid:zB.circleAxisGrid:zB.lineAxisGrid}else this._gridComponentType=zB.lineAxisGrid;return this._gridComponentType}}WO.componentType=DB.grid;const UO=(t,e,i)=>e.filter((e=>t.callback(e,i))),YO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function KO(t){return t.reduce(((t,e)=>t+e),0)}const XO={min:$,max:X,average:function(t){return 0===t.length?0:KO(t)/t.length},sum:KO};function $O(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function qO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function ZO(t,e,i,s){return qO(t,e,i,"min",s)}function JO(t,e,i,s){return qO(t,e,i,"max",s)}function QO(t,e,i,s){return qO(t,e,i,"average",s)}function tI(t,e,i,s){return qO(t,e,i,"sum",s)}const eI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$O;if("min"===n?l=ZO:"max"===n?l=JO:"average"===n?l=QO:"sum"===n&&(l=tI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const iI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(pR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(pR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(pR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},sI=()=>{CR.registerTransform("filter",{transform:UO,markPhase:"beforeJoin"},!0)},nI=()=>{CR.registerTransform("map",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{CR.registerTransform("sampling",{transform:eI,markPhase:"afterEncode"},!0)},aI=()=>{CR.registerTransform("markoverlap",{transform:iI,markPhase:"afterEncode"},!0)},oI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},hI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},cI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},dI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const pI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},xI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},SI=(t,e,i)=>({from:{points:xI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e)}}),kI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),MI=(t,e,i)=>({from:{points:kI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),TI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:kI(t,e,i)}}),wI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),CI=(t,e,i)=>({from:{points:wI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),EI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:wI(t,e,i)}}),PI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},LI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},OI={symbol:["_mo_hide_","visible"]},II=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=OI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{_b(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},DI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},jI=()=>{CR.registerAnimationType("clipIn",oI)},zI=()=>{CR.registerAnimationType("clipOut",lI)},HI=()=>{CR.registerAnimationType("fadeIn",hI)},NI=()=>{CR.registerAnimationType("fadeOut",cI)},VI=()=>{CR.registerAnimationType("growCenterIn",dI)},GI=()=>{CR.registerAnimationType("growCenterOut",uI)},WI=()=>{CR.registerAnimationType("growHeightIn",mI)},UI=()=>{CR.registerAnimationType("growHeightOut",fI)},YI=()=>{CR.registerAnimationType("growWidthIn",pI)},KI=()=>{CR.registerAnimationType("growWidthOut",gI)},XI=()=>{CR.registerAnimationType("growPointsIn",SI)},$I=()=>{CR.registerAnimationType("growPointsOut",AI)},qI=()=>{CR.registerAnimationType("growPointsXIn",MI)},ZI=()=>{CR.registerAnimationType("growPointsXOut",TI)},JI=()=>{CR.registerAnimationType("growPointsYIn",CI)},QI=()=>{CR.registerAnimationType("growPointsYOut",EI)},tD=()=>{CR.registerAnimationType("growAngleIn",vI)},eD=()=>{CR.registerAnimationType("growAngleOut",_I)},iD=()=>{CR.registerAnimationType("growRadiusIn",yI)},sD=()=>{CR.registerAnimationType("growRadiusOut",bI)},nD=()=>{CR.registerAnimationType("moveIn",PI)},rD=()=>{CR.registerAnimationType("moveOut",BI)},aD=()=>{CR.registerAnimationType("scaleIn",RI)},oD=()=>{CR.registerAnimationType("scaleOut",LI)},lD=()=>{CR.registerAnimationType("rotateIn",DI)},hD=()=>{CR.registerAnimationType("rotateOut",FI)},cD=()=>{CR.registerAnimationType("update",II)};class dD extends YL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=fR(e)?null:Object.keys(e).reduce(((t,s)=>(xR(e[s])&&(t[s]=_R(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=TR(e,t,i,n);if(u(r.size)){const t=s.x?YR(s.x):void 0,e=s.y?YR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(OR.symbol)}release(){super.release(),this._encoders=null}}dD.markType=IB.cell;const uD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var pD,gD,mD;t.ChartEvent=void 0,(pD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",pD.rendered="rendered",pD.renderFinished="renderFinished",pD.animationFinished="animationFinished",pD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",pD.afterInitData="afterInitData",pD.afterInitEvent="afterInitEvent",pD.afterInitMark="afterInitMark",pD.rawDataUpdate="rawDataUpdate",pD.viewDataFilterOver="viewDataFilterOver",pD.viewDataUpdate="viewDataUpdate",pD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",pD.markDeltaYUpdate="markDeltaYUpdate",pD.viewDataLabelUpdate="viewDataLabelUpdate",pD.scaleDomainUpdate="scaleDomainUpdate",pD.scaleUpdate="scaleUpdate",pD.dataZoomChange="dataZoomChange",pD.drill="drill",pD.layoutStart="layoutStart",pD.layoutEnd="layoutEnd",pD.layoutRectUpdate="layoutRectUpdate",pD.playerPlay="playerPlay",pD.playerPause="playerPause",pD.playerEnd="playerEnd",pD.playerChange="playerChange",pD.playerForward="playerForward",pD.playerBackward="playerBackward",pD.scrollBarChange="scrollBarChange",pD.brushStart="brushStart",pD.brushChange="brushChange",pD.brushEnd="brushEnd",pD.brushClear="brushClear",pD.legendSelectedDataChange="legendSelectedDataChange",pD.legendFilter="legendFilter",pD.legendItemClick="legendItemClick",pD.legendItemHover="legendItemHover",pD.legendItemUnHover="legendItemUnHover",pD.tooltipShow="tooltipShow",pD.tooltipHide="tooltipHide",pD.tooltipRelease="tooltipRelease",pD.afterResize="afterResize",pD.afterRender="afterRender",pD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(gD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",gD.window="window",gD.canvas="canvas",t.Event_Bubble_Level=void 0,(mD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",mD.chart="chart",mD.model="model",mD.mark="mark";const fD=`${uB}_waterfall_default_seriesField`,vD=`${uB}_CORRELATION_X`,_D=`${uB}_CORRELATION_Y`,yD=`${uB}_CORRELATION_SIZE`,bD=`${uB}_MEASURE_CANVAS_ID`,xD=`${uB}_DEFAULT_DATA_INDEX`,SD=`${uB}_DEFAULT_DATA_KEY`,AD=`${uB}_DEFAULT_DATA_SERIES_FIELD`,kD=`${uB}_DEFAULT_SERIES_STYLE_NAME`;var MD;t.AttributeLevel=void 0,(MD=t.AttributeLevel||(t.AttributeLevel={}))[MD.Default=0]="Default",MD[MD.Theme=1]="Theme",MD[MD.Chart=2]="Chart",MD[MD.Base_Series=3]="Base_Series",MD[MD.Series=4]="Series",MD[MD.Mark=5]="Mark",MD[MD.User_Chart=6]="User_Chart",MD[MD.User_Series=7]="User_Series",MD[MD.User_Mark=8]="User_Mark",MD[MD.User_SeriesStyle=9]="User_SeriesStyle",MD[MD.Built_In=99]="Built_In";const TD=`${uB}_STACK_KEY`,wD=`${uB}_STACK_START`,CD=`${uB}_STACK_END`,ED=`${uB}_STACK_START_PERCENT`,PD=`${uB}_STACK_END_PERCENT`,BD=`${uB}_STACK_START_OffsetSilhouette`,RD=`${uB}_STACK_END_OffsetSilhouette`,LD=`${uB}_STACK_TOTAL`,OD=`${uB}_STACK_TOTAL_PERCENT`,ID=`${uB}_STACK_TOTAL_TOP`,DD=`${uB}_SEGMENT_START`,FD=`${uB}_SEGMENT_END`;var jD,zD;t.LayoutZIndex=void 0,(jD=t.LayoutZIndex||(t.LayoutZIndex={}))[jD.Axis_Grid=50]="Axis_Grid",jD[jD.CrossHair_Grid=100]="CrossHair_Grid",jD[jD.Region=450]="Region",jD[jD.Mark=300]="Mark",jD[jD.Node=400]="Node",jD[jD.Axis=100]="Axis",jD[jD.MarkLine=500]="MarkLine",jD[jD.MarkArea=100]="MarkArea",jD[jD.MarkPoint=500]="MarkPoint",jD[jD.DataZoom=500]="DataZoom",jD[jD.ScrollBar=500]="ScrollBar",jD[jD.Player=500]="Player",jD[jD.Legend=500]="Legend",jD[jD.CrossHair=500]="CrossHair",jD[jD.Indicator=500]="Indicator",jD[jD.Title=500]="Title",jD[jD.Label=500]="Label",jD[jD.Brush=500]="Brush",jD[jD.CustomMark=500]="CustomMark",jD[jD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(zD=t.LayoutLevel||(t.LayoutLevel={}))[zD.Indicator=10]="Indicator",zD[zD.Region=20]="Region",zD[zD.Axis=30]="Axis",zD[zD.DataZoom=40]="DataZoom",zD[zD.Player=40]="Player",zD[zD.ScrollBar=40]="ScrollBar",zD[zD.Legend=50]="Legend",zD[zD.Title=70]="Title",zD[zD.CustomMark=70]="CustomMark";const HD=["linear","radial","conical"],ND={x0:0,y0:0,x1:1,y1:1},VD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},GD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},WD={linear:ND,radial:VD,conical:GD},UD={label:{name:"label",type:"text"}},YD=`${uB}_rect_x`,KD=`${uB}_rect_x1`,XD=`${uB}_rect_y`,$D=`${uB}_rect_y1`,qD={data:!0},ZD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},JD=Object.assign(Object.assign({},UD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),QD=Object.assign(Object.assign({},UD),{bar3d:{name:"bar3d",type:"rect3d"}}),tF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},eF=Object.assign(Object.assign({},UD),tF),iF=Object.assign(Object.assign({},UD),{point:{name:"point",type:"symbol"}}),sF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),nF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign({},UD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),aF=Object.assign(Object.assign({},UD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},UD),{rose:{name:"rose",type:"arc"}}),lF=Object.assign(Object.assign({},UD),{area:{name:"area",type:"path"}}),hF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"}}),cF=Object.assign(Object.assign({},hF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),dF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),uF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),pF=Object.assign(Object.assign({},UD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),gF=Object.assign(Object.assign({},UD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),mF=Object.assign(Object.assign({},UD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},UD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),vF=Object.assign(Object.assign({},JD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),_F=Object.assign(Object.assign({},UD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),yF=Object.assign(Object.assign({},UD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),bF=Object.assign(Object.assign({},UD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),xF=Object.assign(Object.assign({},hF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SF=Object.assign(Object.assign({},UD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AF=Object.assign(Object.assign({},UD),{sunburst:{name:"sunburst",type:"arc"}}),kF=Object.assign(Object.assign({},JD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},UD),{circlePacking:{name:"circlePacking",type:"arc"}}),wF=Object.assign(Object.assign({},UD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),CF=Object.assign(Object.assign({},UD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),EF=Object.assign({},sF),PF=Object.assign(Object.assign({},UD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),BF=Object.assign(Object.assign({},UD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var RF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(RF||(RF={}));const LF={[cB.bar]:JD,[cB.bar3d]:QD,[cB.line]:eF,[cB.scatter]:iF,[cB.area]:sF,[cB.radar]:nF,[cB.pie]:rF,[cB.pie3d]:aF,[cB.rose]:oF,[cB.geo]:UD,[cB.map]:lF,[cB.circularProgress]:cF,[cB.link]:dF,[cB.dot]:uF,[cB.wordCloud]:pF,[cB.wordCloud3d]:pF,[cB.funnel]:gF,[cB.funnel3d]:mF,[cB.linearProgress]:fF,[cB.waterfall]:vF,[cB.boxPlot]:_F,[cB.treemap]:yF,[cB.sankey]:bF,[cB.gauge]:xF,[cB.gaugePointer]:SF,[cB.sunburst]:AF,[cB.rangeColumn]:kF,[cB.rangeColumn3d]:MF,[cB.circlePacking]:TF,[cB.heatmap]:wF,[cB.correlation]:CF,[cB.rangeArea]:EF,[cB.liquid]:PF,[cB.venn]:BF};function OF(t){var e,i;const{type:s}=t;return s===cB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const IF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},DF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function FF(t,e){var i;if(!t)return[];const s=WF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?VF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>NF(i)?zF(t,i,e):i)).filter(p)}))):i.map((i=>NF(i)?zF(t,i,e):i)).filter(p):[]}return[]}function jF(t,e){var i,s;return VF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function zF(t,e,i){var s;const n=WF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=DF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new _e(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ce(t,i,s),a=he(n,r,e.l),l=new _e(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const HF=(t,e,i)=>{if(e&&NF(t)){const s=zF(e,t,i);if(s)return s}return t};function NF(t){return t&&"palette"===t.type&&!!t.key}function VF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function GF(t){return y(t)?{dataScheme:t}:t}function WF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=OF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class UF extends aC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!VF(this._range))return void super.range(this._range);const t=jF(this._range,this._domain);super.range(t)}}const YF={linear:EC,band:lC,point:class extends lC{constructor(t){super(!1),this.type=Lw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:aC,threshold:OC,colorOrdinal:UF};function KF(t){const e=YF[t];return e?new e:null}function XF(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function $F(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZF(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function JF(t,e,i,s=0){var n,r;return S(t)?t:ZF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QF(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JF(t[s],e.size,i)}))})),o}function tj(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||ZF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ej(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ij=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},sj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],nj={default:{dataScheme:sj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},rj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",aj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:rj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:rj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:BB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},oj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},lj=Object.assign(Object.assign({},oj),{label:{space:0}}),hj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},cj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",dj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},uj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},pj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},gj={horizontal:Object.assign(Object.assign({},uj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj}),vertical:Object.assign(Object.assign({},uj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj})},mj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},fj={horizontal:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj}),vertical:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj})},vj={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},_j={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function bj(t,e){return t&&e.key in t?t[e.key]:e.default}function xj(t){return t&&"token"===t.type&&!!t.key}const Sj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},Aj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:nj,token:Sj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:aj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:gj,sizeLegend:fj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:oj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:lj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:_j,markArea:vj,markPoint:yj,polarMarkLine:_j,polarMarkArea:vj,polarMarkPoint:yj,geoMarkPoint:yj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:dj,crosshair:hj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},kj={name:"dark",colorScheme:{default:{dataScheme:sj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Mj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Mj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Mj(t[i],e[i])))),Tj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),Tj(t[s],e.slice(1),i))};function wj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof ya||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=wj(n,e)}return s}function Cj(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Ej(t,e,r,i):Pj(t,r,s[r])}}}}function Ej(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Bj({},t[n][e.index],i):i):t[n]=s?Bj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Bj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Bj({},t[n],i):i)}))}function Lj(t,...e){return Bj(Oj(t),...e.map(Oj))}function Oj(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=GF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(LF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Ij(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Ij(t,e,i,s){if(!LF[e])return t;const n={};return Object.values(LF[e]).forEach((({type:e,name:r})=>{n[r]=Bj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Dj=["animationThreshold","colorScheme","name","padding"];function Fj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Dj.includes(r)?n[r]=a:f(a)?NF(a)?n[r]=HF(a,e,s):xj(a)?n[r]=bj(i,a):n[r]=Fj(a,e,i,s):n[r]=a})),n}const jj={[Aj.name]:Aj},zj=Aj.name,Hj=new Map(Object.keys(jj).map((t=>[t,jj[t]]))),Nj=new Map(Object.keys(jj).map((t=>[t,Fj(jj[t])]))),Vj=new Map(Object.keys(jj).map((t=>[t,t===zj]))),Gj=(t,e)=>{if(!t)return;const i=Kj(e);Hj.set(t,i),Nj.set(t,Fj(i)),Vj.set(t,!0)},Wj=(t=zj,e=!1)=>(Vj.has(t)&&!Vj.get(t)&&Gj(t,Hj.get(t)),e?Nj.get(t):Hj.get(t)),Uj=t=>Hj.delete(t)&&Nj.delete(t)&&Vj.delete(t),Yj=t=>!!_(t)&&Hj.has(t),Kj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:zj;return Lj({},Wj(i),t)};class Xj{static registerInstance(t){Xj.instances.set(t.id,t)}static unregisterInstance(t){Xj.instances.delete(t.id)}static getInstance(t){return Xj.instances.get(t)}static instanceExist(t){return Xj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Xj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Xj.instances=new Map;class $j{static registerTheme(t,e){Gj(t,e)}static getTheme(t,e=!1){return Wj(t,e)}static removeTheme(t){return Uj(t)}static themeExist(t){return Yj(t)}static getDefaultTheme(){return $j.themes.get(zj)}static setCurrentTheme(t){$j.themeExist(t)&&($j._currentThemeName=t,Xj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return $j.getTheme($j._currentThemeName,t)}static getCurrentThemeName(){return $j._currentThemeName}}function qj(t,e){return _(t)?$j.themeExist(t)?$j.getTheme(t,e):{}:g(t)?t:{}}function Zj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Zj(t[s],e)}return i}return y(t)?t.map((t=>Zj(t,e))):t}function Jj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}$j.themes=Hj,$j._currentThemeName=zj;function Qj(t,e){for(let i=0;it.key===e))}function ez(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function iz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},oz(t,a,n[o],l,e,r))})),s?sz(n):n}function sz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):sz(t[e].nodes);return t}function nz(t,e){if("values"in t&&t.values.length){const i=eB(t.values,e),s=tB(t.values,PD);t.values.forEach((t=>{t[LD]=i,t[OD]=s,delete t[ID]}));const n=t.values.reduce(((t,e)=>e[CD]>t[CD]?e:t));n[ID]=!0}else for(const i in t.nodes)nz(t.nodes[i],e)}function rz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][CD]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[wD]=s,s+=r[CD],r[CD]=s):(r[wD]=n,n+=r[CD],r[CD]=n),r[TD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[ED]=0===h?0:Math.min(1,l[wD]/h)*r,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r}}for(const s in t.nodes)az(t.nodes[s],e,i)}function oz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[CD]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),oz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const lz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=cz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function dz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>gz(t.style(e,i,s,n)):B(t.style)||(e.style=gz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>gz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=gz(t.state[e]))})),e.state=i}return e}function uz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e,s,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}function pz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),gz(i)}function gz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class mz{static registerChart(t,e){mz._charts[t]=e}static registerSeries(t,e){mz._series[t]=e}static registerComponent(t,e,i){mz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){mz._marks[t]=e}static registerRegion(t,e){mz._regions[t]=e}static registerTransform(t,e){mz.transforms[t]=e}static registerLayout(t,e){mz._layout[t]=e}static registerAnimation(t,e){mz._animations[t]=e}static registerImplement(t,e){mz._implements[t]=e}static registerChartPlugin(t,e){mz._chartPlugin[t]=e}static registerComponentPlugin(t,e){mz._componentPlugin[t]=e}static createChart(t,e,i){if(!mz._charts[t])return null;return new(0,mz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!mz._charts[t])return null;const i=mz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!mz._regions[t])return null;return new(0,mz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!mz._regions[t])return null;return new(0,mz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!mz._series[t])return null;return new(0,mz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!mz._series[t])return null;return new(0,mz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!mz._marks[t])return null;const s=new(0,mz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(mz._components)}static getComponentInKey(t){return mz._components[t].cmp}static getLayout(){return Object.values(mz._layout)}static getLayoutInKey(t){return mz._layout[t]}static getSeries(){return Object.values(mz._series)}static getSeriesInType(t){return mz._series[t]}static getRegionInType(t){return mz._regions[t]}static getAnimationInKey(t){return mz._animations[t]}static getImplementInKey(t){return mz._implements[t]}static getSeriesMarkMap(t){return mz._series[t]?mz._series[t].mark:{}}static getChartPlugins(){return Object.values(mz._chartPlugin)}static getComponentPlugins(){return Object.values(mz._componentPlugin)}static getComponentPluginInType(t){return mz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}mz._charts={},mz._series={},mz._components={},mz._marks={},mz._regions={},mz._animations={},mz._implements={},mz._chartPlugin={},mz._componentPlugin={},mz.transforms={fields:Or,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},mz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},mz._layout={};const fz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},vz=(t,e,i,s)=>{var n;const r=Nw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:_z(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,yz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},bz=(t,e)=>{if(!t)return null;if(!lB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=yz(t,(t=>"angle"===t.getOrient()),e),r=yz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Nw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=nB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=rB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=vz(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Nw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=nB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=rB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=vz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function xz(t){return"bottom"===t||"top"===t}function Sz(t){return"left"===t||"right"===t}function Az(t){return"z"===t}function kz(t,e){return qF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Mz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Tz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?xz(t)?"linear":"band":xz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const wz=t=>t.fieldX[0],Cz=t=>t.fieldY[0],Ez=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Pz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Bz=(t,e)=>t?e?wz:Ez:e?Cz:Pz,Rz=(t,e,i)=>{var s,n;if(!t)return null;if(!lB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=yz(t,(t=>xz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=yz(t,(t=>Sz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Nw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Lz(s,i,t,Bz(e,Nw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Lz(s,i,t,Bz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Lz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Oz(t,a,s)},Oz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=vz(e,t,"cartesian",null!=i?i:xz(t.getOrient())?wz:Cz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Iz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Rz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=bz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Nw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return xz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Oz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Dz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Dz||(Dz={}));const Fz={[Dz.dimensionHover]:class extends Iz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!fz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Dz.dimensionClick]:class extends Iz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let jz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(Fz[t]){const e=new Fz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(Fz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class zz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Hz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Nz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new zz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Hz[a]&&(a=Hz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=St(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=xt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return uD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteraction(e)}}function Vz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Gz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Wz=new Map;let Uz;function Yz(){Uz||(Uz=new va,Gz(Uz,"geojson",da),Gz(Uz,"topojson",pa),Vz(Uz,"simplify",Rr))}function Kz(t,e,i={type:"geojson",centroid:!0}){Wz.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),Yz();const s=new ya(Uz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Wz.set(t,s)}function Xz(t){Wz.has(t)?Wz.delete(t):Jy(`map type of '${t}' does not exists.`)}function $z(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const qz=(t,e)=>0===t.length?[]:1===t.length?$z(t[0],null==e?void 0:e.deep):t.map((t=>$z(t,null==e?void 0:e.deep)));function Zz(t,e,i){Vz(e=e instanceof va?e:t.dataSet,"copyDataView",qz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:tH.copyDataView}),s}function Jz(t,e,i=[],s={}){var n,r,a;if(t instanceof ya)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new ya(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Qy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Qy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Jy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function Qz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var tH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(tH||(tH={}));const eH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new fO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:aH(this._option.mode),autoFit:!1,eventConfig:{gesture:nb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(O_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=O_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function lH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function hH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Bj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function cH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ii(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function dH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme")}),t}function uH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(nH||(nH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(rH||(rH={}));class pH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},pH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}pH.defaultMarkInfo={};class gH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new pH,this._markReverse=new pH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(nH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(nH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[nH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[nH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Dz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const mH={};Object.values(nH).forEach((t=>{mH[t]=!0}));const fH={[nH.STATE_HOVER]:nH.STATE_HOVER_REVERSE,[nH.STATE_SELECTED]:nH.STATE_SELECTED_REVERSE,[nH.STATE_DIMENSION_HOVER]:nH.STATE_DIMENSION_HOVER_REVERSE};function vH(t){return fH[t]}class _H{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=vH(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=vH(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=vH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=vH(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class yH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class bH extends yH{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xH extends bH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=sH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class SH extends yH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class AH extends SH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class kH extends AH{constructor(){super(...arguments),this.id=ob(),this.stateKeyToSignalName=t=>`${uB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===iH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===iH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?iH.none:iH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?iH.exit:"update"===e.diffState?iH.update:iH.appear}}}}class MH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Bj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TH extends yH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=MH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new pH,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new jz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${uB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=mz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class wH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=QF(tj(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=JF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=JF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=JF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class CH extends TH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new wH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EH extends MH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class PH extends CH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=EH,this.modelType="region",this.specKey="region",this.type=PH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new _H,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new gH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in rH)B(t.stateStyle[rH[e]])||this.interaction.registerMark(rH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function BH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function RH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function LH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function OH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),LH(c,!0,u,o),s&&RH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function IH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),LH(c,!1,u,a),s&&RH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function FH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"left"),n.length&&OH(n,e,i,!0,"left"),r.length&&IH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"top"),n.length&&DH(n,e,i,!0,"top"),r.length&&FH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"right"),n.length&&OH(n,e,i,!0,"right"),r.length&&IH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"bottom"),n.length&&DH(n,e,i,!0,"bottom"),r.length&&FH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:s,height:n}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}jH.type="base";const zH=["line","area","trail"];function HH(t){return zH.includes(t)}class NH extends AH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(HH)?s:!t.mark||HH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!mH[t])).map((t=>[t,10])),s=!t.mark||HH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(zw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class VH extends bH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class GH extends VH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${uB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class WH extends bH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=sH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new NH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new jz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new GH(t)}stateKeyToSignalName(t){return`${uB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=nH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=nH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===iH.appear&&this.runAnimationByState(iH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(iH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class UH extends WH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,te)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Bj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=KF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):HD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Hw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},WD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=_e.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)HD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class YH extends UH{constructor(){super(...arguments),this.type=YH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}YH.type="group";const KH=()=>{bM(),aM(),CR.registerGraphic(IB.group,Cu),mz.registerMark(YH.type,YH)},XH={type:"fadeIn"};function $H(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return XH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const qH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},ZH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},JH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},QH=()=>{mz.registerAnimation("scaleInOut",(()=>ZH))},tN=()=>{mz.registerAnimation("fadeInOut",(()=>JH))},eN=(t,e)=>({appear:$H(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Wc,duration:qH.update.duration,easing:qH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),iN=()=>{mz.registerAnimation("line",eN)},sN=()=>{fO.useRegisters([XI,$I,qI,ZI,JI,QI,jI,zI])},nN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Sj.fontFamily,fontSize:Sj.fontSize}))(e,i,s).measure(t)};class rN{static instance(){return rN.instance_||(rN.instance_=new rN),rN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class aN{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class oN extends aN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class lN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>mz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>mz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>mz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return mz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>mz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){mz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}static getFunction(t){return t?rN.instance().getFunction(t):null}static getFunctionList(){return rN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=mz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=mz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Wz.get(e);var e}static hideTooltip(t=[]){Xj.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=xt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=sb(p);v?Rx(th):"node"===p&&PA(th),v&&d&&(this._container=_(d)?O_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=$j.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new oH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Nz(this,this._compiler),this._event=new jz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Xj.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Bj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Zj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;lN.getFunctionList()&&lN.getFunctionList().length&&(t=Jj(t,lN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=mz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return cH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:pB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:gB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof va?t:new va,Gz(this._dataSet,"dataview",ga),Gz(this._dataSet,"array",s),Vz(this._dataSet,"stackSplit",eH),Vz(this._dataSet,"copyDataView",qz);for(const t in mz.transforms)Vz(this._dataSet,t,mz.transforms[t]);for(const t in mz.dataParser)Gz(this._dataSet,t,mz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)),null===(n=this._compiler)||void 0===n||n.releaseGrammar(!1===(null===(r=this._option)||void 0===r?void 0:r.animation)||!1===(null===(a=this._spec)||void 0===a?void 0:a.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily)),t.reCompile&&(null===(l=this._compiler)||void 0===l||l.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(h=this._compiler)||void 0===h||h.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?iH.appear:iH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Xj.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof ya?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Jz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)||(a.changeTheme=!0);const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=dH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Bj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=qj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Lj({},qj(this._currentThemeName,!0),qj(s,!0),qj(n,!0));this._currentTheme=t}else{const t=Lj({},qj(this._currentThemeName),qj(s),qj(n));this._currentTheme=Fj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return qj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield lH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ej(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ej(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rN.instance().getFunction(t)}registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}getFunctionList(){return rN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=mz.getChartPlugins();t.length>0&&(this._chartPlugin=new oN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}lN.InstanceManager=Xj,lN.ThemeManager=$j,lN.globalConfig={uniqueTooltip:!0},lN.Utils=nN,lN.vglobal=O_;mz.registerRegion("region",PH),mz.registerLayout("base",jH),KH(),fO.useRegisters([sI,nI]),fO.useRegisters([aD,oD,HI,NI,nD,rD,lD,hD,cD]),$R(),XR(),Gj(kj.name,kj),at.getInstance(rt.Error);const hN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(cB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=mz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=mz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},cN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=hN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Mj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Bj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Bj(m,f),hasChanged:!0};const i=Bj({},t,f);Tj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class dN{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const uN=t=>{mz.registerChartPlugin(t.type,t)};class pN extends dN{constructor(){super(pN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[pN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[pN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=wj(this._option.globalInstance.getSpec(),["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=wj(this._baseChartSpec,["data",pN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=cN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=wj(i,["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}pN.pluginType="chart",pN.specKey="media",pN.type="MediaQueryPlugin";const gN=/\{([^}]+)\}/,mN=/\{([^}]+)\}/g,fN=/:/;class vN extends dN{constructor(){super(vN.type),this.type="formatterPlugin",this._timeModeFormat={utc:di.getInstance().timeUTCFormat,local:di.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=yi.getInstance().format,this._numericSpecifier=yi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[vN.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),mz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=gN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(mN,((t,i)=>{if(!fN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(fi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}vN.pluginType="chart",vN.specKey="formatter",vN.type="formatterPlugin";const _N=()=>{uN(vN)};function yN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function bN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function xN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function SN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function AN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function kN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const MN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return IC(v)};class TN extends dN{constructor(){super(TN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!zw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&yN(c)&&yN(d)))return;const u=bN(t,c),p=bN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!SN(u,p))return}else if(0===y&&0===b){if(!SN(p,u))return}else if(_||A)if(_&&!A){if(!xN(u,p))return}else if(A&&!_){if(!xN(p,u))return}else{if(m===b)return;if(m>b){if(!AN(u,p))return}else if(!AN(p,u))return}else{if(0===m&&0===y){if(!kN(u,p))return}else if(0===b&&0===g&&!kN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Vz(e.getOption().dataSet,"tickAlign",MN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}TN.pluginType="component",TN.type="AxisSyncPlugin";const wN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,CN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ym||(ym=vm.CreateGraphic("richtext",{})),ym.setAttributes(a),ym.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},EN="vchart-tooltip-container",PN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function BN(t,e){return R(e,`component.${t}`)}function RN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=mz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const LN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ON(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function IN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function DN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function FN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const jN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):["linear","log","symlog"].includes(e)?BN("axisLinear",i):{})&&void 0!==s?s:{},r=xz(t)?BN("axisX",i):Sz(t)?BN("axisY",i):BN("axisZ",i);return Bj({},BN("axis",i),n,r)},zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):"linear"===e?BN("axisLinear",i):{})&&void 0!==s?s:{},r=BN("angle"===t?"axisAngle":"axisRadius",i);return Bj({},BN("axis",i),n,r)},HN=t=>"band"===t||"ordinal"===t||"point"===t;function NN(t,e){return{id:t,label:t,value:e,rawValue:t}}function VN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function GN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const WN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Nw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(zw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=ON(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Nw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(zw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=ON(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&UN(t,"top",r.label),e.visible&&UN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&UN(t,"left",a.label),e.visible&&UN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},UN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=RN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},YN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},KN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=$N(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},XN=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=$N(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},$N=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},qN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},ZN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},JN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},QN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},tV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=WN(3,e,i,s,n,r,a);return o?KN(r,o,d,h):l?XN(a,l,u,c):void 0},eV={fontFamily:Sj.fontFamily,spacing:10,wordBreak:"break-word"};function iV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},nV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=lV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rV(i,s)(t)&&rV(n,r)(t)&&(u(a)||rV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(u.id),d}return"none"}const lV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=nV(c,t);let _=nV(d,t);const y=aV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rV(c,v));if(!y&&(_=nV(d,i),!aV(_)))return;const n=e.type===cB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Nw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(rV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nV(d,o),!aV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(rV(c,n));if(!y&&(_=nV(d,r),!aV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=nV(d,i),!aV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},hV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const cV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class dV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class uV extends dV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:gV(e.title,{seriesId:this.series.id},!0),content:mV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=hV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const pV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},gV=(t,e,i)=>p(t)?d(t)?(...s)=>pV(t(...s),e,i):pV(t,e,i):void 0,mV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>pV(t,e,i))):pV(t,e,i))):void 0;return s},fV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=cV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=cV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},vV=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=_V(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&hV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},_V=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),yV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},bV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=RN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},SV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class AV{}AV.dom=`${uB}_TOOLTIP_HANDLER_DOM`,AV.canvas=`${uB}_TOOLTIP_HANDLER_CANVAS`;const kV=20,MV={key:"其他",value:"..."},TV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=di.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},wV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=SV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==xV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:TV(xV(c,t,i,v),p,g),valueStyle:xV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=kV}=t,x=t.othersLine?Object.assign(Object.assign({},MV),t.othersLine):MV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=CV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=CV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},CV=(t,e,i)=>{const s=TV(xV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=TV(xV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==xV(e.visible,t,i)&&(p(s)||p(n)),a=xV(e.isKeyAdaptive,t,i),o=xV(e.spaceRow,t,i),l=xV(e.shapeType,t,i),h=xV(e.shapeColor,t,i),c=xV(e.shapeFill,t,i),d=xV(e.shapeStroke,t,i),u=xV(e.shapeLineWidth,t,i),g=xV(e.shapeHollow,t,i),m=xV(e.keyStyle,t,i),f=xV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class EV extends dN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=SV(x.position,b,e),M=null!==(n=SV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:pB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:gB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(sb(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=wN(t,e),j=wN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(JN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(QN(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=qN(t,c),N=qN(i,c),V=qN(e,c),G=qN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=qN(t,c):Y(t),S(e)||d(e)?N=qN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(JN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(QN(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,sb(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===JN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===JN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===QN(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===QN(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(JN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(QN(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,St(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},PN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:PN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:PN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ei(d.padding),x=tj(d.padding),S=iV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=iV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=iV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:sV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Bj({},A,iV(b,void 0,{})),{width:s,height:n,text:r}=CN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Bj({},k,iV(x,void 0,{})),{width:e,height:s,text:n}=CN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Bj({},S,iV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=CN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(sb(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=wN(t,s),u=wN(l,c)}return s*=d,n*=d,sb(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(De(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Xe([c,a,o],r.x,r.y)||Xe([c,l,h],r.x,r.y)||Xe([c,a,h],r.x,r.y)||Xe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}EV.specKey="tooltip";const PV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",BV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let RV;const LV=(t=document.body)=>{if(u(RV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),RV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return RV};function OV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Bj({},e,t),s={};return s.width=PV(i),s}(C),R=IV(E),L=IV(P),{bottom:O,left:I,right:D,top:F}=tj(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:PV(T+2*M),minHeight:PV(g+2*M),paddingBottom:PV(O),paddingLeft:PV(I),paddingRight:PV(D),paddingTop:PV(F),borderColor:k,borderWidth:PV(M),borderRadius:PV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?PV(null==r?void 0:r.spaceRow):"0px"},IV(Bj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return DV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=DV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==ib?void 0:ib.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(DV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}DV.type="tooltipModel";const FV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},jV={boxSizing:"border-box"},zV={display:"inline-block",verticalAlign:"top"},HV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},GV={lineHeight:"normal",boxSizing:"border-box"};class WV extends DV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=BV(u),y=t=>new Ag({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class UV extends DV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const YV={overflowWrap:"normal",wordWrap:"normal"};class KV extends DV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Bj({},zV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Bj({},o?NV:HV,Object.assign(Object.assign(Object.assign({height:PV(l)},YV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Bj({},VV,Object.assign(Object.assign(Object.assign({height:PV(s)},YV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Bj({},GV,Object.assign(Object.assign({height:PV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class XV extends DV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new KV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Bj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+BV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+LV(this._option.getContainer())}px`,maxHeight:PV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class $V extends DV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new WV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new UV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Bj({},FV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const qV="99999999999999";class ZV extends DV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:qV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new $V(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new XV(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Bj({},jV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const JV=t=>{mz.registerComponentPlugin(t.type,t)};class QV extends EV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(QV.type),this.type=AV.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(ib&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=OV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!si(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}QV.type=AV.dom;class tG extends EV{constructor(){super(tG.type),this.type=AV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ZP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}tG.type=AV.canvas;const eG=()=>{JV(tG)},iG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},nG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=Qj([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return rG(a,n,o)},rG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=sG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},aG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t};class oG extends VH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const lG=`${uB}_HIERARCHY_DEPTH`,hG=`${uB}_HIERARCHY_ROOT`,cG=`${uB}_HIERARCHY_ROOT_INDEX`;function dG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function uG(t,e,i){t&&(i.needDefaultSeriesField&&(t[AD]=i.defaultSeriesField),t[xD]=e,t[SD]=i.getKey(t,e,i))}function pG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function gG(t,e,i,s=0,n,r){void 0===r&&(r=e),uG(t,e,i),t[lG]=s,t[hG]=n||t[i.categoryField],t[cG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>gG(e,s,i,t[lG]+1,t[hG],r)))}const mG=["appear","enter","update","exit","disappear","normal"];function fG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Bj({},o[e],a);return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function vG(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),SG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function _G(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function yG(t,e){var i,s;return null!==(i=null==t?void 0:t[xD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function bG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function xG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function SG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),SG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),SG(t[i],e)}function AG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class kG extends MH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Ij(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Bj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Bj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Bj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class MG extends TH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${uB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=AG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"invalidTravel",aG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Jz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Zz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Zz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new oG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=rG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Vz(this._dataSet,"dimensionStatistics",nG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ya(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Qj(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Vz(this._dataSet,"dimensionStatistics",nG);const s=new ya(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=Qj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Qj(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ya(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Bj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Bj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:nH.STATE_HOVER_REVERSE,highlightState:nH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:nH.STATE_SELECTED_REVERSE,state:nH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:AD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:kD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,kD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new uV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},qD),ZD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>ZD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ya||Qz(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();AG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:AD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new UF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return FF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:AD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Bj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:SD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==CD&&t!==PD&&t!==wD&&t!==ED||(t=this.getStackValueField()),null!==(e=ez(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=LF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:AD]}}function TG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();zw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function wG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}MG.mark=UD,MG.transformerConstructor=kG;class CG extends MG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);zw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${uB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(CD),this.setFieldX2(wD)):(this.setFieldY(CD),this.setFieldY2(wD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(PD),this.setFieldX2(ED)):(this.setFieldY(PD),this.setFieldY2(ED))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(RD),this.setFieldX2(BD)):(this.setFieldY(RD),this.setFieldY2(BD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(TG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const EG="monotone",PG="linear";class BG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(tF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===EG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(tF.point,{morph:bG(this._spec,tF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new ya(this._option.dataSet,{name:`${uB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[tF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Bj({},this._spec[tF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class RG extends UH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Hw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class LG extends RG{constructor(){super(...arguments),this.type=LG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===cB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}LG.type="line";const OG=()=>{mz.registerMark(LG.type,LG),bM(),cM(),CR.registerGraphic(IB.line,wg),sN()};class IG extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class DG extends IG{constructor(){super(...arguments),this.type=DG.type}}DG.type="symbol";const FG=()=>{mz.registerMark(DG.type,DG),bO()};class jG extends kG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class zG extends aN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function HG(t,e,i,s){switch(t){case r.cartesianBandAxis:return jN(kz(i,["z"]),"band",e);case r.cartesianLinearAxis:return jN(kz(i,["z"]),"linear",e);case r.cartesianLogAxis:return jN(kz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return jN(kz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return jN(kz(i),void 0,e);case r.polarBandAxis:return zN(i.orient,"band",e);case r.polarLinearAxis:return zN(i.orient,"linear",e);case r.polarAxis:return zN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>xz(t.orient)));let d;d=p(c)?Bj({},HN(c.type)?a:o,l):l;const u=n.find((t=>Sz(t.orient)));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Bj({},HN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return NG(i,BN(t,e));default:return BN(t,e)}}const NG=(t,e)=>{var i;const s=Bj({},e,e[Mz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class VG extends MH{getTheme(t,e){return HG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},tj(e)),{[s]:0}))}}class GG extends CH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new zG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=VG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof rc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}GG.transformerConstructor=VG;class WG extends UH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(IB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WG.type="component";const UG=()=>{mz.registerMark(WG.type,WG)},YG=t=>t;class KG extends GG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?zB.circleAxisGrid:zB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fG(null===(o=mz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new VH(this._option,t)]}collectData(t,e){const i=[];return aB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?zw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return aB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(aB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=dz(s=t.domainLine)).startSymbol=dz(s.startSymbol),s.endSymbol=dz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return gz(Bj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:gz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:gz(t.tick.style)),t.tick.state&&(i.tick.state=uz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:gz(t.subTick.style)),t.subTick.state&&(i.subTick.state=uz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=LN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Bj({},d,gz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:gz(h.style)}),h.state&&(i.title.state.shape=uz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:gz(o.style)}),o.state&&(i.title.state.background=uz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=uz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=gz(t.background.style)),t.background.state&&(i.panel.state=uz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return gz(Bj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:gz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:gz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=RN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Gz(this._option.dataSet,"scale",YG),Vz(this._option.dataSet,"ticks",XC);return new ya(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}KG.specKey="axes";const XG=()=>{CR.registerGraphicComponent(jB.lineAxis,((t,e)=>new Bw(t,e))),CR.registerGraphicComponent(jB.circleAxis,(t=>new Iw(t))),CR.registerComponent(DB.axis,NO),CR.registerGraphicComponent(zB.lineAxisGrid,((t,e)=>new QC(t,e))),CR.registerGraphicComponent(zB.circleAxisGrid,((t,e)=>new eE(t,e))),CR.registerComponent(DB.grid,WO),UG(),mz.registerAnimation("axis",(()=>({appear:{custom:Fw},update:{custom:Dw},exit:{custom:Xc}})))},$G=[TN];class qG extends KG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{const e=this.getOrient();xz(e)?t.setXAxisHelper(this.axisHelper()):Sz(e)?t.setYAxisHelper(this.axisHelper()):Az(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Bj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Bj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=xz(this.getOrient()),n=t=>{var e;return(s?!xz(t.getOrient()):xz(t.getOrient()))&&zw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=kz(i,["z"]),Az(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!DN(e))return null;const{axisType:t,componentName:s}=Tz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Sz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!DN(t))return;const{axisType:s,componentName:n}=Tz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];xz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):Az(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load($G.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){xz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!xz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!Az(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Sz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=xz(this.getOrient())?t.fieldX:Az(this.getOrient())?t.fieldZ:t.fieldY,zw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(xz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=xz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return aB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:xz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Az(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();aB(this._regions,(e=>{xz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Sz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Az(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=xz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=xz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Bj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return NN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=IN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=ZG?10:n>=JG?5:n>=QG?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}eW.type=r.cartesianLinearAxis,eW.specKey="axes",U(eW,tW);const iW=()=>{XG(),mz.registerComponent(eW.type,eW)};class sW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=NN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class nW extends qG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Qw(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{XG(),mz.registerComponent(nW.type,nW)};class aW extends eW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{xz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Bj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=di.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}aW.type=r.cartesianTimeAxis,aW.specKey="axes";class oW extends eW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new RC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}oW.type=r.cartesianLogAxis,oW.specKey="axes",U(oW,tW);class lW extends eW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}lW.type=r.cartesianSymlogAxis,lW.specKey="axes",U(lW,tW);class hW extends CG{constructor(){super(...arguments),this.type=cB.line,this.transformerConstructor=jG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),vG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=cB.line,hW.mark=eF,hW.transformerConstructor=jG,U(hW,BG);class cW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{Qz(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ya)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Qj(e,[{key:t,operations:zw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&Qj(e,[{key:i.field,operations:zw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?KF("colorOrdinal"):KF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=zw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=zw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;zw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=zw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=iz(t,!0);for(const e in a)for(const i in a[e].nodes)az(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)rz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&nz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pW extends yH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pB,height:gB},this._viewRect={width:pB,height:gB},this._viewBox={x1:0,y1:0,x2:pB,y2:gB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=tj(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new jz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new uW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=mz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=mz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof UH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof UH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&Qz(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cH(this._spec,this._option,{width:pB,height:gB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=FF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){dH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=FF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{dH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,dH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):dH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];dH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=QF(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(nH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(nH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(nH.STATE_SELECTED)}clearHovered(){this.clearState(nH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Dz.dimensionHover||s===Dz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Nw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const gW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class mW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);Tj(t,r,l.spec),Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=mz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class fW extends mW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Bj(i,uH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class vW extends fW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class _W extends pW{constructor(){super(...arguments),this.transformerConstructor=vW,this.type="line",this.seriesType=cB.line,this._canStack=!0}}_W.type="line",_W.seriesType=cB.line,_W.transformerConstructor=vW;class yW extends RG{constructor(){super(...arguments),this.type=yW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}yW.type="area";const bW=()=>{mz.registerMark(yW.type,yW),bM(),tM(),CR.registerGraphic(IB.area,$g),sN()};class xW extends uV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const SW=()=>{mz.registerAnimation("area",eN),iN(),QH()};class AW extends jG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Bj({},m.style,g.style),l.state=Bj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class kW extends CG{constructor(){super(...arguments),this.type=cB.area,this.transformerConstructor=AW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(kW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===EG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XF(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XF(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),vG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),vG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new xW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}kW.type=cB.area,kW.mark=sF,kW.transformerConstructor=AW,U(kW,BG);class MW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class TW extends pW{constructor(){super(...arguments),this.transformerConstructor=MW,this.type="area",this.seriesType=cB.area,this._canStack=!0}}TW.type="area",TW.seriesType=cB.area,TW.transformerConstructor=MW;function wW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const CW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wW(t,e)}),EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wW(t,e)}),PW={type:"fadeIn"},BW={type:"growCenterIn"};function RW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return PW;case"scaleIn":return BW;default:return CW(t)}}class LW extends UH{constructor(){super(...arguments),this.type=LW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}LW.type="rect";const OW=()=>{mz.registerMark(LW.type,LW),_O(),fO.useRegisters([WI,UI,YI,KI,VI,GI])};function IW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[YD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):XF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):XF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):XF(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},jW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:bG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(jW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Vz(this._option.dataSet,"addVChartProperty",iG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Vz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ya(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new oG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=$D,s=XD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=KD,s=YD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=iz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)IW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=XF(this[n](t),o),d=XF(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[wD],n=t[CD],r=t[ED],h=t[PD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[wD]:i,[CD]:s}),a?{[ED]:o,[PD]:l}:void 0);t.push(Pg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>XF(this._dataToPosY(t),a),y1:t=>XF(this._dataToPosY1(t),a)}:{y:t=>XF(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>XF(this._dataToPosX(t),r),x1:t=>XF(this._dataToPosX1(t),r)}:{x:t=>XF(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=wG(this);this._barMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),vG(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=ij(this._spec.barWidth,a)),l&&(c=Math.max(c,ij(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ij(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ij(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=zw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}jW.type=cB.bar,jW.mark=JD,jW.transformerConstructor=FW;const zW=()=>{rI(),OW(),mz.registerAnimation("bar",((t,e)=>({appear:RW(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t)}))),rW(),iW(),mz.registerSeries(jW.type,jW)};class HW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),hH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class NW extends pW{constructor(){super(...arguments),this.transformerConstructor=HW,this.type="bar",this.seriesType=cB.bar,this._canStack=!0}}NW.type="bar",NW.seriesType=cB.bar,NW.transformerConstructor=HW;class VW extends UH{constructor(){super(...arguments),this.type=VW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}VW.type="rect3d";class GW extends jW{constructor(){super(...arguments),this.type=cB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}GW.type=cB.bar3d,GW.mark=QD;class WW extends HW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class UW extends NW{constructor(){super(...arguments),this.transformerConstructor=WW,this.type="bar3d",this.seriesType=cB.bar3d}}UW.type="bar3d",UW.seriesType=cB.bar3d,UW.transformerConstructor=WW;const YW=[10,20],KW=Lw.Linear,XW="circle",$W=Lw.Ordinal,qW=["circle","square","triangle","diamond","star"],ZW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class JW extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QW extends CG{constructor(){super(...arguments),this.type=cB.scatter,this.transformerConstructor=JW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${uB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${uB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KW,defaultRange:YW},"size")}getShapeAttribute(t,e){return u(e)?XW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:$W,defaultRange:qW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(QW.mark.point,{morph:bG(this._spec,QW.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=wG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),vG("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:XW},nH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},nH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QW.type=cB.scatter,QW.mark=iF,QW.transformerConstructor=JW;const tU=()=>{FG(),mz.registerAnimation("scatter",((t,e)=>Object.assign({appear:ZW(0,e)},ZH))),rW(),iW(),mz.registerSeries(QW.type,QW)};class eU extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class iU extends pW{constructor(){super(...arguments),this.transformerConstructor=eU,this.type="scatter",this.seriesType=cB.scatter,this._canStack=!0}}iU.type="scatter",iU.seriesType=cB.scatter,iU.transformerConstructor=eU;Ln();const sU={},nU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rU(t,e){t&&_(t)||ub("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(sU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ln().projection(s),s.copy=s.copy||function(){const t=i();return nU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),sU[i]||null}const aU={albers:Jn,albersusa:function(){var t,e,i,s,n,r,a=Jn(),o=Zn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Zn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(aU).forEach((t=>{rU(t,aU[t])}));const oU="Feature",lU="FeatureCollection";function hU(t){const e=Y(t);return 1===e.length?e[0]:{type:lU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===lU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===oU?t:{type:oU,geometry:t}))}(e))),[])}}const cU=nU.concat(["pointRadius","fit","extent","size"]);function dU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{cU.includes(s)&&(i=i.concat(mR(t[s],e)))})),i):i}let uU=class extends QR{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(mR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(mR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(mR(this.spec.size,this.view)),this.spec.size=t,this.attach(mR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(mR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(mR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(mR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(mR(t,this.view)),this.commit(),this}configure(t){return this.detach(dU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(dU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=rU((t||"mercator").toLowerCase());return e||ub("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),nU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,vR(this.spec[t],e,rU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(vR(this.spec.pointRadius,e,rU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=hU(vR(this.spec.fit,e,rU));this.spec.extent?this.projection.fitExtent(vR(this.spec.extent,e,rU),t):this.spec.size&&this.projection.fitSize(vR(this.spec.size,e,rU),t)}return this.projection}output(){return this.projection}};const pU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class gU extends MG{constructor(){super(...arguments),this.type=cB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${uB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mU=`${uB}_MAP_LOOK_UP_KEY`,fU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[xD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mU]=e.nameMap[n]:t[mU]=n})),t.features);class vU extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class _U extends UH{constructor(){super(...arguments),this.type=_U.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}_U.type="path";const yU=()=>{mz.registerMark(_U.type,_U),vO()};class bU{constructor(t){this.projection=rU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class xU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class SU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function AU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:xU}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:SU}:null}const kU={debounce:xt,throttle:St};class MU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),AU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,kU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:De({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,kU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){AU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;De({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||AU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=kU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=kU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function TU(t,e){return`${uB}_${e}_${t}`}class wU extends GG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:TU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Bj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new bU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===cB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),aB(this._regions,(t=>{var e;if(t.type===cB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new oe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===cB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}wU.type=r.geoCoordinate,U(wU,MU);const CU=()=>{mz.registerComponent(wU.type,wU)};class EU extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class PU extends gU{constructor(){super(...arguments),this.type=cB.map,this.transformerConstructor=EU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Wz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Vz(this._dataSet,"copyDataView",qz),Vz(this._dataSet,"map",fU),Vz(this._dataSet,"lookup",pU);const i=Wz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ya(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:tH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new oG(this._option,s)}initMark(){this._pathMark=this._createMark(PU.mark.area,{morph:bG(this._spec,PU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:AD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(fG(null===(t=mz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),vG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[xD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[xD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new oe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new oe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return xD}getActiveMarks(){return[this._pathMark]}}PU.type=cB.map,PU.mark=lF,PU.transformerConstructor=EU;const BU=()=>{CR.registerGrammar("projection",uU,"projections"),CU(),yU(),mz.registerSeries(PU.type,PU),mz.registerImplement("registerMap",Kz),mz.registerImplement("unregisterMap",Xz),tN()},RU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[ID]=!0:delete t[ID]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=LU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Kt(_,e)):(t[c]=+y,y=Kt(y,e)),t[d]=Kt(t[c],e),f=Kt(f,e),b=Xt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=LU(a,t,n,r,h,l,i,e),r.push(n)})),r};function LU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Kt(i.positive,e)):(t[h]=+i.negative,i.negative=Kt(i.negative,e)),t[c]=Kt(t[h],e),i.end=Kt(i.end,e)}i.isTotal=e,(u(p)||p===fD)&&(t[fD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Kt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Kt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},DU={type:"fadeIn"},FU={type:"growCenterIn"};function jU(t,e){switch(e){case"fadeIn":return DU;case"scaleIn":return FU;default:return CW(t,!1)}}class zU extends UH{constructor(){super(...arguments),this.type=zU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}zU.type="rule";const HU=()=>{mz.registerMark(zU.type,zU),yO()},NU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ya(e instanceof va?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Vz(e,"dimensionTree",NU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WU extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UU={rect:qU,symbol:XU,arc:JU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=XU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:QU,line:tY,area:tY,rect3d:qU,arc3d:JU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=RN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function KU(t){return d(t)?e=>t(e.data):t}function XU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=KU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:$U(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function $U(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function qU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=KU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:ZU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function ZU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function JU(t){var e;const{labelSpec:i}=t,s=null!==(e=KU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function QU(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=YU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),yp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function tY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class eY extends jW{constructor(){super(...arguments),this.type=cB.waterfall,this.transformerConstructor=WU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=fD)}getSeriesKeys(){return this._seriesField===fD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Vz(this._dataSet,"waterfallFillTotal",IU),Vz(this._dataSet,"waterfall",RU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Zz(this.getViewData(),this._dataSet,{name:`${uB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new oG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:wD,endAs:CD,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=wG(this);this._barMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),vG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(eY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return QU(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?XF(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):XF(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}eY.type=cB.waterfall,eY.mark=vF,eY.transformerConstructor=WU;const iY=()=>{HU(),OW(),mz.registerAnimation("waterfall",((t,e)=>({appear:jU(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t,!1)}))),tN(),rW(),iW(),mz.registerSeries(eY.type,eY)},sY=`${uB}_BOX_PLOT_OUTLIER_VALUE`;var nY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nY||(nY={}));const rY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class aY extends uV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return this.series.getOutliersField();if(t===nY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nY.MIN:return this.series.getMinField();case nY.MAX:return this.series.getMaxField();case nY.MEDIAN:return this.series.getMedianField();case nY.Q1:return this.series.getQ1Field();case nY.Q3:return this.series.getQ3Field();case nY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return e[sY];if(t===nY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nY.MIN:return e[this.series.getMinField()];case nY.MAX:return e[this.series.getMaxField()];case nY.MEDIAN:return e[this.series.getMedianField()];case nY.Q1:return e[this.series.getQ1Field()];case nY.Q3:return e[this.series.getQ3Field()];case nY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(nY.OUTLIER),value:this.getContentValue(nY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(nY.MAX),value:this.getContentValue(nY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q3),value:this.getContentValue(nY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MEDIAN),value:this.getContentValue(nY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q1),value:this.getContentValue(nY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MIN),value:this.getContentValue(nY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.SERIES_FIELD),value:this.getContentValue(nY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class oY extends UH{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}oY.type="boxPlot";const lY=()=>{mz.registerMark(oY.type,oY),CR.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(TO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ab(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ab(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),CR.registerAnimationType("boxplotScaleIn",wO),CR.registerAnimationType("boxplotScaleOut",CO),SO(),_O(),yO(),CR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(PO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),CR.registerAnimationType("barBoxplotScaleIn",BO),CR.registerAnimationType("barBoxplotScaleOut",RO),SO(),_O(),yO()};class hY extends CG{constructor(){super(...arguments),this.type=cB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(hY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(hY.mark.outlier,{progressive:t,key:xD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,nH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},nH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>XF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},nH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>XF(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>XF(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,nH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"foldOutlierData",rY),Vz(this._dataSet,"addVChartProperty",iG);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${uB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._outlierDataView=new oG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=wG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=mz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(vG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(fG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(fG(null===(a=mz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}hY.type=cB.boxPlot,hY.mark=_F;class cY extends UH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}cY.type="text";const dY=()=>{mz.registerMark(cY.type,cY),xO(),bM(),_M(),CR.registerGraphic(IB.richtext,Gg)};function uY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class pY extends uV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const gY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),mY={type:"fadeIn"},fY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vY(t,e){return"fadeIn"===e?mY:gY(t)}class _Y extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class yY extends jW{constructor(){super(...arguments),this.type=cB.rangeColumn,this._barMarkType="rect",this._barName=cB.bar,this.transformerConstructor=_Y}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yY.mark.bar,{morph:bG(this._spec,yY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(yY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(yY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});uY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});uY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=wG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),vG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(fG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}yY.type=cB.rangeColumn,yY.mark=kF,yY.transformerConstructor=_Y;const bY=()=>{OW(),dY(),mz.registerAnimation("rangeColumn",((t,e)=>({appear:vY(t,e),enter:gY(t),exit:fY(t),disappear:fY(t)}))),tN(),rW(),iW(),mz.registerSeries(yY.type,yY)};class xY extends yY{constructor(){super(...arguments),this.type=cB.rangeColumn3d,this._barMarkType="rect3d",this._barName=cB.bar3d}}xY.type=cB.rangeColumn3d,xY.mark=MF;class SY extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class AY extends kW{constructor(){super(...arguments),this.type=cB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(AY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new SY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}AY.type=cB.rangeArea,AY.mark=EF;class kY extends MG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=RB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};zw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};zw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&TG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const MY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:s,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=re(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[s]))),y=r-n;let b=n,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[xB],s=m?i/m:0;let n=s*y;n{g(e,n+i*t,t)}))}else{const t=x/S;b=n,i.forEach((e=>{const i=e[c]===a?a:e[xB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function TY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const wY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:TY(t,!0,iH.appear)}),CY={type:"fadeIn"},EY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:TY(t,!0,iH.enter)}),PY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:TY(t,!0,iH.exit)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:TY(t,!0,iH.exit)});function RY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CY;case"growRadius":return wY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return wY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class LY extends UH{constructor(t,e){super(t,e),this.type=OY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>se({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[TB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class OY extends LY{constructor(){super(...arguments),this.type=OY.type}}OY.type="arc";const IY=()=>{bM(),Jk(),CR.registerGraphic(IB.arc,Jg),fO.useRegisters([iD,sD,tD,eD]),mz.registerMark(OY.type,OY)};class DY extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Bj({},this._theme,i,t);const n=(t,e)=>Bj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}class FY extends kY{constructor(){super(...arguments),this.transformerConstructor=DY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=EB,this._endAngle=PB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[TB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return se(this.computeCenter(t),(i+s)/2,e)}}getCenter(){var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?te(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?te(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?te(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Vz(this._dataSet,"pie",MY),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?te(this._spec.minAngle):0,asStartAngle:AB,asEndAngle:kB,asRatio:SB,asMiddleAngle:TB,asRadian:CB,asQuadrant:wB,asK:MB}},!1);const e=new ya(this._dataSet,{name:`${uB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new oG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},FY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:bG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:SD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return hB(AB)(t)}endAngleScale(t){return hB(kB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$F(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$F(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:hB(_B).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:n,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===n&&t.centerX===s&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[TB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return se(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===iH.appear)return this._startAngle;if(i===iH.disappear)return this._endAngle;const n=[iH.disappear,iH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[xD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[TB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[TB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[TB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[TB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}FY.transformerConstructor=DY,FY.mark=rF;class jY extends FY{constructor(){super(...arguments),this.type=cB.pie}}jY.type=cB.pie;const zY=()=>{IY(),mz.registerAnimation("pie",((t,e)=>({appear:RY(t,e),enter:EY(t),exit:PY(t),disappear:BY(t)}))),mz.registerSeries(jY.type,jY)};class HY extends LY{constructor(){super(...arguments),this.type=HY.type,this._support3d=!0}}HY.type="arc3d";class NY extends DY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class VY extends FY{constructor(){super(...arguments),this.type=cB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=NY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[TB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}VY.type=cB.pie3d,VY.mark=aF,VY.transformerConstructor=NY;const GY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},WY={type:"fadeIn"},UY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),YY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),KY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function XY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return WY;case"growAngle":return GY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return GY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class $Y extends kY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(CD),this.setInnerRadiusField(wD)}setValueFieldToPercent(){this.setRadiusField(PD),this.setInnerRadiusField(ED)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class qY extends kG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const ZY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:BB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:RB,layoutRadius:e.layoutRadius}};class JY extends KG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!FN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=ZY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s;const n=[];return e.forEach(((e,r)=>{if(!FN(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=ZY(e,t);e.center=c,e.startAngle=l,e.endAngle=h,e.outerRadius=d,e.type=a,e.layoutRadius=u;const p={spec:e,specPath:[this.specKey,r],specInfoPath:["component",this.specKey,r],type:o};i.push(p),"radius"===e.orient?n.push(p):s=r})),n.forEach((t=>{t.angleAxisIndex=s})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=EB,this._endAngle=PB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:ON(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){aB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return zw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this.computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return se(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,n=this.getLabelItems(s),r=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),a=Object.assign(Object.assign({},r),{title:{text:this._spec.title.text||this._dataFieldText},items:n,orient:"angle"});this._spec.grid.visible&&(a.grid=Object.assign({type:"line",smoothLink:!0,items:n[0]},r)),this._update(a)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=qt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAngleAxis())||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(p(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutRadius(){const t=this.getRefLayoutRect();if(S(this._spec.layoutRadius))return this._spec.layoutRadius;if(d(this._spec.layoutRadius))return this._spec.layoutRadius(t,this.getCenter());const{width:e,height:i}=t;return"auto"===this._spec.layoutRadius&&e>0&&i>0?ae(t,this.getCenter(),this._startAngle,this._endAngle):Math.min(e/2,i/2)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this.computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this.computeLayoutRadius()*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=RB,e=0;const i=this.getChart().getSpec();return aB(this.getRegions(),(s=>{const n=s;if(r=n.type,[cB.rose,cB.radar,cB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Bj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Bj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}JY.type=r.polarAxis,JY.specKey="axes";class QY extends JY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}QY.type=r.polarLinearAxis,QY.specKey="axes",U(QY,tW);const tK=()=>{XG(),mz.registerComponent(QY.type,QY)};class eK extends JY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}eK.type=r.polarBandAxis,eK.specKey="axes",U(eK,sW);const iK=()=>{XG(),mz.registerComponent(eK.type,eK)};class sK extends $Y{constructor(){super(...arguments),this.type=cB.rose,this.transformerConstructor=qY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(sK.mark.rose,{morph:bG(this._spec,sK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XF(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),vG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}sK.type=cB.rose,sK.mark=oF,sK.transformerConstructor=qY;const nK=()=>{mz.registerSeries(sK.type,sK),IY(),mz.registerAnimation("rose",((t,e)=>({appear:XY(t,e),enter:UY(t),exit:YY(t),disappear:KY(t)}))),iK(),tK()};class rK extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,JP(this._fromAngle,this._toAngle)&&JP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class aK extends Wc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=re(s.angle),a=re(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=re(o.angle),c=re(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new $t(m,f,v,_);return y.defined=e.defined,y}}const oK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function lK(t,e,i){return"fadeIn"===e?oK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function hK(t,e,i){return"fadeIn"===e?oK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const cK=(t,e)=>({custom:Yc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class dK extends $Y{constructor(){super(...arguments),this.type=cB.radar,this.transformerConstructor=jG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(dK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?te(this._spec.startAngle):EB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),vG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=mz.getAnimationInKey(e);t.setAnimationConfig(fG(null==i?void 0:i(n,r),vG(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}dK.type=cB.radar,dK.mark=nF,dK.transformerConstructor=jG,U(dK,BG);const uK=()=>{mz.registerSeries(dK.type,dK),aI(),bW(),OG(),FG(),mz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:lK(t,e,"in"),enter:lK(t,e,"in"),exit:lK(t,e,"out"),disappear:"clipIn"===e?void 0:lK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:aK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:hK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:hK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:rK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarGroup",((t,e)=>({appear:cK(t,"in"),disappear:cK(t,"out")}))),Jk(),iK(),tK()};class pK extends uV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>di.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const gK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},mK={fill:"#bbb",fillOpacity:.2};class fK extends CG{constructor(){super(...arguments),this.type=cB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Vz(this._option.dataSet,"objFlat",gK),Vz(this._option.dataSet,"copyDataView",qz),Gz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:tH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Bj(mK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(fK.mark.group),this._containerMark=this._createMark(fK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(fK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(fK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(fK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(fK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(fK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(fK.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new UF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:AD}}initTooltip(){this._tooltipHelper=new pK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}fK.type=cB.dot,fK.mark=uF;class vK extends uV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>di.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const _K=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class yK extends CG{constructor(){super(...arguments),this.type=cB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Vz(this._option.dataSet,"linkDotInfo",_K),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:tH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(yK.mark.group),this._containerMark=this._createMark(yK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(yK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(yK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new vK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}yK.type=cB.link,yK.mark=dF;class bK extends kY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?wD:DD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?te(n):EB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):PB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[wD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(bK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+te(s),n=te(i)/2;return Jg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Pg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const AK=()=>{mz.registerAnimation("circularProgress",((t,e)=>({appear:SK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class kK extends kG{constructor(){super(...arguments),this._supportStack=!0}}class MK extends bK{constructor(){super(...arguments),this.type=cB.circularProgress,this.transformerConstructor=kK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(MK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(MK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?wD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}MK.type=cB.circularProgress,MK.mark=cF,MK.transformerConstructor=kK;function TK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const wK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TK(t)}),CK={type:"fadeIn"};function EK(t,e){return!1===e?{}:"fadeIn"===e?CK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TK(t)}))(t)}class PK extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class BK extends CG{constructor(){super(...arguments),this.type=cB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(BK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return XF(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(BK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(BK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=XF(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Pg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=XF(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Pg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new PK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}BK.type=cB.linearProgress,BK.mark=fF;const RK=()=>{OW(),mz.registerAnimation("linearProgress",((t,e)=>({appear:EK(t,e),enter:{type:"grow"},disappear:wK(t)}))),tN(),mz.registerSeries(BK.type,BK)},LK=[0],OK=[20,40],IK=[200,500],DK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},FK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],jK=`${uB}_WORD_CLOUD_WEIGHT`,zK=`${uB}_WORD_CLOUD_TEXT`;class HK extends MG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=OK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:IK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:LK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?zK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:DK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:LK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!FK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(HK.mark.word,{key:SD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(fG(mz.getAnimationInKey("wordCloud")(n,s),vG("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new UF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new EC,o=this._fontWeightRange;if(r){const[e,i]=vb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:jK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:zK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:sb(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:SD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:SD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}HK.mark=pF;function NK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||qH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function GK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function WK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const UK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function YK(t){return d(t)?t:function(){return t}}class KK{constructor(t){var e,i,s;switch(this.options=z({},KK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,VK[s]?VK[s]():VK.circle()),this.getText=null!==(e=YK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=YK(this.options.fontWeight),this.getTextFontSize=YK(this.options.fontSize),this.getTextFontStyle=YK(this.options.fontStyle),this.getTextFontFamily=YK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>UK(10,50);break;case"random-light":this.getTextColor=()=>UK(50,90);break;default:this.getTextColor=YK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return te(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return te(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class $K extends KK{constructor(t){var e;super(z({},$K.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=$K.defaultOptions.minFontSize&&(this.options.minFontSize=$K.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=XK[this.options.spiral])&&void 0!==e?e:XK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=YK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=WK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(O_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(JK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}QK(p,this._size)&&(p=tX(p,this._size))}else if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||ZK(p,i))&&(!i||!qK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function qK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function ZK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,QK=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function tX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=WK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}iX.defaultOptions={enlarge:!1};const nX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},rX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?aX(t.fontFamily):"sans-serif",d=t.fontStyle?aX(t.fontStyle):"normal",u=t.fontWeight?aX(t.fontWeight):"normal",p=t.rotate?aX(t.rotate):0,g=aX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?aX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||nX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?aX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=lX(hX(t,l),C);w=i=>e(t(i))}let E=$K;"fast"===t.layoutType?E=iX:"grid"===t.layoutType&&(E=eX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},aX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],oX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),lX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=oX(t[0]),s=oX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(oX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},hX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function cX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{CR.registerTransform("wordcloud",{transform:rX,markPhase:"beforeJoin"},!0),dY(),mz.registerAnimation("wordCloud",((t,e)=>({appear:NK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),mz.registerSeries(dX.type,dX)};(class extends HK{constructor(){super(...arguments),this.type=cB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(HK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),vG("word",this._spec,this._markAttributeContext)))}}).type=cB.wordCloud3d;const pX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},gX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},mX=`${uB}_FUNNEL_TRANSFORM_RATIO`,fX=`${uB}_FUNNEL_REACH_RATIO`,vX=`${uB}_FUNNEL_HEIGHT_RATIO`,_X=`${uB}_FUNNEL_VALUE_RATIO`,yX=`${uB}_FUNNEL_LAST_VALUE_RATIO`,bX=`${uB}_FUNNEL_NEXT_VALUE_RATIO`,xX=`${uB}_FUNNEL_LAST_VALUE`,SX=`${uB}_FUNNEL_CURRENT_VALUE`,AX=`${uB}_FUNNEL_NEXT_VALUE`,kX=`${uB}_FUNNEL_TRANSFORM_LEVEL`,MX=20;class TX extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[fX])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class wX extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class CX extends wX{constructor(){super(...arguments),this.type=CX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}CX.type="polygon";const EX=()=>{mz.registerMark(CX.type,CX),bM(),gM(),CR.registerGraphic(IB.polygon,em),fO.useRegisters([XI,$I])};class PX extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class BX extends MG{constructor(){super(...arguments),this.type=cB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=PX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"funnel",pX),Vz(this._dataSet,"funnelTransform",gX);const t=new ya(this._dataSet,{name:`${uB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new oG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:SX,asTransformRatio:mX,asReachRatio:fX,asHeightRatio:vX,asValueRatio:_X,asNextValueRatio:bX,asLastValueRatio:yX,asLastValue:xX,asNextValue:AX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:kX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},BX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:bG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},BX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(BX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(BX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new TX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*hB(fX).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),vG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(fG(mz.getAnimationInKey("fadeInOut")(),vG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(fG(mz.getAnimationInKey("funnel")({},o),vG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(fG(null===(a=mz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),vG("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[yX])/2:this._getSecondaryAxisLength(t[_X])/2,n=this._getSecondaryAxisLength(t[_X])/2):(s=this._getSecondaryAxisLength(t[_X])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[bX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[kX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[SD]===t[SD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?MX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{EX(),dY(),HU(),mz.registerSeries(BX.type,BX),mz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},JH))),mz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Kc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Kc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),tN()};class LX extends wX{constructor(){super(...arguments),this.type=LX.type}}LX.type="pyramid3d";class OX extends PX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class IX extends BX{constructor(){super(...arguments),this.type=cB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=OX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},IX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},IX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(IX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(IX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}IX.type=cB.funnel3d,IX.mark=mF,IX.transformerConstructor=OX;const DX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},FX=t=>{const e=t.mark.elements.filter((t=>t.diffState===OB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},jX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},zX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=jX(r,s,n);return DX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=jX(r,s,n);return DX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),HX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},NX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=HX(r);return DX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=HX(r);return DX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),VX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},GX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):GX(t.children,e,i)))})),e};function WX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=KX(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,wt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},XX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=XX(t.children,e,t,n))})),s},$X=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=$X(t.children,e,t,n)),n=e(t,s,i,n)})),n},qX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:WX,slice:UX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?UX:WX)(t,e,i,s,n)}};class ZX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},ZX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?gb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?YX(this.options.aspectRatio):null!==(e=qX[this.options.splitType])&&void 0!==e?e:qX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=KX(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}ZX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const JX=(t,e)=>{const i=new ZX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return GX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},QX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class t${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];WX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QX);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},t$.defaultOpionts,t):Object.assign({},t$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+yb(this.options.center[0],t.width),s=t.y0+yb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>yb(t,n))):yb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>yb(t,n))):yb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=yb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=KX(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=se({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}t$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const e$=4294967296;function i$(t,e){let i,s;if(r$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function r$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function h$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function c$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function d$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function u$(t){return{_:t,next:null,prev:null}}function p$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];h$(n,s,r);let a,o,l,h,c,d,u,p=u$(s),g=u$(n),m=u$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=KX(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%e$)/e$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:v$.defaultOpionts.nodeSort;XX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)XX([o],g$(h)),$X([o],m$(this._getPadding,.5,a)),XX([o],f$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);XX([o],g$(v$.defaultOpionts.setRadius)),$X([o],m$(fb,1,a)),c&&$X([o],m$(this._getPadding,o.radius/t,a)),XX([o],f$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}v$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const _$=(t,e={})=>{if(!t)return[];const i=[];return GX(t,i,e),i},y$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new t$(i).layout(t,{width:s,height:n})};class b$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var x$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(x$||(x$={}));const S$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===x$.DrillDown){return Y(lz(t,n,s,"children"))}if(i.type===x$.DrillUp){const e=hz(t,n,s,"children");if(e)return Y(e)}return t};class A${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Vz(t,"drillFilter",S$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:x$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:x$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:x$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:x$.DrillUp},model:this}),r}}class k$ extends kY{constructor(){super(...arguments),this.type=cB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"sunburstLayout",y$),Vz(this._dataSet,"flatten",_$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(k$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new b$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}k$.type=cB.sunburst,k$.mark=AF,U(k$,A$);const M$=()=>{mz.registerSeries(k$.type,k$),IY(),dY(),tN(),mz.registerAnimation("sunburst",((t,e)=>({appear:VX(0,e),enter:zX(t),exit:NX(t),disappear:NX(t)})))},T$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new v$(i).layout(t,{width:s,height:n})};class w$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const C$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class E$ extends CG{constructor(){super(...arguments),this.type=cB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"circlePackingLayout",T$),Vz(this._dataSet,"flatten",_$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(E$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(E$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},nH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new w$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}E$.type=cB.circlePacking,E$.mark=TF,U(E$,A$);const P$=()=>{mz.registerSeries(E$.type,E$),IY(),dY(),QH(),mz.registerAnimation("circlePacking",((t,e)=>({appear:C$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},B$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=B$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R$(t){return t.depth}function L$(t,e){return e-1-t.endDepth}const O$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),I$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},D$={left:R$,right:L$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R$,end:L$},F$=yt(0,1);class j${constructor(t){this._ascendingSourceBreadth=(t,e)=>O$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>O$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},j$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):D$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};kb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),kb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];B$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[I$(s[t.source]),I$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*F$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(O$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(O$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new j$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},H$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&H$(t,e.children,i)}))},N$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},V$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new j$(e),r=[];return r.push(n.layout(s,i)),r},G$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},W$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class U$ extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const Y$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),K$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:Y$(t),X$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class $$ extends UH{constructor(){super(...arguments),this.type=$$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}$$.type="linkPath";const q$=()=>{CR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(IO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),CR.registerAnimationType("linkPathGrowIn",DO),CR.registerAnimationType("linkPathGrowOut",FO),CR.registerAnimationType("linkPathUpdate",jO),SO(),vO(),mz.registerMark($$.type,$$)};class Z$ extends CG{constructor(){super(...arguments),this.type=cB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Jt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(nH.STATE_SANKEY_EMPHASIS),e.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS)):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(nH.STATE_SANKEY_EMPHASIS),s.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Vz(this._dataSet,"sankeyLayout",V$),Vz(this._dataSet,"sankeyFormat",N$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:tH.sankeyLayout});const{dataSet:a}=this._option;Vz(a,"sankeyNodes",G$),Vz(a,"flatten",_$);const o=new ya(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._nodesSeriesData=new oG(this._option,o),Vz(a,"sankeyLinks",W$);const l=new ya(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._linksSeriesData=new oG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Z$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(Z$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(Z$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},nH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),vG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),vG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(fG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([nH.STATE_SANKEY_EMPHASIS_REVERSE,nH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new U$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new UF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return H$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}Z$.type=cB.sankey,Z$.mark=bF;const J$=()=>{CR.registerTransform("sankey",{transform:z$,markPhase:"beforeJoin"},!0),OW(),q$(),dY(),mz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:K$(t,e)},JH))),mz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:X$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),tN(),mz.registerSeries(Z$.type,Z$)},Q$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=_$(n);return i=nG([{latestData:r}],e),i};class tq extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const eq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class iq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class sq extends CG{constructor(){super(...arguments),this.type=cB.treemap,this.transformerConstructor=iq,this._viewBox=new Jt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new oe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:SD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[hG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Vz(this._dataSet,"hierarchyDimensionStatistics",Q$),Vz(this._dataSet,"flatten",_$);const i=new ya(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(sq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(sq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new tq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}sq.type=cB.treemap,sq.mark=yF,sq.transformerConstructor=iq,U(sq,A$),U(sq,MU);const nq=()=>{OW(),dY(),mz.registerAnimation("treemap",((t,e)=>({appear:eq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),tN(),CR.registerTransform("treemap",{transform:JX,markPhase:"beforeJoin"},!0),mz.registerSeries(sq.type,sq)},rq={type:"fadeIn"};function aq(t,e){return"fadeIn"===e?rq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class oq extends kG{constructor(){super(...arguments),this._supportStack=!1}}class lq extends bK{constructor(){super(...arguments),this.type=cB.gaugePointer,this.transformerConstructor=oq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(lq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},lq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(lq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}lq.type=cB.gaugePointer,lq.mark=SF,lq.transformerConstructor=oq;const hq=()=>{mz.registerSeries(lq.type,lq),yU(),OW(),mz.registerAnimation("gaugePointer",((t,e)=>{const i=aq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),iK(),tK()};class cq extends kG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class dq extends bK{constructor(){super(...arguments),this.type=cB.gauge,this.transformerConstructor=cq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=te(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Vz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[FD]=t[this._angleField[0]],t[DD]=e>0?i[e-1][FD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(dq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(dq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return p(t[DD])?this.angleAxisHelper.dataToPosition([t[DD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[FD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}dq.type=cB.gauge,dq.mark=xF,dq.transformerConstructor=cq;class uq extends IG{constructor(){super(...arguments),this.type=uq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}uq.type="cell";const pq=()=>{mz.registerMark(uq.type,uq),bM(),SM(),CR.registerGraphic(IB.cell,kg),CR.registerMark(IB.cell,dD)};function gq(t){return!1===t?{}:{type:"fadeIn"}}class mq extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class fq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class vq extends CG{constructor(){super(...arguments),this.type=cB.heatmap,this.transformerConstructor=fq}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(vq.mark.cell,{morph:bG(this._spec,vq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(vq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ei(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=wG(this);this._cellMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),vG("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new mq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}vq.type=cB.heatmap,vq.mark=wF,vq.transformerConstructor=fq;const _q=()=>{dY(),pq(),mz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},JH),{appear:gq(e)}))),rW(),iW(),mz.registerSeries(vq.type,vq)},yq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=te(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=te(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=yb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=yb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+yb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+yb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=gb(e.field),C=t.map(w),[E,P]=vb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:gb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?vb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=bq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),xq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},xq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[xD]:null==n?void 0:n[xD],[AD]:null==n?void 0:n[AD]}};class Aq extends UH{constructor(){super(...arguments),this.type=Aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Aq.type="ripple";const kq=()=>{mz.registerMark(Aq.type,Aq),CR.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),SO(),bO()},Mq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Tq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class wq extends kY{constructor(){super(...arguments),this.type=cB.correlation,this.transformerConstructor=Tq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Vz(this._dataSet,"correlation",yq);const s=new va;Gz(s,"dataview",ga),Vz(s,"correlationCenter",Sq);const n=new ya(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new oG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(wq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:xD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(wq.mark.ripplePoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(wq.mark.centerPoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[vD],y:t=>t[_D],size:t=>t[yD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),vG("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}wq.type=cB.correlation,wq.mark=CF,wq.transformerConstructor=Tq;const Cq=()=>{FG(),kq(),mz.registerSeries(wq.type,wq),mz.registerAnimation("correlation",((t,e)=>Object.assign({appear:Mq(0,e)},ZH)))};class Eq extends UH{constructor(){super(...arguments),this.type=Eq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Eq.type="liquid";const Pq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Bq extends uV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Rq extends MG{constructor(){super(...arguments),this.type=cB.liquid,this.transformerConstructor=jG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=kg({x:s,y:n,size:r,symbolType:Pq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=tj(this._spec.outlineMargin),this._paddingSpec=tj(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Rq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Rq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Rq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Rq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Bq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),vG("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),vG("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Rq.type=cB.liquid,Rq.mark=PF,Rq.transformerConstructor=jG;const Lq=t=>Y(t).join(",");class Oq extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Lq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Lq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Iq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Dq extends MG{constructor(){super(...arguments),this.type=cB.venn,this.transformerConstructor=Iq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:SD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(Dq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Dq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},nH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},nH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Lq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},nH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Lq(t.sets)},nH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Oq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Lq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Lq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Lq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Lq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}}Dq.type=cB.venn,Dq.mark=BF,Dq.transformerConstructor=Iq;class Fq extends mW{_isValidSeries(t){return t===cB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class jq extends pW{constructor(){super(...arguments),this.transformerConstructor=Fq,this.type="map",this.seriesType=cB.map}}jq.type="map",jq.seriesType=cB.map,jq.transformerConstructor=Fq;class zq extends mW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Hq extends zq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=IN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Bj({},s,l)),n&&Object.assign(o,Bj({},n,o))}}class Nq extends zq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Vq extends zq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class Gq extends pW{constructor(){super(...arguments),this.transformerConstructor=Vq}}Gq.transformerConstructor=Vq;class Wq extends Gq{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="pie",this.seriesType=cB.pie}}Wq.type="pie",Wq.seriesType=cB.pie,Wq.transformerConstructor=Vq;class Uq extends Vq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Yq extends Gq{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="pie3d",this.seriesType=cB.pie3d}}Yq.type="pie3d",Yq.seriesType=cB.pie3d,Yq.transformerConstructor=Uq;class Kq extends Nq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:RB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:RB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Xq extends pW{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="rose",this.seriesType=cB.rose,this._canStack=!0}}Xq.type="rose",Xq.seriesType=cB.rose,Xq.transformerConstructor=Kq;class $q extends Nq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Bj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class qq extends pW{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="radar",this.seriesType=cB.radar,this._canStack=!0}}qq.type="radar",qq.seriesType=cB.radar,qq.transformerConstructor=$q;class Zq extends mW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Bj(e,uH(this.type,t))})),this._transformAxisSpec(t)}}class Jq extends pW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="common",this._canStack=!0}}Jq.type="common",Jq.transformerConstructor=Zq;class Qq extends fW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class tZ extends pW{constructor(){super(...arguments),this.transformerConstructor=Qq,this._canStack=!0}}tZ.transformerConstructor=Qq;class eZ extends Qq{transformSpec(t){super.transformSpec(t),hH(t)}}class iZ extends tZ{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="histogram",this.seriesType=cB.bar}}iZ.type="histogram",iZ.seriesType=cB.bar,iZ.transformerConstructor=eZ;class sZ extends tZ{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="histogram3d",this.seriesType=cB.bar3d}}sZ.type="histogram3d",sZ.seriesType=cB.bar3d,sZ.transformerConstructor=eZ;class nZ extends Hq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class rZ extends pW{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="circularProgress",this.seriesType=cB.circularProgress,this._canStack=!0}}rZ.type="circularProgress",rZ.seriesType=cB.circularProgress,rZ.transformerConstructor=nZ;class aZ extends Hq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:cB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===cB.gauge||t.type===cB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===cB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class oZ extends pW{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="gauge",this.seriesType=cB.gaugePointer}}oZ.type="gauge",oZ.seriesType=cB.gaugePointer,oZ.transformerConstructor=aZ;class lZ extends mW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class hZ extends pW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}hZ.transformerConstructor=lZ;class cZ extends lZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class dZ extends hZ{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}dZ.type="wordCloud",dZ.seriesType=cB.wordCloud,dZ.transformerConstructor=cZ;class uZ extends lZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class pZ extends hZ{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="wordCloud3d",this.seriesType=cB.wordCloud3d}}pZ.type="wordCloud3d",pZ.seriesType=cB.wordCloud3d,pZ.transformerConstructor=uZ;class gZ extends mW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mZ extends pW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="funnel",this.seriesType=cB.funnel}}mZ.type="funnel",mZ.seriesType=cB.funnel,mZ.transformerConstructor=gZ;class fZ extends pW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="funnel3d",this.seriesType=cB.funnel3d}}fZ.type="funnel3d",fZ.seriesType=cB.funnel3d,fZ.transformerConstructor=gZ;class vZ extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=IN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=IN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class _Z extends pW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="linearProgress",this.seriesType=cB.linearProgress,this._canStack=!0}}_Z.type="linearProgress",_Z.seriesType=cB.linearProgress,_Z.transformerConstructor=vZ;class yZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),hH(t)}}class bZ extends pW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="rangeColumn",this.seriesType=cB.rangeColumn}}bZ.type="rangeColumn",bZ.seriesType=cB.rangeColumn,bZ.transformerConstructor=yZ;class xZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class SZ extends pW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="rangeColumn3d",this.seriesType=cB.rangeColumn3d}}SZ.type="rangeColumn3d",SZ.seriesType=cB.rangeColumn3d,SZ.transformerConstructor=xZ;class AZ extends mW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:BB,i=p(t.endAngle)?t.endAngle:e+ee(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=cB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class kZ extends pW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="sunburst",this.seriesType=cB.sunburst}}kZ.type="sunburst",kZ.seriesType=cB.sunburst,kZ.transformerConstructor=AZ;class MZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=cB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class TZ extends pW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="circlePacking",this.seriesType=cB.circlePacking}}TZ.type="circlePacking",TZ.seriesType=cB.circlePacking,TZ.transformerConstructor=MZ;class wZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CZ extends pW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="treemap",this.seriesType=cB.treemap}}CZ.type="treemap",CZ.seriesType=cB.treemap,CZ.transformerConstructor=wZ;class EZ extends HW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),hH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class PZ extends NW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="waterfall",this.seriesType=cB.waterfall}}PZ.type="waterfall",PZ.seriesType=cB.waterfall,PZ.transformerConstructor=EZ;class BZ extends fW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),hH(t)}}class RZ extends pW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="boxPlot",this.seriesType=cB.boxPlot}}RZ.type="boxPlot",RZ.seriesType=cB.boxPlot,RZ.transformerConstructor=BZ;class LZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends pW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="sankey",this.seriesType=cB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}OZ.type="sankey",OZ.seriesType=cB.sankey,OZ.transformerConstructor=LZ;class IZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),hH(t)}}class DZ extends pW{constructor(){super(...arguments),this.transformerConstructor=IZ,this.type="rangeArea",this.seriesType=cB.rangeArea}}DZ.type="rangeArea",DZ.seriesType=cB.rangeArea,DZ.transformerConstructor=IZ;class FZ extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class jZ extends pW{constructor(){super(...arguments),this.transformerConstructor=FZ,this.type="heatmap",this.seriesType=cB.heatmap}}jZ.type="heatmap",jZ.seriesType=cB.heatmap,jZ.transformerConstructor=FZ;class zZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=cB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HZ extends pW{constructor(){super(...arguments),this.transformerConstructor=zZ,this.type="correlation",this.seriesType=cB.correlation}}HZ.type="correlation",HZ.seriesType=cB.correlation,HZ.transformerConstructor=zZ;function NZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=gz(t.style)),B(t.textStyle)||Bj(s.textStyle,gz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&gz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&gz(s.background.style),s}const VZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},GZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:AD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class WZ extends GG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=qF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VH(this._option,e),this._initSelectedData(),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(aB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Bj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}WZ.specKey="legends";class UZ extends WZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Vz(this._option.dataSet,"discreteLegendFilter",GZ),Vz(this._option.dataSet,"discreteLegendDataMake",VZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return aB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=ez(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=NZ(s)),B(n.focusIconStyle)||gz(n.focusIconStyle),n.shape&&(n.shape=dz(n.shape)),n.label&&(n.label=dz(n.label)),n.value&&(n.value=dz(n.value)),n.background&&(n.background=dz(n.background)),ZF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),ZF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),ZF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||gz(r.railStyle),B(r.sliderStyle)||gz(r.sliderStyle)):(B(r.textStyle)||gz(r.textStyle),r.handler&&dz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Bj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return mP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(lP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(lP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(lP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=RN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=RN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}UZ.specKey="legends",UZ.type=r.discreteLegend;const YZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},KZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?cz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function XZ(t){return"color"===t||"size"===t}const $Z={color:bP,size:SP},qZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],ZZ=[2,10];class JZ extends WZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return XZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{XZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Vz(this._option.dataSet,"continuousLegendFilter",KZ),Vz(this._option.dataSet,"continuousLegendDataMake",YZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=ez(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=ez(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?qZ:ZZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Bj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=NZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=gz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=gz(r.style)),B(a.style)||(w.trackStyle=gz(a.style)),w.startText=dz(o),w.endText=dz(l),w.handlerText=dz(h),B(c)||(w.sizeBackground=gz(c)),d.visible&&!B(d.style)&&(Bj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return $Z[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}JZ.specKey="legends",JZ.type=r.continuousLegend;class QZ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Rz(n,a,!0))&&void 0!==e?e:[],...null!==(i=bz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Nw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=hV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=hV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(_V(s).every((t=>{var e;return!hV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=hV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=fV(t,i,s),m=vV(t,i,s),f=Bj({},I(e[t]),m),v=g.title,_=bV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=gV(f.title,Object.assign(Object.assign({},v),_)):f.title=gV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=yV(y);f.content=mV(f.content,(e=>bV(e,f,u.shape,t)))}else f.content=mV(y,(t=>bV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=wV(a,t,e),l=!!p(o)&&!1!==SV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class tJ extends QZ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class eJ extends QZ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class iJ extends QZ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const sJ=t=>p(t)&&!y(t),nJ=t=>p(t)&&y(t);class rJ extends VG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Bj({},this._theme,s.style),s.offset=Bj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=hV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}class aJ extends GG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=rJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&sJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&nJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&lN.globalConfig.uniqueTooltip&&l&&lN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?AV.canvas:AV.dom,n=mz.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new eJ(this),dimension:new tJ(this),group:new iJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(nb(i)||rb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=oV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(nJ(t)){if(sJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>fz(t,e[i])))))return!1}else{if(nJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&si(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}aJ.type=r.tooltip,aJ.transformerConstructor=rJ,aJ.specKey="tooltip";var oJ,lJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(oJ||(oJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(lJ||(lJ={}));const hJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class cJ extends GG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{hJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){xz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Sz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=lB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=WN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=KN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=XN(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}dJ.specKey="crosshair",dJ.type=r.cartesianCrosshair;class uJ extends cJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:qt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=lB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Bj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=ON(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=ON(s.getSpec())),c.angle=a.angle,c.axis=s,Bj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=RN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=RN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:se(o,s,i),end:se(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},se(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ne(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=se(t,r,p),f=se(t,r,g),v=Re([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(qt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},se(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}uJ.specKey="crosshair",uJ.type=r.polarCrosshair;const pJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},gJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class mJ extends GG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Lt(s/n)>=.5:Lt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=kz(t),this._isHorizontal="horizontal"===Mz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(zw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};aB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=zw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else aB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Gz(s,"dataview",ga),Vz(s,"dataFilterComputeDomain",gJ);const n=new ya(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(zw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&zw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,zw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new lC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Vz(this._option.dataSet,"dataFilterWithNewDomain",pJ),aB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>zw(this._stateScale.type)},level:tH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Nw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Nw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(mJ,MU);class fJ extends VG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Bj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class vJ extends mJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=fJ,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new EC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!zw(t.type)||e[0]!==e[1])&&(!Nw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new lE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:gz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:gz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:gz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:gz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:gz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:gz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:gz(g.style)},selectedBackgroundStyle:gz(this._spec.selectedBackground.style),dragMaskStyle:gz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Bj(gz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Bj(gz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=RN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}vJ.type=r.dataZoom,vJ.transformerConstructor=fJ,vJ.specKey="dataZoom";class _J extends mJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=JP(this._start,e)&&JP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=gz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=gz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}_J.type=r.scrollBar,_J.specKey="scrollBar";const yJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class bJ extends GG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==bJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Vz(this._option.dataSet,"indicatorFilter",yJ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Bj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},pz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?ij(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ij(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},pz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new MP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}bJ.type=r.indicator,bJ.specKey="indicator";const xJ=["sum","average","min","max","variance","standardDeviation","median"];function SJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function AJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&SJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=ZF(t.x)?wJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function kJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&SJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=ZF(t.y)?wJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function MJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&SJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function TJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&SJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function wJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function CJ(t){return xJ.includes(t)}function EJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=AJ(t,m,n,d,h,a),i=kJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=AJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=kJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function PJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=MJ(t,l,n,r),i=TJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=MJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=TJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function BJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=ZF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=ZF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&SJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&SJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function RJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&SJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&SJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function LJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=wJ(e,r)),e+=s,ZF(i)&&(i=wJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=wJ(e,s)),ZF(i)&&(i=wJ(i,n)),{x:e,y:i}}))}function OJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function IJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},gz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},FJ(gz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=FJ(gz(n),i)),t}return{visible:!1}}function DJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function FJ(t,e){return d(t)?t(e):t}function jJ(t,e){return d(t)?t(e):t}function zJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function HJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function NJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function VJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function GJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>UJ(i,t,e))):s.x=UJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>UJ(i,t,e))):s.y=UJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>UJ(i,t,e))):s.angle=UJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>UJ(i,t,e))):s.radius=UJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=UJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const WJ={min:(t,e)=>QP(t[0].latestData,e.field),max:(t,e)=>tB(t[0].latestData,e.field),sum:function(t,e){return eB(t[0].latestData,e.field)},average:function(t,e){return iB(t[0].latestData,e.field)},variance:function(t,e){return sB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(sB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function UJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return WJ[i](e,{field:s})}return t}class YJ extends GG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&CJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&CJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&CJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&CJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&CJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new va;return e.registerParser("array",s),new ya(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=lB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=JF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=JF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function KJ(t,e){return function(t,e,i){const{predict:s}=Sb(t,(t=>t[e]),(t=>t[i])),n=QP(t,e),r=tB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function XJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class $J extends YJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=HJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:FJ(gz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:IJ(y,this._markerData),state:{line:DJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:DJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:DJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:DJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:DJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:gz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:gz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=HJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerRegression",KJ),Vz(this._option.dataSet,"markerFilter",XJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ya(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}$J.specKey="markLine";class qJ extends $J{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=HJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=EJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=BJ(i,r,d,e.coordinatesOffset):c&&(y=LJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(ZF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=HJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}qJ.type=r.markLine,qJ.coordinateType="cartesian";class ZJ extends $J{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=HJ(this._spec);return e||i?new ZE(t):new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=HJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=PJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>se(m,t.radius,t.angle)))}}else u&&(p=RJ(i,r,a),g={points:p.map((t=>se(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=HJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}ZJ.type=r.polarMarkLine,ZJ.coordinateType="polar";class JJ extends GG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=qF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new AP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}JJ.type=r.title,JJ.specKey=r.title;class QJ extends YJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=NJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:FJ(gz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:IJ(u,this._markerData),state:{area:DJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:DJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:DJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=NJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerFilter",XJ);const c=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}QJ.specKey="markArea";class tQ extends QJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=NJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=EJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=EJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=BJ(i,r,d,e.coordinatesOffset):c&&(u=LJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=NJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}tQ.type=r.markArea,tQ.coordinateType="cartesian";class eQ extends QJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=NJ(this._spec);return i||e||s?new JE(t):new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=NJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=PJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=RJ(i,r,c),u={points:d.map((t=>se(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=NJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}eQ.type=r.polarMarkArea,eQ.coordinateType="polar";const iQ=t=>gz(Object.assign({},t)),sQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},gz(t.style))}),nQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=iQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=iQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},gz(Object.assign({},y)));var y;const b=sQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=sQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=sQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=sQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},rQ=t=>"left"===t||"right"===t,aQ=t=>"top"===t||"bottom"===t;class oQ extends GG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},nQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},nQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new zP(t):this._playerComponent=new VP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=rQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=rQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=rQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=aQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):rQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):aQ(this._orient)?this._maxSize():t.height}_computeDx(t){return rQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return aQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}oQ.specKey="player",oQ.type=r.player;class lQ extends GG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}lQ.type=r.label;class hQ extends cY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}hQ.type="text",hQ.constructorType="label";const cQ=()=>{mz.registerMark(hQ.constructorType,hQ),xO()};class dQ extends VG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class uQ extends lQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=dQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),aB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Bj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=UU[t])&&void 0!==i?i:UU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:YU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}uQ.type=r.label,uQ.specKey="label",uQ.transformerConstructor=dQ;class pQ extends lQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[LD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Bj({textStyle:{pickable:!0===this._spec.interactive},position:gQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[ID]))},a))}})).encode((e=>YU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function gQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}pQ.type=r.totalLabel,pQ.specKey="totalLabel";class mQ extends YJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=VJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:jJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:jJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:FJ(B.style,this._markerData)},state:{line:DJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:DJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:DJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:DJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:DJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:DJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:DJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:DJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:DJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:DJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=gz(FJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=FJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=IJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=FJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:gz(z.style)}):{visible:!1};return new tP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:zJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:zJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=VJ(t);if(!(p(t.coordinate)||e||i||s))return;Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerFilter",XJ);const{options:n}=this._computeOptions(),r=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}mQ.specKey="markPoint";class fQ extends mQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=EJ(i,s,s,s,o)[0][0]:r?l=BJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=LJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=VJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}fQ.type=r.markPoint,fQ.coordinateType="cartesian";class vQ extends mQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=PJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:se({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}vQ.type=r.polarMarkPoint,vQ.coordinateType="polar";class _Q extends mQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}_Q.type=r.geoMarkPoint,_Q.coordinateType="geo";const yQ="inBrush",bQ="outOfBrush";class xQ extends GG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),yQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),bQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new YP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:gz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(HP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,bQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(HP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(HP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},gz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(yQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(yQ),i.addState(bQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(yQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(yQ),i.addState(bQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ze(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ze(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(yQ),i.removeState(bQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}xQ.type=r.brush,xQ.specKey="brush";class SQ extends GG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${uB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Jt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Jt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}SQ.type=r.customMark,SQ.specKey="customMark";function AQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function kQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function MQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:kQ(t.rect),anchorCandidates:BQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>AQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tAQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function TQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Ue(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=EQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ci(r,s,i);if(!EQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],wQ(CQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=wQ(CQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=PQ(t.rect,a,0),t}));return MQ(h)}function wQ(t){return t>180?t-360:t}function CQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function EQ(t,e){for(let i=0;i{const{x:r,y:a}=PQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class RQ extends GG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ya(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:tH.copyDataView},!1),this._data=new VH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new tP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=tj(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Cu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Pg(gz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=kg(gz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=yp(gz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=yp(gz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=PQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:gz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):MQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}RQ.type=r.mapLabel,RQ.specKey="mapLabel";class LQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>OQ(t))),a=n.filter((t=>!OQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>OQ(t))),h=o.filter((t=>!OQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function OQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}LQ.type="grid";lN.useRegisters([()=>{rI(),aI(),OG(),FG(),iN(),QH(),rW(),iW(),mz.registerSeries(hW.type,hW),mz.registerChart(_W.type,_W)},()=>{rI(),aI(),OG(),bW(),FG(),SW(),rW(),iW(),mz.registerSeries(kW.type,kW),mz.registerChart(TW.type,TW)},()=>{zW(),mz.registerChart(NW.type,NW)},()=>{tU(),mz.registerChart(iU.type,iU)},()=>{zY(),mz.registerChart(Wq.type,Wq)},()=>{nK(),mz.registerChart(Xq.type,Xq)},()=>{uK(),mz.registerChart(qq.type,qq)},()=>{zW(),mz.registerChart(iZ.type,iZ)},()=>{BU(),mz.registerChart(jq.type,jq)},()=>{hq(),mz.registerSeries(dq.type,dq),IY(),AK(),tK(),mz.registerChart(oZ.type,oZ)},()=>{uX(),mz.registerChart(dZ.type,dZ)},()=>{RX(),mz.registerChart(mZ.type,mZ)},()=>{iY(),mz.registerChart(PZ.type,PZ)},()=>{lY(),FG(),QH(),rW(),iW(),mz.registerSeries(hY.type,hY),mz.registerChart(RZ.type,RZ)},()=>{mz.registerSeries(MK.type,MK),IY(),AK(),tN(),iK(),tK(),mz.registerChart(rZ.type,rZ)},()=>{RK(),mz.registerChart(_Z.type,_Z)},()=>{bY(),mz.registerChart(bZ.type,bZ)},()=>{bW(),rW(),iW(),mz.registerSeries(AY.type,AY),mz.registerChart(DZ.type,DZ)},()=>{M$(),mz.registerChart(kZ.type,kZ)},()=>{P$(),mz.registerChart(TZ.type,TZ)},()=>{nq(),mz.registerChart(CZ.type,CZ)},()=>{J$(),mz.registerChart(OZ.type,OZ)},()=>{_q(),mz.registerChart(jZ.type,jZ)},()=>{Cq(),mz.registerChart(HZ.type,HZ)},()=>{mz.registerChart(Jq.type,Jq)},iW,rW,()=>{XG(),mz.registerComponent(aW.type,aW)},()=>{XG(),mz.registerComponent(oW.type,oW)},()=>{XG(),mz.registerComponent(lW.type,lW)},iK,tK,()=>{mz.registerComponent(UZ.type,UZ)},()=>{mz.registerComponent(JZ.type,JZ)},()=>{mz.registerComponent(aJ.type,aJ)},()=>{mz.registerComponent(dJ.type,dJ)},()=>{mz.registerComponent(uJ.type,uJ)},()=>{mz.registerComponent(vJ.type,vJ)},()=>{mz.registerComponent(_J.type,_J)},()=>{mz.registerComponent(bJ.type,bJ)},CU,()=>{mz.registerComponent(qJ.type,qJ),KE()},()=>{mz.registerComponent(tQ.type,tQ),$E()},()=>{mz.registerComponent(fQ.type,fQ),QE()},()=>{mz.registerComponent(ZJ.type,ZJ),ZE._animate=EE,KE()},()=>{mz.registerComponent(eQ.type,eQ),JE._animate=BE,$E()},()=>{mz.registerComponent(vQ.type,vQ),QE()},()=>{mz.registerComponent(_Q.type,_Q),QE()},()=>{mz.registerComponent(JJ.type,JJ)},()=>{mz.registerComponent(oQ.type,oQ)},()=>{GO(),cQ(),UG(),mz.registerComponent(uQ.type,uQ,!0)},()=>{GO(),cQ(),UG(),mz.registerComponent(pQ.type,pQ,!0)},()=>{mz.registerComponent(xQ.type,xQ)},()=>{mz.registerComponent(SQ.type,SQ)},()=>{mz.registerComponent(RQ.type,RQ)},()=>{th.load(pT)},()=>{mz.registerLayout(LQ.type,LQ)},eG,_N,$R,XR]),lN.useRegisters([()=>{gA(th)}]),t.ARC_END_ANGLE=kB,t.ARC_K=MB,t.ARC_MIDDLE_ANGLE=TB,t.ARC_QUADRANT=wB,t.ARC_RADIAN=CB,t.ARC_RATIO=SB,t.ARC_START_ANGLE=AB,t.ARC_TRANSFORM_VALUE=xB,t.AxisSyncPlugin=TN,t.BASE_EVENTS=uD,t.CORRELATION_SIZE=yD,t.CORRELATION_X=vD,t.CORRELATION_Y=_D,t.CanvasTooltipHandler=tG,t.DEFAULT_CHART_HEIGHT=gB,t.DEFAULT_CHART_WIDTH=pB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=GD,t.DEFAULT_DATA_INDEX=xD,t.DEFAULT_DATA_KEY=SD,t.DEFAULT_DATA_SERIES_FIELD=AD,t.DEFAULT_GRADIENT_CONFIG=WD,t.DEFAULT_LABEL_ALIGN=fB,t.DEFAULT_LABEL_LIMIT=mB,t.DEFAULT_LABEL_TEXT=vB,t.DEFAULT_LABEL_VISIBLE=_B,t.DEFAULT_LABEL_X=yB,t.DEFAULT_LABEL_Y=bB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=ND,t.DEFAULT_MEASURE_CANVAS_ID=bD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=VD,t.DEFAULT_SERIES_STYLE_NAME=kD,t.DomTooltipHandler=QV,t.Factory=mz,t.FormatterPlugin=vN,t.GradientType=HD,t.MediaQuery=pN,t.POLAR_DEFAULT_RADIUS=RB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=PB,t.POLAR_START_ANGLE=BB,t.POLAR_START_RADIAN=EB,t.PREFIX=uB,t.SEGMENT_FIELD_END=FD,t.SEGMENT_FIELD_START=DD,t.STACK_FIELD_END=CD,t.STACK_FIELD_END_OffsetSilhouette=RD,t.STACK_FIELD_END_PERCENT=PD,t.STACK_FIELD_KEY=TD,t.STACK_FIELD_START=wD,t.STACK_FIELD_START_OffsetSilhouette=BD,t.STACK_FIELD_START_PERCENT=ED,t.STACK_FIELD_TOTAL=LD,t.STACK_FIELD_TOTAL_PERCENT=OD,t.STACK_FIELD_TOTAL_TOP=ID,t.ThemeManager=$j,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=lN,t.WaterfallDefaultSeriesField=fD,t.builtinThemes=jj,t.computeActualDataScheme=jF,t.darkTheme=kj,t.dataScheme=sj,t.default=lN,t.defaultThemeName=zj,t.getActualColor=HF,t.getColorSchemeBySeries=WF,t.getDataScheme=FF,t.getMergedTheme=Kj,t.getTheme=Wj,t.hasThemeMerged=Vj,t.isColorKey=NF,t.isProgressiveDataColorScheme=VF,t.isTokenKey=xj,t.lightTheme=Aj,t.queryColorFromColorScheme=zF,t.queryToken=bj,t.registerCanvasTooltipHandler=eG,t.registerChartPlugin=uN,t.registerDomTooltipHandler=()=>{JV(QV)},t.registerFormatPlugin=_N,t.registerMediaQuery=()=>{uN(pN)},t.registerTheme=Gj,t.removeTheme=Uj,t.themeExist=Yj,t.themes=Hj,t.token=Sj,t.transformColorSchemeToStandardStruct=GF,t.version="1.11.11",t.vglobal=O_,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(Mt.source,"g");function wt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Lt=Math.abs,Ot=Math.atan2,It=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Vt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Yt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Kt(t,e){return Ut(t+e,10**Math.max(Yt(t),Yt(e)))}function Xt(t,e){return Ut(t-e,10**Math.max(Yt(t),Yt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class qt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Zt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Jt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Jt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Qt extends Jt{}function te(t){return t*(Math.PI/180)}function ee(t){return 180*t/Math.PI}const ie=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function se(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ne(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function re(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ae(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=re(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new oe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new oe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new oe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ee(r.rotateDeg),r}}class le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function he(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ce(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const de=/^#([0-9a-f]{3,8})$/,ue={transparent:4294967040},pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return S(t)?new ye(t>>16,t>>8&255,255&t,1):y(t)?new ye(t[0],t[1],t[2]):new ye(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ve(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class _e{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof _e?t:new _e(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(ue[t]))return function(t){return S(t)?new ye(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ye(t[0],t[1],t[2],t[3]):new ye(255,255,255,1)}(ue[t]);if(p(pe[t]))return me(pe[t]);const e=`${t}`.trim().toLowerCase(),i=de.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ye((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=he(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ye(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=_e.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ye(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=ce(this.color.r,this.color.g,this.color.b),r=he(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ye(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=de.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new ye((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?me(s):8===n?new ye(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=pe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _e(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ve(t.color.r),this.color.g=ve(t.color.g),this.color.b=ve(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ye{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${ge(this.r)+ge(this.g)+ge(this.b)+(1===this.opacity?"":ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ye(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ce});function Se(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ae,ke,Me,Te,we,Ce,Ee,Pe;function Be(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Le(t,e,i){return null===t?e:null===e?t:(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,i&&(Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>=Ce||ke<=we||Me>=Pe||Te<=Ee?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ae,we),y1:Math.max(Me,Ee),x2:Math.min(ke,Ce),y2:Math.min(Te,Pe)})}var Oe;function Ie(t,e,i){return!(t&&e&&(i?(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee]),Ae>Ce||kePe||Tee.x2||t.x2e.y2||t.y2ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),t.x>=Ae&&t.x<=ke&&t.y>=Me&&t.y<=Te):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Fe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function je(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function ze(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function He(t,e){const i=e?t.angle:te(t.angle),s=ze(t);return[je({x:t.x1,y:t.y1},i,s),je({x:t.x2,y:t.y1},i,s),je({x:t.x2,y:t.y2},i,s),je({x:t.x1,y:t.y2},i,s)]}let Ne,Ve,Ge,We;function Ue(t){return Ne=1/0,Ve=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ne>t.x&&(Ne=t.x),Get.y&&(Ve=t.y),Wee&&r>s||rn?o:0}function qe(t,e){return Math.abs(t-e)0&&Ke(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Je=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";const ti=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ei(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ii(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function si(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const ni=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ri=6371008.8,ai={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ri,kilometers:6371.0088,kilometres:6371.0088,meters:ri,metres:ri,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ri/1852,radians:1,yards:6967335.223679999};function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function hi(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===De(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ci(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=te(t[0]),r=te(t[1]),a=te(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ai[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:ee(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:ee(l)}}class di{static getInstance(){return di.instance||(di.instance=new di),di.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let pi;function gi(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class mi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vi(t){let e;if(e=fi.exec(t))return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const _i=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class yi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}newFormat(t){const e=vi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):bi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=bi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?_i[8+pi/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=vi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=ui(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=_i[8+n/3];return function(t){return s(r*t)+a}}}const bi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gi(100*t,e),r:gi,s:function(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(pi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+ui(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function xi(){return new Si}function Si(){this.reset()}Si.prototype={constructor:Si,reset:function(){this.s=this.t=0},add:function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},valueOf:function(){return this.s}};var Ai=new Si;function ki(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Mi=1e-6,Ti=Math.PI,wi=Ti/2,Ci=Ti/4,Ei=2*Ti,Pi=180/Ti,Bi=Ti/180,Ri=Math.abs,Li=Math.atan,Oi=Math.atan2,Ii=Math.cos,Di=Math.exp,Fi=Math.log,ji=Math.pow,zi=Math.sin,Hi=Math.sign||function(t){return t>0?1:t<0?-1:0},Ni=Math.sqrt,Vi=Math.tan;function Gi(t){return t>1?0:t<-1?Ti:Math.acos(t)}function Wi(t){return t>1?wi:t<-1?-wi:Math.asin(t)}function Ui(){}function Yi(t,e){t&&Xi.hasOwnProperty(t.type)&&Xi[t.type](t,e)}var Ki={Feature:function(t,e){Yi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sTi?t+Math.round(-t/Ei)*Ei:t,e]}function os(t,e,i){return(t%=Ei)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Ti?e-Ei:e<-Ti?e+Ei:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Ii(t),s=zi(t),n=Ii(e),r=zi(e);function a(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*i+o*s;return[Oi(l*n-c*r,o*i-h*s),Wi(c*n+l*r)]}return a.invert=function(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*n-l*r;return[Oi(l*n+h*r,o*i+c*s),Wi(c*i-o*s)]},a}function ds(t,e){(e=Qi(e))[0]-=t,ns(e);var i=Gi(-e[1]);return((-e[2]<0?-i:i)+Ei-Mi)%Ei}function us(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ui,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return Ri(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function fs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ss(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function As(t,e,i,s){return function(n){var r,a,o,l=e(n),h=us(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=Ss(a);var t=function(t,e){var i=bs(e),s=e[1],n=zi(s),r=[zi(i),-Ii(i),0],a=0,o=0;ys.reset(),1===n?s=wi+Mi:-1===n&&(s=-wi-Mi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Ti,w=m*x;if(ys.add(Oi(w*k*zi(M),f*S+w*Ii(M))),a+=T?A+k*Ei:A,T^p>=i^y>=i){var C=es(Qi(u),Qi(_));ns(C);var E=es(r,C);ns(E);var P=(T^A>=0?-1:1)*Wi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Mi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ks))}return u}}function ks(t){return t.length>1}function Ms(t,e){return((t=t.x)[0]<0?t[1]-wi-Mi:wi-t[1])-((e=e.x)[0]<0?e[1]-wi-Mi:wi-e[1])}1===(vs=xs).length&&(_s=vs,vs=function(t,e){return xs(_s(t),e)});var Ts=As((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ti:-Ti,l=Ri(r-i);Ri(l-Ti)0?wi:-wi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ti&&(Ri(i-n)Mi?Li((zi(e)*(r=Ii(s))*zi(i)-zi(s)*(n=Ii(e))*zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*wi,s.point(-Ti,n),s.point(0,n),s.point(Ti,n),s.point(Ti,0),s.point(Ti,-n),s.point(0,-n),s.point(-Ti,-n),s.point(-Ti,0),s.point(-Ti,n);else if(Ri(t[0]-e[0])>Mi){var r=t[0]0,n=Ri(e)>Mi;function r(t,i){return Ii(t)*Ii(i)>e}function a(t,i,s){var n=[1,0,0],r=es(Qi(t),Qi(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=es(n,r),u=ss(n,h);is(u,ss(r,c));var p=d,g=ts(u,p),m=ts(p,p),f=g*g-m*(ts(u,u)-1);if(!(f<0)){var v=Ni(f),_=ss(p,(-g-v)/m);if(is(_,u),_=Ji(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ri(_[0]-b)Ti^(b<=_[0]&&_[0]<=x)){var T=ss(p,(-g+v)/m);return is(T,u),[_,Ji(T)]}}}function o(e,i){var n=s?t:Ti-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return As(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Ti:-Ti),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ps(e,p)||ps(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Ii(e),o=zi(e),l=s*i;null==n?(n=e+s*Ei,r=e-l/2):(n=ds(a,n),r=ds(a,r),(s>0?nr)&&(n+=s*Ei));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ri(s[0]-t)0?0:3:Ri(s[0]-i)0?2:1:Ri(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=us(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Ss(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ms(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Es,Math.min(Cs,g)),m=Math.max(Es,Math.min(Cs,m))],b=[r=Math.max(Es,Math.min(Cs,r)),a=Math.max(Es,Math.min(Cs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Bs(t){return t}var Rs,Ls,Os,Is,Ds=xi(),Fs=xi(),js={point:Ui,lineStart:Ui,lineEnd:Ui,polygonStart:function(){js.lineStart=zs,js.lineEnd=Vs},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=Ui,Ds.add(Ri(Fs)),Fs.reset()},result:function(){var t=Ds/2;return Ds.reset(),t}};function zs(){js.point=Hs}function Hs(t,e){js.point=Ns,Rs=Os=t,Ls=Is=e}function Ns(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Vs(){Ns(Rs,Ls)}var Gs=js,Ws=1/0,Us=Ws,Ys=-Ws,Ks=Ys;var Xs,$s,qs,Zs,Js={point:function(t,e){tYs&&(Ys=t);eKs&&(Ks=e)},lineStart:Ui,lineEnd:Ui,polygonStart:Ui,polygonEnd:Ui,result:function(){var t=[[Ws,Us],[Ys,Ks]];return Ys=Ks=-(Us=Ws=1/0),t}},Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln=0,hn={point:cn,lineStart:dn,lineEnd:gn,polygonStart:function(){hn.lineStart=mn,hn.lineEnd=fn},polygonEnd:function(){hn.point=cn,hn.lineStart=dn,hn.lineEnd=gn},result:function(){var t=ln?[an/ln,on/ln]:rn?[sn/rn,nn/rn]:en?[Qs/en,tn/en]:[NaN,NaN];return Qs=tn=en=sn=nn=rn=an=on=ln=0,t}};function cn(t,e){Qs+=t,tn+=e,++en}function dn(){hn.point=un}function un(t,e){hn.point=pn,cn(qs=t,Zs=e)}function pn(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,cn(qs=t,Zs=e)}function gn(){hn.point=cn}function mn(){hn.point=vn}function fn(){_n(Xs,$s)}function vn(t,e){hn.point=_n,cn(Xs=qs=t,$s=Zs=e)}function _n(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,an+=(n=Zs*t-qs*e)*(qs+t),on+=n*(Zs+e),ln+=3*n,cn(qs=t,Zs=e)}var yn=hn;function bn(t){this._context=t}bn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ei)}},result:Ui};var xn,Sn,An,kn,Mn,Tn=xi(),wn={point:Ui,lineStart:function(){wn.point=Cn},lineEnd:function(){xn&&En(Sn,An),wn.point=Ui},polygonStart:function(){xn=!0},polygonEnd:function(){xn=null},result:function(){var t=+Tn;return Tn.reset(),t}};function Cn(t,e){wn.point=En,Sn=kn=t,An=Mn=e}function En(t,e){kn-=t,Mn-=e,Tn.add(Ni(kn*kn+Mn*Mn)),kn=t,Mn=e}var Pn=wn;function Bn(){this._string=[]}function Rn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ln(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Zi(t,i(s))),s.result()}return r.area=function(t){return Zi(t,i(Gs)),Gs.result()},r.measure=function(t){return Zi(t,i(Pn)),Pn.result()},r.bounds=function(t){return Zi(t,i(Js)),Js.result()},r.centroid=function(t){return Zi(t,i(yn)),yn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Bs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Bn):new bn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function On(t){return function(e){var i=new In;for(var s in t)i[s]=t[s];return i.stream=e,i}}function In(){}function Dn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Zi(i,t.stream(Js)),e(Js.result()),null!=s&&t.clipExtent(s),t}function Fn(t,e,i){return Dn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function jn(t,e,i){return Fn(t,[[0,0],e],i)}function zn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Hn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Bn.prototype={_radius:4.5,_circle:Rn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Rn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},In.prototype={constructor:In,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Nn=16,Vn=Ii(30*Bi);function Gn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Ni(b*b+x*x+S*S),k=Wi(S/=A),M=Ri(Ri(S)-1)e||Ri((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Bi:0,E()):[f*Pi,v*Pi,_*Pi]},w.angle=function(t){return arguments.length?(y=t%360*Bi,E()):y*Pi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Gn(o,T=t*t),P()):Ni(T)},w.fitExtent=function(t,e){return Fn(w,t,e)},w.fitSize=function(t,e){return jn(w,t,e)},w.fitWidth=function(t,e){return zn(w,t,e)},w.fitHeight=function(t,e){return Hn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function $n(t){var e=0,i=Ti/3,s=Xn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Bi,i=t[1]*Bi):[e*Pi,i*Pi]},n}function qn(t,e){var i=zi(t),s=(i+zi(e))/2;if(Ri(s)2?t[2]*Bi:0),e.invert=function(e){return(e=t.invert(e[0]*Bi,e[1]*Bi))[0]*=Pi,e[1]*=Pi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===sr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function rr(t){return Vi((wi+t)/2)}function ar(t,e){var i=Ii(t),s=t===e?zi(t):Fi(i/Ii(e))/Fi(rr(e)/rr(t)),n=i*ji(rr(t),s)/s;if(!s)return sr;function r(t,e){n>0?e<-wi+Mi&&(e=-wi+Mi):e>wi-Mi&&(e=wi-Mi);var i=n/ji(rr(e),s);return[i*zi(s*t),n-i*Ii(s*t)]}return r.invert=function(t,e){var i=n-e,r=Hi(s)*Ni(t*t+i*i),a=Oi(t,Ri(i))*Hi(i);return i*s<0&&(a-=Ti*Hi(t)*Hi(i)),[a/s,2*Li(ji(n/r,1/s))-wi]},r}function or(t,e){return[t,e]}function lr(t,e){var i=Ii(t),s=t===e?zi(t):(i-Ii(e))/(e-t),n=i/s+t;if(Ri(s)Mi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},vr.invert=tr(Wi),_r.invert=tr((function(t){return 2*Li(t)})),yr.invert=function(t,e){return[-e,2*Li(Di(t))-wi]};var Sr={exports:{}},Ar=function(t,e){this.p1=t,this.p2=e};Ar.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ar.prototype.run=function(){return this.p2[0]-this.p1[0]},Ar.prototype.slope=function(){return this.rise()/this.run()},Ar.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ar.prototype.isVertical=function(){return!isFinite(this.slope())},Ar.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ar.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ar.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ar.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ar.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var kr=Ar,Mr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new kr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Mr(t.slice(0,s),e),o=Mr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Tr=Mr;!function(t){var e=Tr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Cr(Br,e),{tolerance:s}=i;return wr(t,s)};var Lr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Lr||(Lr={}));const Or=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+zr(e,6):zr(e,4))+"-"+zr(t.getUTCMonth()+1,2)+"-"+zr(t.getUTCDate(),2)+(r?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"."+zr(r,3)+"Z":n?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"Z":s||i?"T"+zr(i,2)+":"+zr(s,2)+"Z":"")}function Nr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Dr;if(h)return h=!1,Ir;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.DSV;const i=Cr(Wr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Nr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Vr(t)},Kr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Gr(t)};function Xr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return $r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return $r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zr(t);default:throw new Error("unknown GeoJSON type")}}function $r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qr(t.properties),e.geometry=Zr(t.geometry),e}function qr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=qr(s):e[i]=s})),e):e}function Zr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Zr(t)})),e):(e.coordinates=Jr(t.coordinates),e)}function Jr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Jr(t)}))}function Qr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ta(t){for(var e,i,s=Qr(t),n=0,r=1;r0}function ea(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Xr(t));var r=[];switch(t.type){case"GeometryCollection":return ia(t,(function(t){na(t,s)})),t;case"FeatureCollection":return ea(t,(function(t){ea(na(t,s),(function(t){r.push(t)}))})),li(r)}return na(t,s)}function na(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ia(t,(function(t){na(t,e)})),t;case"LineString":return ra(Qr(t),e),t;case"Polygon":return aa(Qr(t),e),t;case"MultiLineString":return Qr(t).forEach((function(t){ra(t,e)})),t;case"MultiPolygon":return Qr(t).forEach((function(t){aa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ra(t,e){ta(t)===e&&t.reverse()}function aa(t,e){ta(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=oa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},da=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.GEO;const i=Cr(ha,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ca(t))})):e.push(ca(t))})),e})(t);let o=t.features;return a&&(o=sa(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=la.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=la.bounds(t);t.bbox=e}})),t.features=o,t},ua={},pa=(t,e,i)=>{i.type=Lr.GEO;const s=Cr(ha,ua,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return xr(a,t)}))}:xr(a,o));var a,o;return da(r,s,i)},ga=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ma=0;function fa(){return ma>1e8&&(ma=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ma++}class va{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:fa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const _a="_data-view-diff-rank";class ya{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:fa("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[_a]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[_a]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[_a]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Or),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ba{static GenAutoIncrementId(){return ba.auto_increment_id++}}ba.auto_increment_id=0;class xa{constructor(t){this.id=ba.GenAutoIncrementId(),this.registry=t}}const Sa="named",Aa="inject",ka="multi_inject",Ma="inversify:tagged",Ta="inversify:paramtypes";class wa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Sa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ca=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ea(e,0,s,t)}}function Ba(t){return e=>(i,s,n)=>Pa(new wa(t,e))(i,s,n)}const Ra=Ba(Aa),La=Ba(ka);function Oa(){return function(t){return Ca.defineMetadata(Ta,null,t),t}}function Ia(t){return Pa(new wa(Sa,t))}const Da="Singleton",Fa="Transient",ja="ConstantValue",za="DynamicValue",Ha="Factory",Na="Function",Va="Instance",Ga="Invalid";class Wa{constructor(t,e){this.id=ba.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ga,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wa(this.serviceIdentifier,this.scope);return t.activated=t.scope===Da&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ua{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ca.getMetadata(Ta,t),userGeneratedMetadata:Ca.getMetadata(Ma,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ya=(Ka=Sa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ka&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const qa=Symbol("ContributionProvider");class Za{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ja(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).inSingletonScope().whenTargetNamed(e)}class Qa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class to extends Qa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const eo=Symbol.for("EnvContribution"),io=Symbol.for("VGlobal");var so=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},no=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ro=function(t,e){return function(i,s){e(i,s,t)}};let ao=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ba.GenAutoIncrementId(),this.hooks={onSetEnv:new to(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ao=so([Oa(),ro(0,Ra(qa)),ro(0,Ia(eo)),no("design:paramtypes",[Object])],ao);const oo=Bt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,mo,fo,vo,_o,yo;var bo,xo,So,Ao,ko,Mo,To,wo,Co;function Eo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Po(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=te(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Lo(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Go extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Wo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Uo(t,e,i){const s=null!=e?e:Lt(i[i.length-1].x-i[0].x)>Lt(i[i.length-1].y-i[0].y)?To.ROW:To.COLUMN;return"monotoneY"===t?new Go(t,s):new Vo(t,s)}class Yo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ko(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new Yo(n,s),t),n}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("basis",i,t);return function(t,e){Wo(t,e)}(new $o(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneX",i,t);return function(t,e){Wo(t,e)}(new el(n,s),t),n}function nl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneY",i,t);return function(t,e){Wo(t,e)}(new il(n,s),t),n}let rl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function al(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Lt(t[t.length-1].x-t[0].x)>Lt(t[t.length-1].y-t[0].y)?To.ROW:To.COLUMN);return function(t,e){Wo(t,e)}(new rl(r,e,n),t),r}class ol extends Yo{lineEnd(){this.context.closePath()}}function ll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new ol(n,s),t),n}function hl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function cl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Ko(i,n);const o=Uo(t,r,i);return Wo(new e(o,s,a),i),o}}const dl=cl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ul=cl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function pl(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}class gl extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[];Bo(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Lo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===To.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.y-e.p1.y)}if(this.direction===To.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const ml=["l",0,0,0,0,0,0,0];function fl(t,e,i){const s=ml[0]=t[0];if("a"===s||"A"===s)ml[1]=e*t[1],ml[2]=i*t[2],ml[3]=t[3],ml[4]=t[4],ml[5]=t[5],ml[6]=e*t[6],ml[7]=i*t[7];else if("h"===s||"H"===s)ml[1]=e*t[1];else if("v"===s||"V"===s)ml[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Rl=Object.assign(Object.assign({},kl),{points:[],cornerRadius:0,closePath:!0}),Ll=Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ol=Object.assign(Object.assign({},kl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},kl),xl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dl=Object.assign(Object.assign(Object.assign({},kl),xl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kl),{fill:!0,cornerRadius:0}),jl=Object.assign(Object.assign({},Fl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const zl=new class{},Hl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Nl=!0,Vl=!1,Gl=/\w|\(|\)|-/,Wl=/[.?!,;:/,。?!、;:]/,Ul=/\S/;function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=zl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Kl(t,a)),a}function Kl(t,e){let i=e;for(;Gl.test(t[i-1])&&Gl.test(t[i])||Wl.test(t[i]);)if(i--,i<=0)return e;return i}function Xl(t,e){const i=zl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var $l=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Il.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Kl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Kl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=$l([Oa()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Oa()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Fa,this.options=e,this.id=ba.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ua}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Sa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wa(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new $a(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Aa],multiInject:s[ka]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case ja:case Na:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Da&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,zl.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-xh&&txh||t<-xh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Rt)<0&&(t+=Rt),t}function fh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Ah=[-1,-1,-1],kh=[-1,-1];function Mh(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Th(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Ah);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Ah);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ah[0]=-l,Ah[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=Ah[0]+t&&a<=Ah[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=Ah[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=fh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Bh[0]=S,Bh[1]=A,Ph(Bh,Boolean(a[6])),S=Bh[0],A=Bh[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case po.M:u=f,p=v,c=u,d=p;break;case po.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=fh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case po.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=fh(c,d,o,l,s,n),i){if(yh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ch(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case po.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=fh(o,p,o,l,s,n),h+=fh(u,l,u,p,s,n);break;case po.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=fh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new to(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=zl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Oh([Oa(),Ih("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=zl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Lh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:xl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Qe(Object.assign({defaultFontParams:{fontFamily:xl.fontFamily,fontSize:xl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Oa(),Nh(0,Ra(qa)),Nh(0,Ia(Jl)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new oe;let Uh=class{constructor(){this.matrix=new oe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Oa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:Ml,area:Tl,circle:wl,line:Pl,path:Bl,symbol:Ol,text:Il,rect:Ll,polygon:Rl,richtext:Dl,richtextIcon:jl,image:Fl,group:Cl,glyph:El},Kh=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const $h={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Kh.forEach((t=>{this._defaultTheme[t]=Object.create($h[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Kh.forEach((s=>{const n=Object.create($h[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Kh.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ba.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class uc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{static Avaliable(){return!!zl.global.getRequestAnimationFrame()}avaliable(){return gc.Avaliable()}tick(t,e){zl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var mc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(mc||(mc={}));class fc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-fc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*fc.bounceIn(2*t):.5*fc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}fc.quadIn=fc.getPowIn(2),fc.quadOut=fc.getPowOut(2),fc.quadInOut=fc.getPowInOut(2),fc.cubicIn=fc.getPowIn(3),fc.cubicOut=fc.getPowOut(3),fc.cubicInOut=fc.getPowInOut(3),fc.quartIn=fc.getPowIn(4),fc.quartOut=fc.getPowOut(4),fc.quartInOut=fc.getPowInOut(4),fc.quintIn=fc.getPowIn(5),fc.quintOut=fc.getPowOut(5),fc.quintInOut=fc.getPowInOut(5),fc.backIn=fc.getBackIn(1.7),fc.backOut=fc.getBackOut(1.7),fc.backInOut=fc.getBackInOut(1.7),fc.elasticIn=fc.getElasticIn(1,.3),fc.elasticOut=fc.getElasticOut(1,.3),fc.elasticInOut=fc.getElasticInOut(1,.3*1.5);class vc{constructor(){this.id=ba.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ao.END?this.removeAnimate(e):e.status===Ao.RUNNING||e.status===Ao.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ao.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const _c=new vc;class yc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class bc extends yc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let xc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ba.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new Sc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&ko.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:So.ANIMATE_PLAY})}runCb(t){const e=new bc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===Ao.RUNNING&&(this.status=Ao.PAUSED)}resume(){this.status===Ao.PAUSED&&(this.status=Ao.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Sc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ao.RUNNING&&(this.status=Ao.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ao.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};xc.mode=ko.NORMAL,xc.interpolateMap=new Map;class Sc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Ac(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?fc[i]:i,n=this._addStep(e,null,s);return n.type=Mo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?fc[i]:i,r=this._addStep(e,null,n);return r.type=Mo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=Mo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Mo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Ac(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Ac{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Mc="cubicOut",Tc=1e3,wc="quadInOut";var Cc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Cc||(Cc={}));const Ec=[!1,!1,!1,!1],Pc=[0,0,0,0],Bc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Pc[0]=t[0],Pc[2]=t[0],Pc[1]=t[1],Pc[3]=t[1],Pc):t:t:0,Rc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Lc=[1,2,3,0,1,2,3,0];function Oc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Rc[0].x=i,Rc[1].y=i,Rc[2].x=-i,Rc[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(It(t)*i,jt(t)*i),s.add(It(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:zc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}zc.TimeOut=1e3/60;const Hc=new zc,Nc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Vc extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Yt(this.fromNumber),Yt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Gc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Gc||(Gc={}));class Wc extends yc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Ic(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Uc extends yc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:So.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:So.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Yc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=zl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Kc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=zl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Xc extends yc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class $c extends yc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?fc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function qc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Zc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{pt(e,s)&&pt(i,n)||t.push(e,i,s,n,s,n)};function sd(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function nd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function od(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),cd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},dd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Jt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return cd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return cd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);dd(n[0],s,i),dd(n[1],e-s,i)}};var ud;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ud||(ud={}));class pd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ud.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ud.Color1){const e=pd.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=_e.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];pd.store1[t]=e,pd.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=pd.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=_e.parseColorString(t);return n&&(pd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],pd.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===ud.Color1){if(pd.store1[t])return;pd.store1[t]=i,pd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(pd.store255[t])return;pd.store255[t]=i,pd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function gd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function md(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>fd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):fd(t,e,i,s,n)}function fd(t,e,i,s,n){if(!t||!e)return t&&gd(t)||e&&gd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=pd.Get(t,ud.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=pd.Get(e,ud.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:gd(a)})))});return o?md(r,l,i,s,n):md(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),gd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}pd.store255={},pd.store1={};const vd=[0,0,0,0],_d=[0,0,0,0];function yd(t,e,i){return pd.Get(t,ud.Color255,vd),pd.Get(e,ud.Color255,_d),`rgba(${Math.round(vd[0]+(_d[0]-vd[0])*i)},${Math.round(vd[1]+(_d[1]-vd[1])*i)},${Math.round(vd[2]+(_d[2]-vd[2])*i)},${vd[3]+(_d[3]-vd[3])*i})`}const bd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=md(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},xd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?sd(t):[],n=sd(e);i&&s&&(i.fromTransform&&nd(s,i.fromTransform.clone().getInverse()),nd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Ad=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],kd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Ad.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?pd.Get(t[n],ud.Color255):t[n],to:"string"==typeof r?pd.Get(r,ud.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class Md extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;xd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&bd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Td=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Sd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=kd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new Md({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Tc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wc)),c};class wd extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;xd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&bd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Cd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Fc.includes(t))(i)||(e[i]=t[i])})),e},Ed=(t,e,i)=>{const s=Cd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=zl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Pd=(t,e,i)=>{const s=[],n=i?null:Cd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Cd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ad(t.attribute),n=od(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(zl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=od(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=od(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ld(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ld(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(zl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:hd(i)}];const s=[];return dd(i,e,s),s})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return dd(r,e,h),h})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=sd(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(zl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Ed(t,s,e),s};class Rd{static GetImage(t,e){var i;const s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Rd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Rd.cache.set(t,s),s.dataPromise=zl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Rd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Rd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=zl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=zl.global.loadBlob(t):"json"===e&&(i.dataPromise=zl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Rd.isLoading&&Rd.toLoadAueue.length){Rd.isLoading=!0;const t=Rd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Rd.cache.set(i,n),n.dataPromise=zl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()})).catch((t=>{console.error(t),Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()}))}}),0)}static loadImage(t,e){const i=Ld(t,Rd.toLoadAueue);if(-1!==i)return Rd.toLoadAueue[i].marks.push(e),void Rd.loading();Rd.toLoadAueue.push({url:t,marks:[e]}),Rd.loading()}static improveImageLoading(t){const e=Ld(t,Rd.toLoadAueue);if(-1!==e){const t=Rd.toLoadAueue.splice(e,1);Rd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ld(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Qt,this._updateTag=bo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Hd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Hd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Hd.x=n,Hd.y=r;return Hd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new oe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(zl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Mc),c&&this.setAttributes(c,!1,{type:So.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:So.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bo.UPDATE_SHAPE_AND_BOUNDS)===bo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=bo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=bo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&bo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,scaleX:i=vl.scaleX,scaleY:s=vl.scaleY,angle:n=vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=It(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),zl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Od.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:So.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=md(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Jh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:zl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new gl).fromString(t):this.pathProxy=new gl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",zl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Vd.mixin(hc);class Gd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Wd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Yd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Kd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Wd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Gd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Xd(t,e){return $d(t)}function $d(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let eu=0;function iu(){return eu++}var su;function nu(t){const e=[];let i=0,s="";for(let n=0;nru.set(t,!0)));const au=new Map;function ou(t){if(ru.has(t))return!0;if(au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>au.set(t,!0)));const lu=iu(),hu=iu(),cu=iu(),du=iu(),uu=iu(),pu=iu(),gu=iu(),mu=iu(),fu=iu(),vu=iu();iu();const _u=iu();iu();const yu=iu(),bu=iu(),xu=iu(),Su=Symbol.for("GraphicService"),Au=Symbol.for("GraphicCreator"),ku={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Mu=Object.keys(ku);var Tu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tu||(Tu={}));let wu=class t extends Vd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=pu,this._childUpdateTag=bo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,dx:i=vl.dx,dy:s=vl.dy,scaleX:n=vl.scaleX,scaleY:r=vl.scaleY,angle:a=vl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Jh(this).group;this._AABBBounds.clear();const i=zl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Bc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),zl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),zl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,zl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{zl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=zl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cu(t){return new wu(t)}wu.NOWORK_ANIMATE_ATTR=Nd;class Eu extends wu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Pu=Symbol.for("TransformUtil"),Bu=Symbol.for("GraphicUtil"),Ru=Symbol.for("LayerService"),Lu=Symbol.for("StaticLayerHandlerContribution"),Ou=Symbol.for("DynamicLayerHandlerContribution"),Iu=Symbol.for("VirtualLayerHandlerContribution");var Du,Fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zu=Du=class{static GenerateLayerId(){return`${Du.idprefix}_${Du.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=zl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(Lu):"dynamic"===t?th.get(Ou):th.get(Iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Eu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Du.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};zu.idprefix="visactor_layer",zu.prefix_count=0,zu=Du=Fu([Oa(),ju("design:paramtypes",[])],zu);var Hu=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Dh).to(jh),t(Bu).to(Vh).inSingletonScope(),t(Pu).to(Uh).inSingletonScope(),t(Ru).to(zu).inSingletonScope()}));function Nu(t,e){return!(!t&&!e)}function Vu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Gu(t,e,i){return i&&t*e>0}function Wu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Uu(t,e){return t*e>0}function Yu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Ku(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $u(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Lt(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*It(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*It(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*It(f),P=n*jt(f),B=r*It(_),R=r*jt(_);let L,O,I,D;if((T>Ct||M>Ct)&&(L=n*It(v),O=n*jt(v),I=r*It(b),D=r*jt(b),hCt){const t=Ft(x,w),r=Ft(S,w),o=Xu(I,D,E,P,n,t,Number(c)),l=Xu(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,n,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*It(Ot(l.y01,l.x01)),s+l.cy+r*jt(Ot(l.y01,l.x01))):e.moveTo(i+L,s+n*jt(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*It(v),s+n*jt(v));if(!(r>Ct)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>Ct){const t=Ft(k,C),n=Ft(A,C),o=Xu(B,R,L,O,r,-n,Number(c)),l=Xu(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,r,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*It(Ot(l.y01,l.x01)),s+l.cy+t*jt(Ot(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*It(b),s+r*jt(b))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class qu{static GetCanvas(){try{return qu.canvas||(qu.canvas=zl.global.createCanvas({})),qu.canvas}catch(t){return null}}static GetCtx(){if(!qu.ctx){const t=qu.GetCanvas();qu.ctx=t.getContext("2d")}return qu.ctx}}class Zu extends le{static getInstance(){return Zu._instance||(Zu._instance=new Zu),Zu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=qu.GetCanvas(),s=qu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Zu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ju{static GetSize(t){for(let e=0;e=t)return Ju.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ju.GenKey(t,e,i,s,n),l=Ju.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ju.GenKey(t,e,i,s,n);Ju.cache[l]?Ju.cache[l].push({width:a,height:o,pattern:r}):Ju.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ju.cache={},Ju.ImageSize=[20,40,80,160,320,640,1280,2560];const Qu=Symbol.for("ArcRenderContribution"),tp=Symbol.for("AreaRenderContribution"),ep=Symbol.for("CircleRenderContribution"),ip=Symbol.for("GroupRenderContribution"),sp=Symbol.for("ImageRenderContribution"),np=Symbol.for("PathRenderContribution"),rp=Symbol.for("PolygonRenderContribution"),ap=Symbol.for("RectRenderContribution"),op=Symbol.for("SymbolRenderContribution"),lp=Symbol.for("TextRenderContribution"),hp=Symbol.for("InteractiveSubRenderContribution"),cp=["radius","startAngle","endAngle",...Dd];class dp extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=du}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Jh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateCircleAABBBounds(i,Jh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,cp)}needUpdateTag(t){return super.needUpdateTag(t,cp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new gl;return o.arc(0,0,n,r,a),o}clone(){return new dp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function up(t){return new dp(t)}function pp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function gp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}dp.NOWORK_ANIMATE_ATTR=Nd;class fp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=xu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Jh(this).text;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Jh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Nc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=zl.graphicUtil.textMeasure,k=new fp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===su.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=gp(x,o),M=mp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Jh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Nc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=zl.graphicUtil.textMeasure,y=new fp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Jh(this).text,a=zl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Nc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=gp(x,o),e=this.cache.verticalList.length*b,i=mp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>nu(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===su.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const k=gp(x,o),M=this.cache.verticalList.length*b,T=mp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yp(t){return new _p(t)}_p.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Nd),_p.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_p.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class bp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function xp(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Sp=new class extends bp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return xp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return xp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Ap=new class extends bp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function kp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Mp=new class extends bp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return kp(t,e/2+n,i,s,r)}};function Tp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var wp=new class extends bp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Tp(t,e/2+n,i,s)}};class Cp extends bp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Ep=new Cp;var Pp=new class extends Cp{constructor(){super(...arguments),this.type="triangle"}};const Bp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Rp=Math.sin(Bt/10)*Bp,Lp=-Math.cos(Bt/10)*Bp;function Op(t,e,i,s){const n=Rp*e,r=Lp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ip=new class extends bp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};const Dp=zt(3);function Fp(t,e,i,s){const n=e,r=n/Dp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var jp=new class extends bp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Fp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Fp(t,e/2+n,i,s)}};function zp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Hp=new class extends bp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return zp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return zp(t,e/2+n,i,s)}};function Np(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Vp=new class extends bp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};const Gp=-.5,Wp=zt(3)/2,Up=1/zt(12);function Yp(t,e,i,s){const n=e/2,r=e*Up,a=n,o=e*Up+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Gp*n-Wp*r+i,Wp*n+Gp*r+s),t.lineTo(Gp*a-Wp*o+i,Wp*a+Gp*o+s),t.lineTo(Gp*l-Wp*h+i,Wp*l+Gp*h+s),t.lineTo(Gp*n+Wp*r+i,Gp*r-Wp*n+s),t.lineTo(Gp*a+Wp*o+i,Gp*o-Wp*a+s),t.lineTo(Gp*l+Wp*h+i,Gp*h-Wp*l+s),t.closePath(),!1}var Kp=new class extends bp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Yp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Yp(t,e/2+n,i,s)}};var Xp=new class extends bp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends bp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var qp=new class extends bp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Zp=zt(3);function Jp(t,e,i,s){const n=e*Zp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Qp=new class extends Cp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Jp(t,e/2/Zp,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/2/Zp+n,i,s)}};function tg(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var eg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return tg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return tg(t,e/4+n,i,s)}};function ig(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var sg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return ig(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ig(t,e/4+n,i,s)}};function ng(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var rg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return ng(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ng(t,e/4+n,i,s)}};function ag(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var og=new class extends bp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ag(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ag(t,e/4+n,i,s)}};function lg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var hg=new class extends bp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return lg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return lg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function cg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var dg=new class extends bp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return cg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return cg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ug(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var pg=new class extends bp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return ug(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ug(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function mg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var fg=new class extends bp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?mg(t,e,i,s):gg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?mg(t,e+2*n,i,s):gg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const vg=new Qt;class _g{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;vg.x1=s.bounds.x1*t,vg.y1=s.bounds.y1*t,vg.x2=s.bounds.x2*t,vg.y2=s.bounds.y2*t,e.union(vg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const yg={};[Sp,Ap,Mp,wp,Qp,Pp,Ip,jp,Hp,Vp,Kp,Xp,$p,Ep,qp,eg,sg,rg,og,fg,hg,dg,pg].forEach((t=>{yg[t.type]=t}));const bg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},xg=new Qt,Sg=["symbolType","size",...Dd];let Ag=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Jh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=yg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=bg[i]||i,!0===((n=i).startsWith("{const e=(new gl).fromString(t.d),i={};Mu.forEach((e=>{t[e]&&(i[ku[e]]=t[e])})),r.push({path:e,attribute:i}),xg.union(e.bounds)}));const a=xg.width(),o=xg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new _g(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new gl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new _g(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Jh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateSymbolAABBBounds(i,Jh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new gl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new gl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.userSymbolMap={},Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Nd);const Mg=["segments","points","curveType","curveTension",...Dd];let Tg=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=mu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}doUpdateAABBBounds(){const t=Jh(this).line;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateLineAABBBounds(e,Jh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.attribute,e=new gl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const Cg=["width","x1","y1","height","cornerRadius",...Dd];class Eg extends Vd{constructor(t){super(t),this.type="rect",this.numberType=_u}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Jh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRectAABBBounds(e,Jh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ad(t),r=new gl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Nd;class Bg extends Vd{constructor(t){super(t),this.type="glyph",this.numberType=uu,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=zl.graphicService.updateGlyphAABBBounds(this.attribute,Jh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Bg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Nd;class Lg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Hl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Og{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Nc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Vl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Nl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Ig=["width","height","image",...Dd];class Dg extends Vd{constructor(t){super(t),this.type="image",this.numberType=gu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Jh(this).image;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateImageAABBBounds(e,Jh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Fl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ig)}needUpdateTag(t){return super.needUpdateTag(t,Ig)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Nd);class jg extends Dg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Bc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Bc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fl.width,height:e=Fl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class zg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Hl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Ul.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof jg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Xl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof jg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Hl[this.direction]}store(t){if(t instanceof jg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new zg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof jg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character),new Og(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...Dd];class Vg extends Vd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Jh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRichTextAABBBounds(e,Jh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Lg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Hg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;const o=e.AABBBounds.clone();o.translate(e._marginArray[3],e._marginArray[0]),o.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i+e._marginArray[3],n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Nd);const Wg=["path","customPath",...Dd];class Ug extends Vd{constructor(t){super(t),this.type="path",this.numberType=fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Jh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof gl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof gl?this.cache:t.path)}doUpdateAABBBounds(){const t=Jh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePathAABBBounds(e,Jh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new gl).fromString(t.path):t.customPath&&(this.cache=new gl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}toCustomPath(){return(new gl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Nd);const Kg=["segments","points","curveType","curveTension",...Dd];class Xg extends Vd{constructor(t){super(t),this.type="area",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Jh(this).area;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateAreaAABBBounds(e,Jh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){const t=new gl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Dd];class Zg extends Vd{constructor(t){super(t),this.type="arc",this.numberType=lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Jh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Jh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ie(e),i=e+r,s&&Lt(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Jh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Lt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Vt(Number(l)/o*jt(g)),n=Vt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Jh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateArcAABBBounds(i,Jh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}getDefaultAttribute(t){return Jh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Lt(i-e),a=i>e;if(n=Rt-Ct)o.moveTo(0+n*It(e),0+n*jt(e)),o.arc(0,0,n,e,i,!a),s>Ct&&(o.moveTo(0+s*It(i),0+s*jt(i)),o.arc(0,0,s,i,e,a));else{const t=n*It(e),r=n*jt(e),l=s*It(i),h=s*jt(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Nd);const Qg=["points","cornerRadius",...Dd];class tm extends Vd{constructor(t){super(t),this.type="polygon",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Jh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePolygonAABBBounds(e,Jh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){const t=this.attribute.points,e=new gl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new tm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tm.NOWORK_ANIMATE_ATTR}}function em(t){return new tm(t)}tm.NOWORK_ANIMATE_ATTR=Nd;class im extends wu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function sm(t){return new im(t)}class nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class rm extends nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;tu(i,s+(r+o)/2,!0,a)}return i}}class am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};function um(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function pm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function gm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),um(t,t,[n+o,r+l,a+h]),um(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),um(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=lm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}um(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),um(i,i,[-s[0],-s[1],0]),gm(t,t,i)}}let fm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new to(["graphic"]),onSetStage:new to(["graphic","stage"]),onRemove:new to(["graphic"]),onRelease:new to(["graphic"]),onAddIncremental:new to(["graphic","group","stage"]),onClearIncremental:new to(["graphic","group","stage"]),beforeUpdateAABBBounds:new to(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new to(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Qt,this.tempAABBBounds2=new Qt,this._rectBoundsContribitions=[new nm],this._symbolBoundsContribitions=[new rm],this._imageBoundsContribitions=[new nm],this._circleBoundsContribitions=[new nm],this._arcBoundsContribitions=[new nm],this._pathBoundsContribitions=[new nm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new lo(t);return Lo(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=mp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=gp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){tu(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Zt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Rt-Ct?i.set(-a,-a,a,a):Oc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=Ct?i.set(0,0,0,0):Math.abs(l-h)>Rt-Ct?i.set(-n,-n,n,n):(Oc(h,l,n,i),Oc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){tu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;tu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Zt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};fm=hm([Oa(),dm(0,Ra(Au)),cm("design:paramtypes",[Object])],fm);const vm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let _m,ym;function bm(t){return _m||(_m=vm.CreateGraphic("text",{})),_m.initAttributes(t),_m.AABBBounds}const xm={x:0,y:0,z:0,lastModelMatrix:null};class Sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Gu(o,l,n),p=Uu(o,c),g=Nu(n,r),m=Vu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;xm.x=n,xm.y=r,xm.z=a,xm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=lm.allocate(),n=lm.allocate();mm(n,t,e),gm(s,d||s,n),xm.x=0,xm.y=0,xm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),lm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,xm.z=a,i.setTransformForCurrent()}else if(p)xm.x=0,xm.y=0,xm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,this.transformWithoutTranslate(i,xm.x,xm.y,xm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),xm.x=0,xm.y=0,xm.z=0;return xm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Gu(d,u,h),y=Uu(d,g),b=Nu(h),x=Vu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Lo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&lm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Am=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class km{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(km.IsGradientStr(t))try{const e=Am(t)[0];if(e){if("linear"===e.type)return km.ParseLinear(e);if("radial"===e.type)return km.ParseRadial(e);if("conic"===e.type)return km.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Mm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};class Pm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Lh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Lh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Bm=new Pm;let Rm=class{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Rm=wm([Oa(),Em(0,Ra(qa)),Em(0,Ia(hp)),Cm("design:paramtypes",[Object])],Rm);class Lm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Lh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Lh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Om=new Lm;const Im=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),$u(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),$u(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Dm=Om,Fm=Bm;const jm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},zm=Om,Hm=Bm;const Nm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vm=Et/2;function Gm(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Lt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Lt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Lt(t[0]),i=Lt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Lt(o[0]),o[1]=Lt(o[1]),o[2]=Lt(o[2]),o[3]=Lt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-Vm,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,Vm,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Vm,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+Vm,!1)}return!a&&t.closePath(),t}var Wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Um{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Gm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Gm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Ym=class{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ym=Wm([Oa()],Ym);let Km=class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Gm(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Km=Wm([Oa()],Km);const Xm=new Um,$m=Om,qm=Bm;const Zm=new class extends Um{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Bc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Gm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Qm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},tf=Om,ef=Bm;var sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rf=function(t,e){return function(i,s){e(i,s,t)}};let af=class extends Sm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=lu,this.builtinContributions=[Im,Fm,Dm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Lt(d-c),p=d>c;let g=!1;if(nCt||C>Ct)&&(D=n*It(x),F=n*jt(x),j=r*It(A),z=r*jt(A),uCt){const t=Ft(k,P),r=Ft(M,P),a=Xu(j,z,R,L,n,t,Number(p)),o=Xu(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>Ct)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>Ct){const t=Ft(w,B),n=Ft(T,B),a=Xu(O,I,D,F,r,-n,Number(p)),o=Xu(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Ot(a.y01,a.x01),Ot(a.y11,a.x11),!p);const t=Ot(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*It(A),s+r*jt(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Lt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Ec[s]=t,i&&(i=!(null!==(e=Ec[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ec[e]=!!t[e],i&&(i=!!Ec[e]);else Ec[0]=!1,Ec[1]=!1,Ec[2]=!1,Ec[3]=!1;return{isFullStroke:i,stroke:Ec}})(d);if((v||C)&&(e.beginPath(),$u(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),$u(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Lt(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),md(o.color,l.color,h,!1)}(0,0,h,n);a||Gu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};af=sf([Oa(),rf(0,Ra(qa)),rf(0,Ia(Qu)),nf("design:paramtypes",[Object])],af);var of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(i,s){e(i,s,t)}};let cf=class extends Sm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=du,this.builtinContributions=[jm,Hm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function df(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function uf(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),df(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=To.ROW:"y"===s?m=To.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gf=class extends Sm{constructor(){super(...arguments),this.numberType=mu}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=pl(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function mf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function ff(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),df(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),df(t,l,1,s),o=!1):o=!0}t.closePath()}gf=pf([Oa()],gf);const vf=new class extends Lm{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:jc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:jc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_f=Bm;var yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xf=function(t,e){return function(i,s){e(i,s,t)}};function Sf(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}let Af=class extends Sm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=cu,this.builtinContributions=[vf,_f],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Sf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Sf(e,C,{curveTension:b}),n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=To.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Lt(E.x-P.x),L=Lt(E.y-P.y);B=null==E.x1?To.ROW:null==E.y1?To.COLUMN:Number.isFinite(R+L)?R>L?To.ROW:To.COLUMN:To.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),mf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),mf(t,e,i,s),e.length=0,i.length=0)}n=o})),mf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?To.ROW:To.COLUMN,Number.isFinite(u)||(h=To.COLUMN),Number.isFinite(p)||(h=To.ROW);const g=i*(h===To.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Sm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Mf,kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Lo(t.pathShape.commandList,e,i,s,1,1,g);else{Lo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(np)),wf("design:paramtypes",[Object])],Ef);var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rf=function(t,e){return function(i,s){e(i,s,t)}};let Lf=class extends Sm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=_u,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Wu(g,m,k,M,c),w=Yu(g,v,k,M),C=Nu(c,d),E=Vu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Gm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(ap)),Bf("design:paramtypes",[Object])],Lf);var Of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Df=function(t,e){return function(i,s){e(i,s,t)}};let Ff=class extends Sm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bu,this.builtinContributions=[Qm,ef,tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Ff=Of([Oa(),Df(0,Ra(qa)),Df(0,Ia(op)),If("design:paramtypes",[Object])],Ff);const jf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Qt)}allocate(t,e,i,s){if(!this.pools.length)return(new Qt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Qt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const zf=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=jf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=bm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Gm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&jf.free(C),w()}};var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Sm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xu,this.builtinContributions=[zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Nc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=om.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),om.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=gp(l,f),_=mp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Wf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Sm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=vu,this.builtinContributions=[Xf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Wf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Uf(d,u),b=Uf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Yf(h,_,y,d,u),A=Yf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Uf(k,M),w=Yf(h,Uf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(rp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=pu}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Wu(u,f,p,g,h),k=Yu(u,v,p,g),M=Nu(h,c),T=Vu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Gm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Nm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=lm.allocate(),i=lm.allocate();mm(i,t,l),gm(e,h||e,i),n.modelMatrix=e,lm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&lm.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};iv=Qf([Oa(),ev(0,Ra(qa)),ev(0,Ia(ip)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];let ov=class extends Sm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=gu,this.builtinContributions=[Zm,Jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Gm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,av[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Rd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};ov=sv([Oa(),rv(0,Ra(qa)),rv(0,Ia(sp)),nv("design:paramtypes",[Object])],ov);const lv=Symbol.for("IncrementalDrawContribution"),hv=Symbol.for("ArcRender"),cv=Symbol.for("AreaRender"),dv=Symbol.for("CircleRender"),uv=Symbol.for("GraphicRender"),pv=Symbol.for("GroupRender"),gv=Symbol.for("LineRender"),mv=Symbol.for("PathRender"),fv=Symbol.for("PolygonRender"),vv=Symbol.for("RectRender"),_v=Symbol.for("SymbolRender"),yv=Symbol.for("TextRender"),bv=Symbol.for("RichTextRender"),xv=Symbol.for("GlyphRender"),Sv=Symbol.for("ImageRender"),Av=Symbol.for("DrawContribution");var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tv=Symbol.for("DrawItemInterceptor"),wv=new Qt,Cv=new Qt;class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){wv.copy(s.dirtyBounds),Cv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,om.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(wv),s.backupDirtyBounds.copy(Cv)),!0}}class Pv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Bv=class{constructor(){this.order=1,this.interceptors=[new Ev,new Lv,new Rv,new Pv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===hu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&lm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};const Fv=Symbol.for("RenderService");let jv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jv=Ov([Oa(),Dv(0,Ra(Av)),Iv("design:paramtypes",[Object])],jv);var zv=new xa((t=>{t(Fv).to(jv)}));const Hv=Symbol.for("PickerService"),Nv=Symbol.for("GlobalPickerService");var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Gv=Symbol.for("PickItemInterceptor");let Wv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=om.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Wv=Vv([Oa()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Uv=Vv([Oa()],Uv);let Yv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===hu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Yv=Vv([Oa()],Yv);var Kv=new xa(((t,e,i)=>{i(Hv)||(t(Nv).toSelf(),t(Hv).toService(Nv)),t(Yv).toSelf().inSingletonScope(),t(Gv).toService(Yv),t(Wv).toSelf().inSingletonScope(),t(Gv).toService(Wv),t(Uv).toSelf().inSingletonScope(),t(Gv).toService(Uv),Ja(t,Gv)})),Xv=new xa((t=>{t(Su).to(fm).inSingletonScope(),t(Au).toConstantValue(vm)}));const $v=Symbol.for("AutoEnablePlugins"),qv=Symbol.for("PluginService");var Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qv=function(t,e){return function(i,s){e(i,s,t)}};let t_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound($v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};t_=Zv([Oa(),Qv(0,Ra(qa)),Qv(0,Ia($v)),Jv("design:paramtypes",[Object])],t_);var e_=new xa((t=>{t(qv).to(t_),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,$v)})),i_=new xa((t=>{Ja(t,eo)})),s_=new xa((t=>{t(Jl).to(Ql).inSingletonScope(),Ja(t,Jl)})),n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let a_=class{constructor(){this.type="static",this.offscreen=!1,this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};a_=n_([Oa(),r_("design:paramtypes",[])],a_);var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let h_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=zl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};h_=o_([Oa(),l_("design:paramtypes",[])],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=sh({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};u_=c_([Oa(),d_("design:paramtypes",[])],u_);var p_=new xa((t=>{t(a_).toSelf(),t(u_).toSelf(),t(h_).toSelf(),t(Lu).toService(a_),t(Ou).toService(u_),t(Iu).toService(h_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function m_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return g_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function v_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Jt,this.backupDirtyBounds=new Jt,this.global=zl.global,this.layerService=zl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,om.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,kl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ie(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=jf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=om.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):m_(t,kl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jf.free(n),om.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(lv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends gf{constructor(){super(...arguments),this.numberType=mu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Gu(u,p,c),_=Uu(u,g),y=Nu(c),b=Vu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Oa()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Af{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Gu(u,d,c),m=Nu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Oa()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let B_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new to([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,kl.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield f_(t,kl.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};B_=w_([Oa(),E_(0,La(uv)),E_(1,Ra(A_)),E_(2,Ra(M_)),E_(3,Ra(qa)),E_(3,Ia(Tv)),C_("design:paramtypes",[Array,Object,Object,Object])],B_);var R_=new xa((t=>{t(Pm).toSelf().inSingletonScope(),t(Lm).toSelf().inSingletonScope(),t(Av).to(x_),t(lv).to(B_),t(pv).to(iv).inSingletonScope(),t(uv).toService(pv),Ja(t,ip),t(Rm).toSelf().inSingletonScope(),Ja(t,hp),Ja(t,uv),t(Bv).toSelf().inSingletonScope(),t(Tv).toService(Bv),Ja(t,Tv)}));function L_(){L_.__loaded||(L_.__loaded=!0,th.load(Hu),th.load(Xv),th.load(zv),th.load(Kv),th.load(e_),function(t){t.load(i_),t.load(s_),t.load(p_)}(th),function(t){t.load(R_)}(th))}L_.__loaded=!1,L_();const O_=th.get(io);zl.global=O_;const I_=th.get(Bu);zl.graphicUtil=I_;const D_=th.get(Pu);zl.transformUtil=D_;const F_=th.get(Su);zl.graphicService=F_;const j_=th.get(Ru);zl.layerService=j_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),zl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class H_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),zl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){zl.graphicService.hooks.onAddIncremental.taps=zl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onClearIncremental.taps=zl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,zl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class V_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.unTap(this.key),zl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?zl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:zl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=ni(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Jh(t).text)}getTransformOfText(t){const e=Jh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=ti(h,c);o=t.x,l=t.y}const p=zl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));zl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===zl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&zl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===zl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const G_=new Qt;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(G_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(G_,t.parent&&t.parent.globalTransMatrix)))})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),zl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.taps=zl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const U_=new Qt;class Y_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ba.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Qt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Jh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&U_.copy(s)})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(U_.equals(i)||this.tryLayout(t,!1))})),zl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const K_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===mc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=mc.INITIAL,zl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),zl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:gc},{mode:"timeout",cons:pc},{mode:"manual",cons:uc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==mc.INITIAL&&(this.status=mc.PAUSE,!0)}resume(){return this.status!==mc.INITIAL&&(this.status=mc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===mc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===mc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=mc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=mc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};K_.addTimeline(_c),K_.setFPS(60);class X_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=pd.Get(e,ud.Color1),this.ambient=i;const s=zt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Ft(Dt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?pd.Get(e,ud.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function $_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function q_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Z_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&zl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ey="white";class iy extends wu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ey}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=zl.global,!this.global.env&&Q_()&&this.global.setEnv("browser"),this.window=th.get(Dh),this.renderService=th.get(Fv),this.pluginService=th.get(qv),this.layerService=th.get(Ru),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ey,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||K_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new vc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new X_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Z_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new H_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Jt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Y_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new V_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new ty))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=th.get(Hv));const i=this.pickerService.pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry=new oe(1,0,0,1,0,0),ay={x:0,y:0};let oy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this.path=new gl,this._clearMatrix=new oe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ay),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,ay.x,ay.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ay);const i=Mm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,ay.x,ay.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ry,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};oy=sy([Oa(),ny("design:paramtypes",[Object,Number])],oy);var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cy={WIDTH:500,HEIGHT:500,DPR:1};let dy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=cy.WIDTH,height:n=cy.HEIGHT,dpr:r=cy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};dy.env="browser",dy=ly([Oa(),hy("design:paramtypes",[Object])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let py=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Qt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};py=uy([Oa()],py);var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fy=class{constructor(){this._uid=ba.GenAutoIncrementId(),this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};fy=gy([Oa(),my("design:paramtypes",[])],fy);var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yy=function(t,e){return function(i,s){e(i,s,t)}};let by=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=zl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Qt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new oe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=lm.allocate();if(pm(i,e),a){if(i){const t=lm.allocate();r.modelMatrix=gm(t,a,i),lm.free(i)}}else pm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&lm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),om.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function xy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&xy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&xy(t,a,i,s,n))}function Sy(t,e){const i=t.length-1,s=[t[0]];return xy(t,0,i,e,s),s.push(t[i]),s}by=vy([Oa(),yy(0,Ra(qa)),yy(0,Ia(Gv)),_y("design:paramtypes",[Object])],by);let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(af).toSelf().inSingletonScope(),t(hv).to(af).inSingletonScope(),t(uv).toService(hv),t(Qu).toService(Rm),Ja(t,Qu))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(Lf).toSelf().inSingletonScope(),t(vv).to(Lf).inSingletonScope(),t(uv).toService(vv),t(Km).toSelf(),t(Ym).toSelf(),t(ap).toService(Km),t(ap).toService(Ym),t(ap).toService(Rm),Ja(t,ap))}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(gf).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(gv).to(gf).inSingletonScope(),t(uv).toService(gv))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(Af).toSelf().inSingletonScope(),t(cv).to(Af).inSingletonScope(),t(uv).toService(cv),t(tp).toService(Rm),Ja(t,tp),t(M_).toSelf().inSingletonScope())}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(Ff).toSelf().inSingletonScope(),t(_v).to(Ff).inSingletonScope(),t(uv).toService(_v),t(op).toService(Rm),Ja(t,op))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(cf).toSelf().inSingletonScope(),t(dv).to(cf).inSingletonScope(),t(uv).toService(dv),t(ep).toService(Rm),Ja(t,ep))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(yv).to(Gf).inSingletonScope(),t(uv).toService(yv),t(lp).toService(Rm),Ja(t,lp))}));let Fy=!1;const jy=new xa((t=>{Fy||(Fy=!0,t(Ef).toSelf().inSingletonScope(),t(mv).to(Ef).inSingletonScope(),t(uv).toService(mv),t(np).toService(Rm),Ja(t,np))}));let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(fv).to(Jf).inSingletonScope(),t(uv).toService(fv),t(rp).toService(Rm),Ja(t,rp))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vy=class{constructor(){this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Vy=Ny([Oa()],Vy);let Gy=!1;const Wy=new xa((t=>{Gy||(Gy=!0,t(xv).to(Vy).inSingletonScope(),t(uv).toService(xv))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=class extends Sm{constructor(){super(),this.numberType=yu,this.builtinContributions=[zf],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Gu(o,l,!0),d=Gu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Gm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};Ky=Uy([Oa(),Yy("design:paramtypes",[])],Ky);let Xy=!1;const $y=new xa((t=>{Xy||(Xy=!0,t(bv).to(Ky).inSingletonScope(),t(uv).toService(bv))}));let qy=!1;const Zy=new xa((t=>{qy||(qy=!0,t(Sv).to(ov).inSingletonScope(),t(uv).toService(Sv),t(sp).toService(Rm),Ja(t,sp))}));const Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Q_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),db=t=>e=>R(e,t),ub=t=>{at.getInstance().error(t)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ub("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ub("Access path missing closing bracket: "+t),a&&ub("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return cb((i&&i.get||db)(s),[n],e||n)},gb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>pb(t,e,i)));return t=>s.map((e=>e(t)))}return pb(t,e,i)};gb("id");const mb=cb((function(t){return t}),[],"identity"),fb=cb((function(){return 0}),[],"zero");cb((function(){return 1}),[],"one"),cb((function(){return!0}),[],"true"),cb((function(){return!1}),[],"false"),cb((function(){return{}}),[],"emptyObject");const vb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>_b(t,r,n)))))},yb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function bb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function xb(t,e,i,s,n){let r=0,a=0;return bb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Sb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;bb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xb(t,e,i,n,h)}}function Ab(t){return"horizontal"===t}function kb(t){return"vertical"===t}const Mb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Tb extends wu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,Mb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Mb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const tx=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},ex=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ix extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||tx(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=ex(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=ex(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=tx(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ac.now()-i>this.config.press.time&&ex(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rx=[0,0,0];let ax=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},_l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},xl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this._clearMatrix=new oe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new oe(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ju.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=zl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:xl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:xl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Tm(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit}=e;r.lineWidth=Mm(this,a,this.dpr),r.strokeStyle=Tm(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=pp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=pp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};ax.env="browser",ax=sx([Oa(),nx("design:paramtypes",[Object,Number])],ax);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hx=class extends dy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=zl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ax(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function cx(t,e){return new xa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}hx.env="browser",hx=ox([Oa(),lx("design:paramtypes",[Object])],hx);const dx=cx(hx,ax);var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let mx=class extends by{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Lh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vx=class{constructor(){this.type="group",this.numberType=pu}contains(t,e,i){return!1}};vx=fx([Oa()],vx);const _x=new xa(((t,e,i,s)=>{_x.__vloaded||(_x.__vloaded=!0,t(Zb).to(vx).inSingletonScope(),t(Jb).toService(Zb),Ja(t,Jb))}));_x.__vloaded=!1;var yx=_x;const bx=new xa(((t,e,i,s)=>{i(mx)||t(mx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(mx):t(Hv).toService(mx)}));var xx,Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=xx=class extends fy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${xx.idprefix}_${xx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=zl.global,this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:xx.GenerateCanvasId(),canvasControled:!0};this.canvas=new hx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new hx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};kx.env="browser",kx.idprefix="visactor_window",kx.prefix_count=0,kx=xx=Sx([Oa(),Ax("design:paramtypes",[])],kx);const Mx=new xa((t=>{t(kx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(kx))).whenTargetNamed(kx.env)}));var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends py{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Qt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ba.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Tx([Oa(),wx("design:paramtypes",[])],Px);const Bx=new xa((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(eo).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(dx),t.load(Mx),e&&function(t){t.load(yx),t.load(bx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ox=class extends ax{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};Ox.env="feishu",Ox=Lx([Oa()],Ox);var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fx=class extends dy{constructor(t){super(t)}init(){this._context=new Ox(this,this._dpr)}release(){}};Fx.env="feishu",Fx=Ix([Oa(),Dx("design:paramtypes",[Object])],Fx);const jx=cx(Fx,Ox);var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};class Vx{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Gx=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new Vx}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Fx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Gx.env="feishu",Gx=zx([Oa(),Nx(0,Ra(io)),Hx("design:paramtypes",[Object])],Gx);const Wx=new xa((t=>{t(Gx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Gx))).whenTargetNamed(Gx.env)}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends by{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new oy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xx=Ux([Oa(),Kx(0,Ra(qa)),Kx(0,Ia(wb)),Kx(1,Ra(qa)),Kx(1,Ia(Gv)),Yx("design:paramtypes",[Object,Object])],Xx);const $x=new xa((t=>{$x.__vloaded||($x.__vloaded=!0,Ja(t,wb))}));$x.__vloaded=!1;var qx=$x,Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([Oa(),Qx(0,Ra(hv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new xa(((t,e,i,s)=>{eS||(eS=!0,t(Cb).to(tS).inSingletonScope(),t(wb).toService(Cb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};aS=sS([Oa(),rS(0,Ra(cv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new xa(((t,e,i,s)=>{oS||(oS=!0,t(Eb).to(aS).inSingletonScope(),t(wb).toService(Eb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([Oa(),dS(0,Ra(dv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new xa(((t,e,i,s)=>{pS||(pS=!0,t(Pb).to(uS).inSingletonScope(),t(wb).toService(Pb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};_S=mS([Oa(),vS(0,Ra(xv)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(jb).to(_S).inSingletonScope(),t(_S).toService(jb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};SS=xS([Oa()],SS);let AS=!1;const kS=new xa(((t,e,i,s)=>{AS||(AS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([Oa(),wS(0,Ra(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new xa(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(wb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OS=BS([Oa(),LS(0,Ra(fv)),RS("design:paramtypes",[Object])],OS);let IS=!1;const DS=new xa(((t,e,i,s)=>{IS||(IS=!0,t(Fb).to(OS).inSingletonScope(),t(wb).toService(Fb))}));var FS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zS=function(t,e){return function(i,s){e(i,s,t)}};let HS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};HS=FS([Oa(),zS(0,Ra(mv)),jS("design:paramtypes",[Object])],HS);let NS=!1;const VS=new xa(((t,e,i,s)=>{NS||(NS=!0,t(Lb).to(HS).inSingletonScope(),t(wb).toService(Lb))}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},US=function(t,e){return function(i,s){e(i,s,t)}};const YS=new Qt;let KS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;YS.setValue(i.x1,i.y1,i.x2,i.y2),YS.expand(-r/2),h=!YS.containsPoint(e)}}return s.highPerformanceRestore(),h}};KS=GS([Oa(),US(0,Ra(vv)),WS("design:paramtypes",[Object])],KS);let XS=!1;const $S=new xa(((t,e,i,s)=>{XS||(XS=!0,t(Ob).to(KS).inSingletonScope(),t(wb).toService(Ob))}));let qS=!1;const ZS=new xa(((t,e,i,s)=>{qS||(qS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};eA=JS([Oa(),tA(0,Ra(_v)),QS("design:paramtypes",[Object])],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Ib).to(eA).inSingletonScope(),t(wb).toService(Ib))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class{constructor(){this.type="text",this.numberType=xu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};rA=nA([Oa()],rA);let aA=!1;const oA=new xa(((t,e,i,s)=>{aA||(aA=!0,t(Db).to(rA).inSingletonScope(),t(wb).toService(Db))})),lA=new xa(((t,e,i,s)=>{i(Xx)||t(Xx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(Xx):t(Hv).toService(Xx)}));class hA{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uA=class extends py{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new hA(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};uA=cA([Oa(),dA("design:paramtypes",[])],uA);const pA=new xa((t=>{pA.isFeishuBound||(pA.isFeishuBound=!0,t(uA).toSelf().inSingletonScope(),t(eo).toService(uA))}));function gA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];gA.__loaded||(gA.__loaded=!0,t.load(pA),t.load(jx),t.load(Wx),e&&function(t){t.load(qx),t.load(lA),t.load(iS),t.load(lS),t.load(gS),t.load(bS),t.load(kS),t.load(PS),t.load(DS),t.load(VS),t.load($S),t.load(ZS),t.load(sA),t.load(oA)}(t))}pA.isFeishuBound=!1,gA.__loaded=!1;var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends ax{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vA.env="node",vA=mA([Oa(),fA("design:paramtypes",[Object,Number])],vA);var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bA=class extends dy{constructor(t){super(t)}init(){this._context=new vA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bA.env="node",bA=_A([Oa(),yA("design:paramtypes",[Object])],bA);const xA=cx(bA,vA);var SA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,s){e(i,s,t)}};let MA=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new bA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};MA.env="node",MA=SA([Oa(),kA(0,Ra(io)),AA("design:paramtypes",[Object])],MA);const TA=new xa((t=>{t(MA).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(MA))).whenTargetNamed(MA.env)}));var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CA=class extends py{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};CA=wA([Oa()],CA);const EA=new xa((t=>{EA.isNodeBound||(EA.isNodeBound=!0,t(CA).toSelf().inSingletonScope(),t(eo).toService(CA))}));function PA(t){PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(xA),t.load(TA))}EA.isNodeBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([Oa(),LA(0,Ra(hv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new xa(((t,e,i,s)=>{IA||(IA=!0,t(zb).to(OA).inSingletonScope(),t(Jb).toService(zb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Qt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([Oa(),zA(0,Ra(vv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new xa(((t,e,i,s)=>{VA||(VA=!0,t(Ub).to(NA).inSingletonScope(),t(Jb).toService(Ub))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends Sm{};UA=WA([Oa()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Jh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([Oa(),XA(0,Ra(gv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new xa(((t,e,i,s)=>{qA||(qA=!0,t(Gb).to($A).inSingletonScope(),t(Jb).toService(Gb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([Oa(),tk(0,Ra(cv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new xa(((t,e,i,s)=>{ik||(ik=!0,t(Hb).to(ek).inSingletonScope(),t(Jb).toService(Hb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Jh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&lm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([Oa(),ak(0,Ra(_v)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new xa(((t,e,i,s)=>{lk||(lk=!0,t(Yb).to(ok).inSingletonScope(),t(Jb).toService(Yb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([Oa(),uk(0,Ra(dv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new xa(((t,e,i,s)=>{gk||(gk=!0,t(Nb).to(pk).inSingletonScope(),t(Jb).toService(Nb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Jh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=mp(a,u,n),v=gp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&lm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([Oa(),_k(0,Ra(yv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new xa(((t,e,i,s)=>{bk||(bk=!0,t(Kb).to(yk).inSingletonScope(),t(Jb).toService(Kb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([Oa(),kk(0,Ra(mv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new xa(((t,e,i,s)=>{Tk||(Tk=!0,t(Wb).to(Mk).inSingletonScope(),t(Jb).toService(Wb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([Oa(),Pk(0,Ra(fv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new xa(((t,e,i,s)=>{Rk||(Rk=!0,t(Xb).to(Bk).inSingletonScope(),t(Jb).toService(Xb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([Oa(),Dk(0,Ra(xv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new xa(((t,e,i,s)=>{jk||(jk=!0,t(qb).to(Fk).inSingletonScope(),t(Jb).toService(qb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([Oa(),Vk(0,Ra(bv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t($b).to(Gk).inSingletonScope(),t(Jb).toService($b))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([Oa()],Kk);let Xk=!1;const $k=new xa(((t,e,i,s)=>{Xk||(Xk=!0,t(Vb).to(Kk).inSingletonScope(),t(Jb).toService(Vb))})),qk=Q_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,vm.RegisterGraphicCreator("arc",Jg),th.load(ky),th.load(qk?DA:iS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,vm.RegisterGraphicCreator("area",$g),th.load(Py),th.load(qk?sk:lS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,vm.RegisterGraphicCreator("circle",up),th.load(Oy),th.load(qk?mk:gS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,vm.RegisterGraphicCreator("glyph",Rg),th.load(Wy),th.load(qk?zk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,vm.RegisterGraphicCreator("group",Cu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,vm.RegisterGraphicCreator("image",Fg),th.load(Zy),th.load(qk?$k:kS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,vm.RegisterGraphicCreator("line",wg),th.load(Cy),th.load(qk?ZA:PS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,vm.RegisterGraphicCreator("path",Yg),th.load(jy),th.load(qk?wk:VS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,vm.RegisterGraphicCreator("polygon",em),th.load(Hy),th.load(qk?Lk:DS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,vm.RegisterGraphicCreator("rect",Pg),th.load(Ty),th.load(qk?GA:$S))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,vm.RegisterGraphicCreator("richtext",Gg),th.load($y),th.load(qk?Uk:ZS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,vm.RegisterGraphicCreator("shadowRoot",sm))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,vm.RegisterGraphicCreator("symbol",kg),th.load(Ry),th.load(qk?hk:sA))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,vm.RegisterGraphicCreator("text",yp),th.load(Dy),th.load(qk?xk:oA))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:xt,throttle:St};MM();let LM=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===O_.env?(O_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===O_.env?(O_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ei(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ei(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new _e(t).toHex(),o=new _e(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=_e.getColorBrightness(new _e(e));return _e.getColorBrightness(new _e(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:bm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=bm({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?vm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),vm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:Gke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>we&&keEe&&TeAe&&CeMe&&PeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([Oa()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([Oa()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([Oa()],uT);const pT=new xa(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(hp).toService(hT)),i(dT)||(t(dT).toSelf(),t($v).toService(dT)),i(uT)||(t(uT).toSelf(),t($v).toService(uT))}));class gT extends Tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=se(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Vc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Tb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Ie(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=vm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new gl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==So.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===So.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,xo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=ti(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,l+c)||gt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new gl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Tb{getStartAngle(){return re(this._startAngle)}getEndAngle(){return re(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=vm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=vm.line;Y(i)[0].cornerRadius&&(t=vm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=vm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=vm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function lw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function hw(t,e,i,s){const n=bm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}const mw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},fw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,vw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class _w extends Tb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=mw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=vm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=vm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=vm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=vm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=vm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=vm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=vm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Lt(s[0])>Lt(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function yw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function bw(t,e){return Ie(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=He(t,i),r=He(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=ze(t),l=ze(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:te(t.angle);let m=i?t.angle+Pt:te(90-t.angle);const f=i?e.angle:te(e.angle);let v=i?e.angle+Pt:te(90-e.angle);m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Fe(n,i)+Fe(n,s))/2>Fe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Sw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Sw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function Aw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Mw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Cw(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ew(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),yw(e)}function ww(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Cw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function Ew(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Pw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Bw(){aM(),cM(),_M(),kM()}var Rw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Cw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Ew(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=te(e)})),Tw(i,t),!Mw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(kw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),yw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:xw[n]||xw.parity;if(s.length>=3&&Aw(s,r)){do{s=a(s,r)}while(s.length>=3&&Aw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&Sw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=vm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ei(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Lw.defaultAttributes=aw,U(Lw,Pw);class Ow{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return se(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Iw,Dw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=vm.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=vm.circle(t)}h.name=sw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},rw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Dw(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Fw.defaultAttributes=aw,U(Fw,Ow);class jw extends yc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=Tt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=Tt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:At(i,s)})),r=Tt.lastIndex;return r{Hw[t]=!0}));const Uw=t=>-Math.log(-t),Yw=t=>-Math.exp(-t),Kw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Xw=t=>10===t?Kw:t===Math.E?Math.exp:e=>Math.pow(t,e),$w=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Zw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Jw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Qw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eC(t,e,i,s){return 1===i&&(i=0),tC(t,i,s)*(e/(1-i))}function iC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class aC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=iC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const oC=Symbol("implicit");class lC extends aC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Iw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=oC}clone(){const t=(new lC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==oC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class cC extends lC{constructor(t){super(),this.type=Iw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=eC(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:hC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return hC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new cC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:dC}=xe;function uC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=_e.parseColorString(e)){const e=dC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?dC(t,e):e instanceof _e?dC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class pC extends aC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ww,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ww;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Ww,this._piecewise=Qw,this._interpolate=uC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?sC:Qw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Ww),this.rescale(i)):this._clamp!==Ww}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const gC=Math.sqrt(50),mC=Math.sqrt(10),fC=Math.sqrt(2),vC=[1,2,5,10],_C=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=SC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?bC(0,-(e-1)/s,s):bC((e-1)/s,0,s)},yC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return _C(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _C(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=bC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=bC(t,e,l);return n&&r.reverse(),r})),SC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vC[0];return i>=gC?s=vC[3]:i>=mC?s=vC[2]:i>=fC&&(s=vC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AC(t,e,i){const s=(e-t)/Math.max(0,i);return SC(s)}function kC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=AC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function TC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const wC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),EC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wC(t,e,n):wC(t,e,rC(n)),h=wC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),PC=ft(((t,e,i,s,n)=>kC(s(t),s(e),i).map((t=>rC(n(t))))));class BC extends pC{constructor(){super(...arguments),this.type=Iw.Linear}clone(){return(new BC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return yC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=xC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return kC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=TC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=MC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=MC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=MC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function RC(t){return e=>-t(-e)}function LC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class OC extends pC{constructor(){super($w(10),Xw(10)),this.type=Iw.Log,this._limit=LC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new OC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=$w(this._base),s=Xw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RC(i),this._pows=RC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Uw,this.untransformer=Yw):(this._logs=i,this._pows=s,this._limit=LC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Ww}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class IC extends BC{constructor(){super(qw(1),Zw(1)),this.type=Iw.Symlog,this._const=1}clone(){return(new IC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=qw(t),this.untransformer=Zw(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return CC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class DC{constructor(){this.type=Iw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new DC).domain(this._domain).range(this._range).unknown(this._unknown)}}const FC=t=>t.map(((t,e)=>({index:e,value:t}))),jC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Qt(t).expand(i/2),n=new Qt(e).expand(i/2);return s.intersects(n)};function zC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function HC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=te(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=NC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=NC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=NC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=NC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Qt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},GC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=se({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Qt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},WC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},UC=(t,e,i,s)=>VC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),YC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},KC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!YC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?KC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&jC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qC=(t,e)=>{if(Nw(t.type))return((t,e)=>{if(!Nw(t.type))return FC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return FC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=VC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&HC(n,i);)n=WC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return FC(h)})(t,e);if(Gw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?FC([s[s.length-1]]):FC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=UC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=XC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=UC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return FC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=GC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=$C(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return FC(c)})(t,e)}return FC(t.domain())};function ZC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=qt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function JC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=qt.distancePP(s,l),c=qt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=ZC(e,t,!1,!!n),o=ZC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class QC extends Tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=ZC(t,o,!1,!!a)}const u=vm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=gw(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=vm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(tE,Pw);var eE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(iE,Ow);const sE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",nE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},rE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var aE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(aE||(aE={}));var oE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=aE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=aE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=aE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===O_.env&&(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===aE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===aE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=aE.endHandler):h+=l:this._activeTag===aE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===aE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===O_.env&&(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=oE(i,["formatMethod"]),{formatMethod:a}=s,o=oE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Jt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},rE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},rE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},rE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},rE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Sy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var cE,dE,uE,pE;function gE(){aM(),tT()}function mE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function fE(t,e){const{dx:i,dy:s}=mE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}hE.defaultAttributes=nE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(cE||(cE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(dE||(dE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(uE||(uE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(pE||(pE={}));class vE extends Tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=mw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=vm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=vm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=vm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function _E(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function yE(t,e,i,s){t&&(_E(t.startSymbol,e,i,s),t.lines.forEach((t=>_E(t,e,i,s))),_E(t.line,e,i,s),_E(t.endSymbol,e,i,s))}function bE(t,e,i,s){t&&(_E(t.getTextShape(),e,i,s),_E(t.getBgRect(),e,i,s))}function xE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function SE(t,e,i,s){t&&(xE(t.startSymbol,e,i,s),t.lines.forEach((t=>xE(t,e,i,s))),xE(t.line,e,i,s),xE(t.endSymbol,e,i,s))}function AE(t,e,i,s){t&&(xE(t.getTextShape(),e,i,s),xE(t.getBgRect(),e,i,s))}function kE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;_E(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),_E(t.endSymbol,s+r+a,o,n),_E(e.getTextShape(),s+r+a+o,l,n),_E(e.getBgRect(),s+r+a+o,l,n)}function ME(t,e,i,s,n){yE(t,s,i,n),bE(e,s,i,n)}function TE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function wE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function CE(t,e,i,s,n,r){var a;yE(t,n,s,r),_E(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?bE(i,n,s,r):_E(i,n,s,r)}function EE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;_E(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),_E(e,n+o+l,h,r),_E(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(_E(i.getTextShape(),n+o+l+h+c,d,r),_E(i.getBgRect(),n+o+l+c,d,r)):_E(i,n+o+l+c,d,r)}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?kE(t,e,s,r,a):"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?kE(t,e,s,n,a):"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&wE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&wE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function LE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?CE(n,r,e,i,s,o):"callIn"===t&&EE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?CE(n,r,e,i,s,a):"callIn"===t&&EE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;SE(t,n,s,r),xE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AE(i,n,s,r):xE(i,n,s,r)}(n,r,e,t,i,s)}}const OE={type:"clipIn",duration:500,easing:"linear",delay:0},IE={type:"fadeIn",duration:500,easing:"linear",delay:0},DE={type:"callIn",duration:500,easing:"linear",delay:0},FE={type:"fadeOut",duration:500,easing:"linear",delay:0};class jE extends vE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=FE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;fE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const zE=.001,HE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:cE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},NE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},VE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:uE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},GE={interactive:!0,label:{position:dE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={interactive:!0,label:{position:uE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},UE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},YE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},KE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function XE(){$E._animate=PE}gE(),QT();class $E extends jE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$E.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,zE)||FM(Math.abs(e),3*Math.PI/2,zE)?jM(i,e,t):DM(e)?NE.postiveXAxis[t]:NE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function qE(){ZE._animate=BE}$E.defaultAttributes=HE,gE(),gM();class ZE extends vE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},YE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=vm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}ZE.defaultAttributes=GE,gE(),tw();class JE extends jE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case uE.arcInnerStart:l=s;case uE.arcOuterStart:l=s;break;case uE.arcInnerEnd:l=n;case uE.arcOuterEnd:l=n;break;case uE.center:case uE.arcInnerMiddle:case uE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return UE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}JE.defaultAttributes=VE,gE(),Jk();class QE extends vE{markerAnimate(t){QE._animate&&this._animationConfig&&QE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case uE.center:h=(i+s)/2,c=(n+r)/2;break;case uE.arcInnerStart:h=i,c=n;break;case uE.arcOuterStart:h=s,c=n;break;case uE.arcInnerEnd:h=i,c=r;break;case uE.arcOuterEnd:h=s,c=r;break;case uE.arcInnerMiddle:h=i,c=(n+r)/2;break;case uE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=vm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function tP(){eP._animate=LE}QE.defaultAttributes=WE,gE(),QT(),tw(),SM(),lM(),cM();class eP extends vE{markerAnimate(t){eP._animate&&this._animationConfig&&eP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=DE,this.defaultExitAnimation=FE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,zE)||FM(Math.abs(s),3*Math.PI/2,zE)?jM(t,s,n):DM(s)?KE.postiveXAxis[n]:KE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=pE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=vm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=vm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=vm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,zE)||FM(d,0,zE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(cP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(cP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===cP.focus||"focus"===o){const s=a.hasState(lP.focus);a.toggleState(lP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover,lP.focus],t),this._setLegendItemState(e,lP.selected,t)})):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover,lP.focus],t),this._setLegendItemState(e,lP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(lP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(lP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(hP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[lP.selected,lP.selectedHover],t),this._setLegendItemState(a,lP.unSelected,t)):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t))}else this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover],t),this._setLegendItemState(e,lP.unSelected,t))}))}this._dispatchLegendEvent(hP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,lP.selected),this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover])):(this._removeLegendItemState(e,[lP.selected,lP.selectedHover]),this._setLegendItemState(e,lP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=rP,spaceRow:h=aP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ei(c);let w;!1===x.visible?(w=vm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,cP.item,t,w)):(w=vm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,cP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?lP.selected:lP.unSelected);const C=vm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=vm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,cP.itemShape,t,w,S.state),s.addState(e?lP.selected:lP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=vm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,cP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,cP.itemLabel,t,w,A.state),D.addState(e?lP.selected:lP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,cP.itemValue,t,w,k.state),r.addState(e?lP.selected:lP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new nP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new nP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=vm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=rP,spaceRow:a=aP}=s,o=this._itemsContainer,{space:l=oP,defaultCurrent:h=1}=n,c=gP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=vm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(lP.selected)?this._setLegendItemState(t,lP.selectedHover,e):this._setLegendItemState(t,lP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===cP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(hP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(lP.unSelectedHover)||t.hasState(lP.selectedHover))&&(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(lP.unSelectedHover)&&!t.hasState(lP.selectedHover)||(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===cP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(hP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(lP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},mP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(lP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var vP;function _P(t){return y(t)?t:[t,t]}function yP(t){return t?"ew-resize":"ns-resize"}fP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:rP,spaceRow:aP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:oP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(vP||(vP={})),uP();class bP extends Tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:_P(d)[0],endValue:_P(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=vm.group({x:0,y:0});m.name=vP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=vm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=vP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=vm.group({x:g?v:0,y:g?0:v});m.add(_);const y=vm.group({x:0,y:0});let b;if(y.name=vP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=vm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=vP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=vm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=vP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=_P(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(v.name=vP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=vP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(i.name=vP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=vP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=vm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=vP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":yP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=vm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=vP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return vm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":yP(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),vm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=vm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=vm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===vP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===vP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===vP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===vP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}bP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},pP(),uP();class xP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function SP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}xP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},pP(),uP(),uM();class AP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},AP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=vm.group({x:0,y:0});this._innerView.add(x);const S=new bP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:SP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=vm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}AP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let kP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ei(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};kP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const MP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let TP=class extends Tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(MP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class wP extends Ag{constructor(t){super(t)}}var CP,EP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(CP||(CP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(EP||(EP={}));class PP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},PP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},PP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new wP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new wP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new wP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(CP.OnPlay)},this.pause=()=>{this._dispatchEvent(CP.OnPause)},this.forward=()=>{this._dispatchEvent(CP.OnForward)},this.backward=()=>{this._dispatchEvent(CP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}PP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},PP.defaultAttributes={[EP.Start]:{},[EP.Pause]:{},[EP.Backward]:{},[EP.Forward]:{}};const BP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},RP=[200,10];var LP,OP;!function(t){t.Default="default",t.Reverse="reverse"}(LP||(LP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(OP||(OP={}));const IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},DP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},FP=t=>"top"===t||"bottom"===t;class jP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(FP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:RP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:RP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new bP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return FP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new PP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=FP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:RP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(FP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:FP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:FP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function zP(){uP(),aM(),SM()}jP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},BP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},BP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},BP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},BP),{key:"backward",position:"start"})}},zP();class HP extends jP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:LP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(OP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||DP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===LP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(OP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(OP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(OP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(OP.change),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var NP,VP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};zP();class GP extends jP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(OP.change))},this.play=()=>VP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(OP.play),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(OP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(NP||(NP={}));const WP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},UP=5;const YP={debounce:xt,throttle:St};aM(),gM();let KP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:YP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(NP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(NP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(NP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=WP.trigger,updateTrigger:e=WP.updateTrigger,endTrigger:i=WP.endTrigger,resetTrigger:s=WP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Xe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(NP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(NP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=UP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=vm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},$P=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},qP={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Qt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ZP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let JP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ei(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Nc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>ZP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&yg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return XP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return XP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};JP.defaultAttributes=qP;const QP=pt;function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function eB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function iB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function sB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function nB(t,e){const i=sB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function rB(t,e){const i=aB(t),s=aB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function aB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function oB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function lB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const hB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var dB,uB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(dB||(dB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(uB||(uB={}));const pB="__VCHART",gB=500,mB=500,fB=`${pB}_LABEL_LIMIT`,vB=`${pB}_LABEL_ALIGN`,_B=`${pB}_LABEL_TEXT`,yB=`${pB}_LABEL_VISIBLE`,bB=`${pB}_LABEL_X`,xB=`${pB}_LABEL_Y`,SB=`${pB}_ARC_TRANSFORM_VALUE`,AB=`${pB}_ARC_RATIO`,kB=`${pB}_ARC_START_ANGLE`,MB=`${pB}_ARC_END_ANGLE`,TB=`${pB}_ARC_K`,wB=`${pB}_ARC_MIDDLE_ANGLE`,CB=`${pB}_ARC_QUADRANT`,EB=`${pB}_ARC_RADIAN`,PB=-Math.PI/2,BB=3*Math.PI/2,RB=-90,LB=.6;var OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB,XB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(OB||(OB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(IB||(IB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(DB||(DB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(FB||(FB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(jB||(jB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(zB||(zB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(HB||(HB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(NB||(NB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(VB||(VB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(GB||(GB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(WB||(WB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(UB||(UB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(YB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",YB.AFTER_EVALUATE_DATA="afterEvaluateData",YB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",YB.AFTER_EVALUATE_SCALE="afterEvaluateScale",YB.BEFORE_PARSE_VIEW="beforeParseView",YB.AFTER_PARSE_VIEW="afterParseView",YB.BEFORE_TRANSFORM="beforeTransform",YB.AFTER_TRANSFORM="afterTransform",YB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",YB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",YB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",YB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",YB.BEFORE_STAGE_RESIZE="beforeStageResize",YB.AFTER_STAGE_RESIZE="afterStageResize",YB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",YB.AFTER_VRENDER_DRAW="afterVRenderDraw",YB.BEFORE_MARK_JOIN="beforeMarkJoin",YB.AFTER_MARK_JOIN="afterMarkJoin",YB.BEFORE_MARK_UPDATE="beforeMarkUpdate",YB.AFTER_MARK_UPDATE="afterMarkUpdate",YB.BEFORE_MARK_STATE="beforeMarkState",YB.AFTER_MARK_STATE="afterMarkState",YB.BEFORE_MARK_ENCODE="beforeMarkEncode",YB.AFTER_MARK_ENCODE="afterMarkEncode",YB.BEFORE_DO_LAYOUT="beforeDoLayout",YB.AFTER_DO_LAYOUT="afterDoLayout",YB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",YB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",YB.BEFORE_DO_RENDER="beforeDoRender",YB.AFTER_DO_RENDER="afterDoRender",YB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",YB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",YB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",YB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",YB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",YB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",YB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",YB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",YB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",YB.BEFORE_ELEMENT_STATE="beforeElementState",YB.AFTER_ELEMENT_STATE="afterElementState",YB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",YB.AFTER_ELEMENT_ENCODE="afterElementEncode",YB.ANIMATION_START="animationStart",YB.ANIMATION_END="animationEnd",YB.ELEMENT_ANIMATION_START="elementAnimationStart",YB.ELEMENT_ANIMATION_END="elementAnimationEnd",YB.ALL_ANIMATION_START="allAnimationStart",YB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(KB||(KB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(XB||(XB={}));const $B="__vgrammar_scene_item__",qB=[DB.line,DB.area],ZB=[DB.arc3d,DB.rect3d,DB.pyramid3d],JB="key",QB=[{}],tR=["key"],eR=!0,iR=!0,sR=!1,nR=!0,rR="VGRAMMAR_IMMEDIATE_ANIMATION",aR=0,oR=1e3,lR=0,hR=0,cR=!1,dR=!1,uR="quintInOut",pR={stopWhenStateChange:!1,immediatelyApply:!0},gR="_mo_hide_";function mR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function fR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return mR(t.dependency,e);var i;return[]}function vR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function _R(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function yR(t,e){return bR(t)?t.output():e[t]}const bR=t=>t&&!u(t.grammarType),xR=t=>d(t)?t:e=>e[t];function SR(t){return!!(null==t?void 0:t.scale)}function AR(t){return!!(null==t?void 0:t.field)}function kR(t,e){if(!t)return[];let i=[];return t.scale&&(i=bR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(fR(t,e))}function MR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function TR(t,e,i,s,n){i&&(vR(i)?e.forEach((e=>{const n=_R(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case DB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case DB.group:case DB.rect:case DB.image:return["width","height","y1"].includes(e);case DB.path:case DB.shape:return["path","customPath"].includes(e);case DB.line:return"defined"===e;case DB.area:return["x1","y1","defined"].includes(e);case DB.rule:return["x1","y1"].includes(e);case DB.symbol:return"size"===e;case DB.polygon:return"points"===e;case DB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(SR(l)){const t=yR(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?gb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(AR(l)){const t=gb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=_R(l,s,e.datum,t)}))})))}function wR(t,e,i,s){if(!t)return null;if(vR(t))return _R(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(SR(h)){const t=yR(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?gb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(AR(h)){const t=gb(h.field);n[r]=t(e)}else n[r]=_R(h,s,e,i)})),n}class CR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let ER=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};ER._plotMarks={},ER._marks={},ER._components={},ER._graphicComponents={},ER._transforms={},ER._grammars={},ER._glyphs={},ER._animations={},ER._interactions={},ER._graphics={},ER.registerGlyph=(t,e,i,s,n)=>(ER._glyphs[t]=new CR(e,i,s,n),ER._glyphs[t]),ER.registerAnimationType=(t,e)=>{ER._animations[t]=e},ER.getAnimationType=t=>ER._animations[t],ER.registerInteraction=(t,e)=>{ER._interactions[t]=e},ER.registerGraphic=(t,e)=>{ER._graphics[t]=e},ER.getGraphicType=t=>ER._graphics[t],ER.createGraphic=(t,e)=>{const i=ER._graphics[t];return i?i(e):null};const PR=t=>!!DB[t];function BR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=ER.getGraphicType(e)?ER.createGraphic(e,i):ER.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const RR=t=>{t&&(t[$B]=null,t.release(),t.parent&&t.parent.removeChild(t))},LR=["fillOpacity"],OR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const IR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[DB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[DB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[DB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const DR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?IR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(LR.includes(r)?OR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{LR.includes(t)?OR(n,t,e):n[t]=e[t]}));return n},FR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),jR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],zR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(jR);function HR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?zR:jR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>FR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=NR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function NR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let VR=class{constructor(t){this.data=null,this.states=[],this.diffState=IB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));TR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?DR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[$B]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?DR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===IB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(RR(this.graphicItem),this.graphicItem[$B]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=xR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(_R(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===IB.unChange&&(this.diffState=IB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,gR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[gR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||this.useStates(this.states),this.mark.markType===DB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new gl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[OB.update],a=e[OB.enter],o=e[OB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===IB.enter?(a&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.update?((n&&a||i)&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.exit&&o&&(i&&TR(this,t,a,s,l),TR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)_b(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[DB.line,DB.area,DB.largeRects,DB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||MR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[OB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=NR(h),e===DB.line||e===DB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>MR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===DB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=HR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=NR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?HR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=wR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=HR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===DB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===DB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(RR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class GR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const WR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class UR extends GR{constructor(t,e){super(t,e),this.type=UR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}UR.type="element-select",UR.defaultOptions={state:XB.selected,trigger:"click"};class YR extends GR{constructor(t,e){super(t,e),this.type=YR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},YR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function KR(t){if(t)return t.type===Iw.Band?t.bandwidth():t.type===Iw.Point?t.step():void 0}YR.type="element-highlight",YR.defaultOptions={highlightState:XB.highlight,blurState:XB.blur,trigger:"pointerover",triggerOff:"pointerout"};class XR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const $R=()=>{U(UR,XR),ER.registerInteraction(UR.type,UR)},qR=()=>{U(YR,XR),ER.registerInteraction(YR.type,YR)},ZR=(t,e)=>bR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,JR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=ZR(n,e),i}),{}):t.map((t=>ZR(t,e))):t;let QR=-1;class tL extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++QR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(fR(this.spec[e],this.view)),this.spec[e]=t,this.attach(fR(t,this.view)),this.commit(),this}}const eL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=fR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},iL=(t,e)=>{const i=ER.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(mR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>eL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return eL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},sL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=iL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},nL={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class rL extends tL{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!nL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return nL[e.type](t,i,new ya(new va))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?fR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=fR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=fR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=bR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=sL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const aL="window",oL="view",lL={trap:!1},hL="width",cL="height",dL="viewWidth",uL="viewHeight",pL="padding",gL="viewBox",mL="autoFit";function fL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function vL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,fL(t,e,n,s)}class _L{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}return this.nodes.push(t),fL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,vL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class yL{constructor(t){this.list=[],this.ids={},this.idFunc=t||mb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class bL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new yL((t=>t.uid)),this._heap=new _L(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new yL((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const xL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===DB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class SL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Qd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{zl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new iy(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Qb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ix(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function AL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function kL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function ML(t,e,i,s,n){if(n===aL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{kL(t,AL(t),!1)}))}));const e=AL(t);kL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class TL extends tL{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?_R(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},PL=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class BL extends VR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return TR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[$B]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?DR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===IB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=DR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=IR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===DB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return qB.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)_b(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[$B]=null})),this.glyphGraphicItems=null),super.release()}}const RL=t=>t.markType===DB.glyph?new BL(t):new VR(t);function LL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JB,i?t.slice().sort(i):t.slice()),{keys:tR,data:s};const n=xR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class OL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?LL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const IL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const DL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class FL extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class jL extends yc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Nd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}xc.mode|=ko.SET_ATTR_IMMEDIATELY;let zL=0;const HL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof yc||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class NL{constructor(t,e,i){this.id=zL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!ER.getAnimationType(e.type))return null;const r=ER.getAnimationType(e.type)(t,n,i);return IL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?DL(t,0,n[i].from,0,s):void 0,e.to[i]=l?DL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),IL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=HL(o);return u(o)||HL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new jL(r.from,r.to,a,t.easing):void 0:new FL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new $c(a,e))}r>0&&t.wait(r)}}function VL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(GL(i,t[i]))})),e}function GL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:aR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:dR,loop:null!==(s=h.loop)&&void 0!==s?s:cR,controlOptions:z({},pR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:oR,delay:null!==(a=h.delay)&&void 0!==a?a:lR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:hR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:uR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:aR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:dR,loop:null!==(d=t.loop)&&void 0!==d?d:cR,controlOptions:z({},pR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:lR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:hR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:uR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function WL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class UL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class YL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=VL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=VL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==IB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=GL(rR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===IB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new NL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===IB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=_R(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=WL(t.startTime,e,n),o=WL(t.totalTime,e,n),l=WL(t.oneByOne,e,n),h=WL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=WL(t.delay,e,n),l=WL(t.delayAfter,e,n),h=null!==(i=WL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:WL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===IB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===IB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===rR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===IB.exit&&0===o[IB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class KL extends tL{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new YL(this,{}),this.differ=new OL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===IB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===UB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:QB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===DB.group)return;const e=LL(null!=t?t:QB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(IB.update,t,e,i)}encodeState(t,e,i,s){if(t===IB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(vR(n))this.detach(kR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(kR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(kR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(kR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(kR(i,this.view))):vR(e)?(this.spec.encode[t]=e,this.attach(kR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(kR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=sL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return qB.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==IB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===KB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!vR(n)&&Object.keys(n).forEach((t=>{SR(n[t])&&(e[t]=yR(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];vR(s)||Object.keys(s).forEach((t=>{AR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B];if((null==s?void 0:s.mark)===this){const i=ML(this.view,t,s,0,oL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new YL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=yR(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==DB.group){if(!this.graphicItem){const t=BR(this,DB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||ZB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==DB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=xR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>JB),a=xR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>JB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===IB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=IB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):RL(this),n.diffState===IB.exit&&(n.diffState=IB.enter,this.animate.getElementAnimators(n,IB.exit).forEach((t=>t.stop("start")))),n.diffState=IB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=IB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:QB;l||this.differ.setCurrentData(LL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=wR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{this.markType===DB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:BR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==DB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=xR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>JB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=RL(this);e.diffState=IB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=RL(this);i.diffState=IB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==DB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=BR(this,DB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==IB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:IR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=IB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&RR(this.graphicItem),this.detachAll(),super.release()}}let XL=class extends KL{constructor(t,e){super(t,DB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===DB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return IR.rect}evaluateJoin(t){if(!this.elements.length){const t=RL(this);t.updateData(JB,QB,(()=>""),this.view),this.elements=[t],this.elementMap.set(JB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return TR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:BR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function $L(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function qL(t,e){return Math.min(t<0?t+e:t-1,e)}function ZL(t,e,i){let s=qL(t,i),n=qL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=qL(Math.max(0,n-1),i)):n=qL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const JL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>$L(t,i))),u=l.map((t=>$L(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=ZL(e,i,r),{start:h,end:c}=ZL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Jt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},QL={[FB.axis]:0,[FB.legend]:1,[FB.slider]:2,[FB.player]:3,[FB.datazoom]:4},tO=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=QL[t.componentType])&&void 0!==s?s:1/0},eO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=yb(r.maxChildWidth,n.width()),o=yb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=EL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dtO(t)-tO(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==DB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=eO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(dL,o),i.updateSignal(uL,l),i.updateSignal(pL,h)}else eO(t,n,a,e);else"grid"===r.display&&JL(t,n,a);iO(n,e,i)}}))};class sO extends KL{constructor(t,e,i){super(t,DB.glyph,i),this.glyphType=e,this.glyphMeta=ER.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!ER.getGraphicType(DB.glyph))return;const s=ER.createGraphic(DB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(ER.getGraphicType(n[t])){const e=ER.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const nO=Symbol.for("key");class rO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=LL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=LL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=xR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:nO})),r=LL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:nO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==nO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=_R(i.animation.delay,n,o,l),d=_R(i.animation.duration,n,o,l),u=_R(i.animation.oneByOne,n,o,l),p=_R(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Td(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Sd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>kd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Md({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Tc,null!==(l=i.easing)&&void 0!==l?l:wc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new wd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Tc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Td(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class aO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class oO extends aO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===DB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===DB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===DB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===DB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class lO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class hO extends KL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=BR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?DB.richtext:DB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}hO.markType=DB.text;const cO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},dO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},uO=Object.assign({},cO);uO.axis=Object.assign({},uO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.circleAxis=Object.assign({},uO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.grid=Object.assign({},uO.grid,{style:{stroke:"#404349"}}),uO.circleGrid=Object.assign({},uO.circleGrid,{style:{stroke:"#404349"}}),uO.rectLabel=Object.assign({},uO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.lineLabel=Object.assign({},uO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.symbolLabel=Object.assign({},uO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.title=Object.assign({},uO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const pO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:dO,components:uO},gO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:dO,components:cO};let mO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};mO._themes=new Map,mO.registerTheme("default",gO),mO.registerTheme("dark",pO);class fO extends KL{constructor(t,e,i,s){super(t,DB.component,i),this._componentDatum={[JB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:ER.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,JB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[JB]+=1}evaluateJoin(t){return this.spec.key=JB,t?(t[JB]=this._componentDatum[JB],this._componentDatum=t):this._componentDatum={[JB]:this._componentDatum[JB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class vO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B],n=ML(0,t,s,0,oL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(bR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):PR(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new TL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new rL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=ER.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=ER.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case DB.group:n=new XL(this,s);break;case DB.glyph:n=new sO(this,null==i?void 0:i.glyphType,s);break;case DB.component:n=ER.hasComponent(null==i?void 0:i.componentType)?ER.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new fO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case DB.text:n=new hO(this,t,s);break;default:n=ER.hasMark(t)?ER.createMark(t,this,s):new KL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(DB.group,t)}glyph(t,e){return this.mark(DB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(DB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.grid,mode:e})}legend(t){return this.mark(DB.component,t,{componentType:FB.legend})}slider(t){return this.mark(DB.component,t,{componentType:FB.slider})}label(t){return this.mark(DB.component,t,{componentType:FB.label})}datazoom(t){return this.mark(DB.component,t,{componentType:FB.datazoom})}player(t){return this.mark(DB.component,t,{componentType:FB.player})}title(t){return this.mark(DB.component,t,{componentType:FB.title})}scrollbar(t){return this.mark(DB.component,t,{componentType:FB.scrollbar})}customized(t,e){const i=ER.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&CL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(RR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++wL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(mO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(hL,t.width),this.updateSignal(cL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=ER.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:hL,value:null!==(s=t[hL])&&void 0!==s?s:0},{id:cL,value:null!==(n=t[cL])&&void 0!==n?n:0},{id:pL,value:EL(null!==(a=null!==(r=t[pL])&&void 0!==r?r:e[pL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:dL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[hL]-i.left-i.right},dependency:[hL,pL]}},{id:uL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[cL]-i.top-i.bottom},dependency:[cL,pL]}},{id:gL,update:{callback:(t,e)=>{const i=EL(e[pL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[dL],i.top+e[uL])},dependency:[dL,uL,pL]}},{id:mL,value:null!==(o=t[mL])&&void 0!==o?o:e[mL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===DB.glyph?{glyphType:t.glyphType}:t.type===DB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=mO.getTheme(t))&&void 0!==e?e:mO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(hL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(cL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(uL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(pL);if(arguments.length){const i=EL(t);return this.updateSignal(e,i),i}return EL(e.output())}autoFit(t){const e=this.getSignalById(mL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(gL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=UB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===DB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||iO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{xL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),xL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=eR,morph:o=iR,morphAll:l=sR,animation:h={},enableExitAnimation:c=nR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:uR,delay:null!==(i=h.delay)&&void 0!==i?i:lR,duration:null!==(s=h.duration)&&void 0!==s?s:oR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:dR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=UB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=UB.reevaluate,this._dataflow.evaluate()),this._layoutState=UB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!CL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return xL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ii(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(hL,t)),e!==this.height()&&(s=!0,this.updateSignal(cL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):PR(t)?(i.markType=t,i.source=e):i.source=t===aL?aL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=mR(l,this),v=PL(((t,e)=>{const s=c===oL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===aL&&(t=ML(0,t,e,0,aL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===oL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,oL,d))return this.addEventListener(d,v,lL),()=>{this.removeEventListener(d,v)}}else if(c===aL)return O_.addEventListener(d,v),this._eventListeners.push({type:d,source:O_,handler:v}),()=>{O_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===O_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=ER.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new SL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new aO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new oO((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new bL,this.animate=new lO(this),this._morph=new rO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[oL,aL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:mO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&O_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==DB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&O_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),ER.unregisterRuntimeTransforms(),at.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _O=()=>{bM(),uM(),ER.registerGraphic(DB.path,Yg)},yO=()=>{bM(),fM(),ER.registerGraphic(DB.rect,Pg)},bO=()=>{bM(),cM(),ER.registerGraphic(DB.rule,wg)},xO=()=>{bM(),SM(),ER.registerGraphic(DB.symbol,kg)},SO=()=>{bM(),kM(),_M(),ER.registerGraphic(DB.text,yp)},AO=()=>{bM(),nM(),ER.registerGraphic(DB.glyph,Rg)},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},MO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},TO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Ab(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},wO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ab(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},CO=kO(TO),EO=MO(TO);const PO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ab(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},BO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ab(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},RO=kO(PO),LO=MO(PO);const OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},IO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},DO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?IO:OO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},jO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},zO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class HO extends fO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const NO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class VO extends HO{constructor(t,e,i){super(t,FB.axis,e),this.spec.componentType=FB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=wR(n,e,i,s);const h=_R(this.spec.inside,s,e,i),c=_R(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(NO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=_R(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case zB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case zB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?zB.circleAxis:zB.lineAxis,this._axisComponentType}}VO.componentType=FB.axis;let GO=class extends fO{constructor(t,e){super(t,FB.label,e),this.spec.componentType=FB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=_R(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=_R(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case DB.line:case DB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case DB.rect:case DB.rect3d:case DB.interval:g=p.rectLabel;break;case DB.symbol:case DB.circle:case DB.cell:g=p.symbolLabel;break;case DB.arc:case DB.arc3d:g=p.arcLabel;break;case DB.polygon:case DB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=wR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=wR(i,t,e,d);m.push(z({},f,s))}));else{const t=wR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};GO.componentType=FB.label;const WO=()=>{ER.registerGraphicComponent(FB.label,(t=>new JT(t))),ER.registerComponent(FB.label,GO)};class UO extends HO{constructor(t,e,i){super(t,FB.grid,e),this.spec.componentType=FB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=wR(s,t,e,i);const d=_R(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case HB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case HB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=_R(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(NO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===HB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=_R(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case HB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case HB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=HB.circleAxisGrid:this._gridComponentType=HB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case zB.circleAxis:this._gridComponentType=HB.circleAxisGrid;break;case zB.lineAxis:default:this._gridComponentType=HB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?HB.lineAxisGrid:HB.circleAxisGrid:HB.lineAxisGrid}else this._gridComponentType=HB.lineAxisGrid;return this._gridComponentType}}UO.componentType=FB.grid;const YO=(t,e,i)=>e.filter((e=>t.callback(e,i))),KO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function XO(t){return t.reduce(((t,e)=>t+e),0)}const $O={min:$,max:X,average:function(t){return 0===t.length?0:XO(t)/t.length},sum:XO};function qO(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function ZO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function JO(t,e,i,s){return ZO(t,e,i,"min",s)}function QO(t,e,i,s){return ZO(t,e,i,"max",s)}function tI(t,e,i,s){return ZO(t,e,i,"average",s)}function eI(t,e,i,s){return ZO(t,e,i,"sum",s)}const iI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=qO;if("min"===n?l=JO:"max"===n?l=QO:"average"===n?l=tI:"sum"===n&&(l=eI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const sI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(gR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(gR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(gR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},nI=()=>{ER.registerTransform("filter",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{ER.registerTransform("map",{transform:KO,markPhase:"beforeJoin"},!0)},aI=()=>{ER.registerTransform("sampling",{transform:iI,markPhase:"afterEncode"},!0)},oI=()=>{ER.registerTransform("markoverlap",{transform:sI,markPhase:"afterEncode"},!0)},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},hI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},cI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},dI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},pI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},xI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},SI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},AI=(t,e,i)=>({from:{points:SI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),kI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:SI(t,e)}}),MI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),TI=(t,e,i)=>({from:{points:MI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),wI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:MI(t,e,i)}}),CI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),EI=(t,e,i)=>({from:{points:CI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),PI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:CI(t,e,i)}}),BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},LI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},OI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},II={symbol:["_mo_hide_","visible"]},DI=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=II[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{_b(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},jI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},zI=()=>{ER.registerAnimationType("clipIn",lI)},HI=()=>{ER.registerAnimationType("clipOut",hI)},NI=()=>{ER.registerAnimationType("fadeIn",cI)},VI=()=>{ER.registerAnimationType("fadeOut",dI)},GI=()=>{ER.registerAnimationType("growCenterIn",uI)},WI=()=>{ER.registerAnimationType("growCenterOut",pI)},UI=()=>{ER.registerAnimationType("growHeightIn",fI)},YI=()=>{ER.registerAnimationType("growHeightOut",vI)},KI=()=>{ER.registerAnimationType("growWidthIn",gI)},XI=()=>{ER.registerAnimationType("growWidthOut",mI)},$I=()=>{ER.registerAnimationType("growPointsIn",AI)},qI=()=>{ER.registerAnimationType("growPointsOut",kI)},ZI=()=>{ER.registerAnimationType("growPointsXIn",TI)},JI=()=>{ER.registerAnimationType("growPointsXOut",wI)},QI=()=>{ER.registerAnimationType("growPointsYIn",EI)},tD=()=>{ER.registerAnimationType("growPointsYOut",PI)},eD=()=>{ER.registerAnimationType("growAngleIn",_I)},iD=()=>{ER.registerAnimationType("growAngleOut",yI)},sD=()=>{ER.registerAnimationType("growRadiusIn",bI)},nD=()=>{ER.registerAnimationType("growRadiusOut",xI)},rD=()=>{ER.registerAnimationType("moveIn",BI)},aD=()=>{ER.registerAnimationType("moveOut",RI)},oD=()=>{ER.registerAnimationType("scaleIn",LI)},lD=()=>{ER.registerAnimationType("scaleOut",OI)},hD=()=>{ER.registerAnimationType("rotateIn",FI)},cD=()=>{ER.registerAnimationType("rotateOut",jI)},dD=()=>{ER.registerAnimationType("update",DI)};class uD extends KL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=vR(e)?null:Object.keys(e).reduce(((t,s)=>(SR(e[s])&&(t[s]=yR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=wR(e,t,i,n);if(u(r.size)){const t=s.x?KR(s.x):void 0,e=s.y?KR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(IR.symbol)}release(){super.release(),this._encoders=null}}uD.markType=DB.cell;const pD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var gD,mD,fD;t.ChartEvent=void 0,(gD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",gD.rendered="rendered",gD.renderFinished="renderFinished",gD.animationFinished="animationFinished",gD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",gD.afterInitData="afterInitData",gD.afterInitEvent="afterInitEvent",gD.afterInitMark="afterInitMark",gD.rawDataUpdate="rawDataUpdate",gD.viewDataFilterOver="viewDataFilterOver",gD.viewDataUpdate="viewDataUpdate",gD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",gD.markDeltaYUpdate="markDeltaYUpdate",gD.viewDataLabelUpdate="viewDataLabelUpdate",gD.scaleDomainUpdate="scaleDomainUpdate",gD.scaleUpdate="scaleUpdate",gD.dataZoomChange="dataZoomChange",gD.drill="drill",gD.layoutStart="layoutStart",gD.layoutEnd="layoutEnd",gD.layoutRectUpdate="layoutRectUpdate",gD.playerPlay="playerPlay",gD.playerPause="playerPause",gD.playerEnd="playerEnd",gD.playerChange="playerChange",gD.playerForward="playerForward",gD.playerBackward="playerBackward",gD.scrollBarChange="scrollBarChange",gD.brushStart="brushStart",gD.brushChange="brushChange",gD.brushEnd="brushEnd",gD.brushClear="brushClear",gD.legendSelectedDataChange="legendSelectedDataChange",gD.legendFilter="legendFilter",gD.legendItemClick="legendItemClick",gD.legendItemHover="legendItemHover",gD.legendItemUnHover="legendItemUnHover",gD.tooltipShow="tooltipShow",gD.tooltipHide="tooltipHide",gD.tooltipRelease="tooltipRelease",gD.afterResize="afterResize",gD.afterRender="afterRender",gD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(mD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",mD.window="window",mD.canvas="canvas",t.Event_Bubble_Level=void 0,(fD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",fD.chart="chart",fD.model="model",fD.mark="mark";const vD=`${pB}_waterfall_default_seriesField`,_D=`${pB}_CORRELATION_X`,yD=`${pB}_CORRELATION_Y`,bD=`${pB}_CORRELATION_SIZE`,xD=`${pB}_MEASURE_CANVAS_ID`,SD=`${pB}_DEFAULT_DATA_INDEX`,AD=`${pB}_DEFAULT_DATA_KEY`,kD=`${pB}_DEFAULT_DATA_SERIES_FIELD`,MD=`${pB}_DEFAULT_SERIES_STYLE_NAME`;var TD;t.AttributeLevel=void 0,(TD=t.AttributeLevel||(t.AttributeLevel={}))[TD.Default=0]="Default",TD[TD.Theme=1]="Theme",TD[TD.Chart=2]="Chart",TD[TD.Base_Series=3]="Base_Series",TD[TD.Series=4]="Series",TD[TD.Mark=5]="Mark",TD[TD.User_Chart=6]="User_Chart",TD[TD.User_Series=7]="User_Series",TD[TD.User_Mark=8]="User_Mark",TD[TD.User_SeriesStyle=9]="User_SeriesStyle",TD[TD.Built_In=99]="Built_In";const wD=`${pB}_STACK_KEY`,CD=`${pB}_STACK_START`,ED=`${pB}_STACK_END`,PD=`${pB}_STACK_START_PERCENT`,BD=`${pB}_STACK_END_PERCENT`,RD=`${pB}_STACK_START_OffsetSilhouette`,LD=`${pB}_STACK_END_OffsetSilhouette`,OD=`${pB}_STACK_TOTAL`,ID=`${pB}_STACK_TOTAL_PERCENT`,DD=`${pB}_STACK_TOTAL_TOP`,FD=`${pB}_SEGMENT_START`,jD=`${pB}_SEGMENT_END`;var zD,HD;t.LayoutZIndex=void 0,(zD=t.LayoutZIndex||(t.LayoutZIndex={}))[zD.Axis_Grid=50]="Axis_Grid",zD[zD.CrossHair_Grid=100]="CrossHair_Grid",zD[zD.Region=450]="Region",zD[zD.Mark=300]="Mark",zD[zD.Node=400]="Node",zD[zD.Axis=100]="Axis",zD[zD.MarkLine=500]="MarkLine",zD[zD.MarkArea=100]="MarkArea",zD[zD.MarkPoint=500]="MarkPoint",zD[zD.DataZoom=500]="DataZoom",zD[zD.ScrollBar=500]="ScrollBar",zD[zD.Player=500]="Player",zD[zD.Legend=500]="Legend",zD[zD.CrossHair=500]="CrossHair",zD[zD.Indicator=500]="Indicator",zD[zD.Title=500]="Title",zD[zD.Label=500]="Label",zD[zD.Brush=500]="Brush",zD[zD.CustomMark=500]="CustomMark",zD[zD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(HD=t.LayoutLevel||(t.LayoutLevel={}))[HD.Indicator=10]="Indicator",HD[HD.Region=20]="Region",HD[HD.Axis=30]="Axis",HD[HD.DataZoom=40]="DataZoom",HD[HD.Player=40]="Player",HD[HD.ScrollBar=40]="ScrollBar",HD[HD.Legend=50]="Legend",HD[HD.Title=70]="Title",HD[HD.CustomMark=70]="CustomMark";const ND=["linear","radial","conical"],VD={x0:0,y0:0,x1:1,y1:1},GD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},WD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},UD={linear:VD,radial:GD,conical:WD},YD={label:{name:"label",type:"text"}},KD=`${pB}_rect_x`,XD=`${pB}_rect_x1`,$D=`${pB}_rect_y`,qD=`${pB}_rect_y1`,ZD={data:!0},JD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},QD=Object.assign(Object.assign({},YD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),tF=Object.assign(Object.assign({},YD),{bar3d:{name:"bar3d",type:"rect3d"}}),eF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},iF=Object.assign(Object.assign({},YD),eF),sF=Object.assign(Object.assign({},YD),{point:{name:"point",type:"symbol"}}),nF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),aF=Object.assign(Object.assign({},YD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},YD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),lF=Object.assign(Object.assign({},YD),{rose:{name:"rose",type:"arc"}}),hF=Object.assign(Object.assign({},YD),{area:{name:"area",type:"path"}}),cF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"}}),dF=Object.assign(Object.assign({},cF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),uF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),pF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),gF=Object.assign(Object.assign({},YD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),mF=Object.assign(Object.assign({},YD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},YD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),vF=Object.assign(Object.assign({},YD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),_F=Object.assign(Object.assign({},QD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),yF=Object.assign(Object.assign({},YD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),bF=Object.assign(Object.assign({},YD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),xF=Object.assign(Object.assign({},YD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),SF=Object.assign(Object.assign({},cF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),AF=Object.assign(Object.assign({},YD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),kF=Object.assign(Object.assign({},YD),{sunburst:{name:"sunburst",type:"arc"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},tF),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),wF=Object.assign(Object.assign({},YD),{circlePacking:{name:"circlePacking",type:"arc"}}),CF=Object.assign(Object.assign({},YD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),EF=Object.assign(Object.assign({},YD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),PF=Object.assign({},nF),BF=Object.assign(Object.assign({},YD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),RF=Object.assign(Object.assign({},YD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var LF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(LF||(LF={}));const OF={[dB.bar]:QD,[dB.bar3d]:tF,[dB.line]:iF,[dB.scatter]:sF,[dB.area]:nF,[dB.radar]:rF,[dB.pie]:aF,[dB.pie3d]:oF,[dB.rose]:lF,[dB.geo]:YD,[dB.map]:hF,[dB.circularProgress]:dF,[dB.link]:uF,[dB.dot]:pF,[dB.wordCloud]:gF,[dB.wordCloud3d]:gF,[dB.funnel]:mF,[dB.funnel3d]:fF,[dB.linearProgress]:vF,[dB.waterfall]:_F,[dB.boxPlot]:yF,[dB.treemap]:bF,[dB.sankey]:xF,[dB.gauge]:SF,[dB.gaugePointer]:AF,[dB.sunburst]:kF,[dB.rangeColumn]:MF,[dB.rangeColumn3d]:TF,[dB.circlePacking]:wF,[dB.heatmap]:CF,[dB.correlation]:EF,[dB.rangeArea]:PF,[dB.liquid]:BF,[dB.venn]:RF};function IF(t){var e,i;const{type:s}=t;return s===dB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const DF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},FF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function jF(t,e){var i;if(!t)return[];const s=UF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?GF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>VF(i)?HF(t,i,e):i)).filter(p)}))):i.map((i=>VF(i)?HF(t,i,e):i)).filter(p):[]}return[]}function zF(t,e){var i,s;return GF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function HF(t,e,i){var s;const n=UF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=DF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=FF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new _e(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ce(t,i,s),a=he(n,r,e.l),l=new _e(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const NF=(t,e,i)=>{if(e&&VF(t)){const s=HF(e,t,i);if(s)return s}return t};function VF(t){return t&&"palette"===t.type&&!!t.key}function GF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function WF(t){return y(t)?{dataScheme:t}:t}function UF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=IF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class YF extends lC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!GF(this._range))return void super.range(this._range);const t=zF(this._range,this._domain);super.range(t)}}const KF={linear:BC,band:cC,point:class extends cC{constructor(t){super(!1),this.type=Iw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:lC,threshold:DC,colorOrdinal:YF};function XF(t){const e=KF[t];return e?new e:null}function $F(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function qF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ZF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function JF(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function QF(t,e,i,s=0){var n,r;return S(t)?t:JF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function tj(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=QF(t[s],e.size,i)}))})),o}function ej(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||JF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ij(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sj=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},nj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],rj={default:{dataScheme:nj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},aj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",oj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:aj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:aj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:RB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},lj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},hj=Object.assign(Object.assign({},lj),{label:{space:0}}),cj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},dj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",uj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},pj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},gj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},mj={horizontal:Object.assign(Object.assign({},pj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj}),vertical:Object.assign(Object.assign({},pj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj})},fj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},vj={horizontal:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj}),vertical:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj})},_j={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},bj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function xj(t,e){return t&&e.key in t?t[e.key]:e.default}function Sj(t){return t&&"token"===t.type&&!!t.key}const Aj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},kj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:rj,token:Aj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:oj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:mj,sizeLegend:vj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:lj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:hj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:yj,markArea:_j,markPoint:bj,polarMarkLine:yj,polarMarkArea:_j,polarMarkPoint:bj,geoMarkPoint:bj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:uj,crosshair:cj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},Mj={name:"dark",colorScheme:{default:{dataScheme:nj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Tj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Tj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Tj(t[i],e[i])))),wj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),wj(t[s],e.slice(1),i))};function Cj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof ya||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=Cj(n,e)}return s}function Ej(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Pj(t,e,r,i):Bj(t,r,s[r])}}}}function Pj(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Rj({},t[n][e.index],i):i):t[n]=s?Rj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Rj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Rj({},t[n],i):i)}))}function Oj(t,...e){return Rj(Ij(t),...e.map(Ij))}function Ij(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=WF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(OF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Dj(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Dj(t,e,i,s){if(!OF[e])return t;const n={};return Object.values(OF[e]).forEach((({type:e,name:r})=>{n[r]=Rj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Fj=["animationThreshold","colorScheme","name","padding"];function jj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Fj.includes(r)?n[r]=a:f(a)?VF(a)?n[r]=NF(a,e,s):Sj(a)?n[r]=xj(i,a):n[r]=jj(a,e,i,s):n[r]=a})),n}const zj={[kj.name]:kj},Hj=kj.name,Nj=new Map(Object.keys(zj).map((t=>[t,zj[t]]))),Vj=new Map(Object.keys(zj).map((t=>[t,jj(zj[t])]))),Gj=new Map(Object.keys(zj).map((t=>[t,t===Hj]))),Wj=(t,e)=>{if(!t)return;const i=Xj(e);Nj.set(t,i),Vj.set(t,jj(i)),Gj.set(t,!0)},Uj=(t=Hj,e=!1)=>(Gj.has(t)&&!Gj.get(t)&&Wj(t,Nj.get(t)),e?Vj.get(t):Nj.get(t)),Yj=t=>Nj.delete(t)&&Vj.delete(t)&&Gj.delete(t),Kj=t=>!!_(t)&&Nj.has(t),Xj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Hj;return Oj({},Uj(i),t)};class $j{static registerInstance(t){$j.instances.set(t.id,t)}static unregisterInstance(t){$j.instances.delete(t.id)}static getInstance(t){return $j.instances.get(t)}static instanceExist(t){return $j.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return $j.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}$j.instances=new Map;class qj{static registerTheme(t,e){Wj(t,e)}static getTheme(t,e=!1){return Uj(t,e)}static removeTheme(t){return Yj(t)}static themeExist(t){return Kj(t)}static getDefaultTheme(){return qj.themes.get(Hj)}static setCurrentTheme(t){qj.themeExist(t)&&(qj._currentThemeName=t,$j.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return qj.getTheme(qj._currentThemeName,t)}static getCurrentThemeName(){return qj._currentThemeName}}function Zj(t,e){return _(t)?qj.themeExist(t)?qj.getTheme(t,e):{}:g(t)?t:{}}function Jj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}function Qj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Qj(t[s],e)}return i}return y(t)?t.map((t=>Qj(t,e))):t}qj.themes=Nj,qj._currentThemeName=Hj;function tz(t,e){for(let i=0;it.key===e))}function iz(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},lz(t,a,n[o],l,e,r))})),s?nz(n):n}function nz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nz(t[e].nodes);return t}function rz(t,e){if("values"in t&&t.values.length){const i=iB(t.values,e),s=eB(t.values,BD);t.values.forEach((t=>{t[OD]=i,t[ID]=s,delete t[DD]}));const n=t.values.reduce(((t,e)=>e[ED]>t[ED]?e:t));n[DD]=!0}else for(const i in t.nodes)rz(t.nodes[i],e)}function az(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ED]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[CD]=s,s+=r[ED],r[ED]=s):(r[CD]=n,n+=r[ED],r[ED]=n),r[wD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r,l[BD]=0===h?0:Math.min(1,l[ED]/h)*r}}for(const s in t.nodes)oz(t.nodes[s],e,i)}function lz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[ED]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),lz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const hz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mz(t.style(e,i,s,n)):B(t.style)||(e.style=mz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mz(t.state[e]))})),e.state=i}return e}function pz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e,s,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}function gz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mz(i)}function mz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class fz{static registerChart(t,e){fz._charts[t]=e}static registerSeries(t,e){fz._series[t]=e}static registerComponent(t,e,i){fz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){fz._marks[t]=e}static registerRegion(t,e){fz._regions[t]=e}static registerTransform(t,e){fz.transforms[t]=e}static registerLayout(t,e){fz._layout[t]=e}static registerAnimation(t,e){fz._animations[t]=e}static registerImplement(t,e){fz._implements[t]=e}static registerChartPlugin(t,e){fz._chartPlugin[t]=e}static registerComponentPlugin(t,e){fz._componentPlugin[t]=e}static createChart(t,e,i){if(!fz._charts[t])return null;return new(0,fz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!fz._charts[t])return null;const i=fz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!fz._regions[t])return null;return new(0,fz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!fz._regions[t])return null;return new(0,fz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!fz._series[t])return null;return new(0,fz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!fz._series[t])return null;return new(0,fz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!fz._marks[t])return null;const s=new(0,fz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(fz._components)}static getComponentInKey(t){return fz._components[t].cmp}static getLayout(){return Object.values(fz._layout)}static getLayoutInKey(t){return fz._layout[t]}static getSeries(){return Object.values(fz._series)}static getSeriesInType(t){return fz._series[t]}static getRegionInType(t){return fz._regions[t]}static getAnimationInKey(t){return fz._animations[t]}static getImplementInKey(t){return fz._implements[t]}static getSeriesMarkMap(t){return fz._series[t]?fz._series[t].mark:{}}static getChartPlugins(){return Object.values(fz._chartPlugin)}static getComponentPlugins(){return Object.values(fz._componentPlugin)}static getComponentPluginInType(t){return fz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}fz._charts={},fz._series={},fz._components={},fz._marks={},fz._regions={},fz._animations={},fz._implements={},fz._chartPlugin={},fz._componentPlugin={},fz.transforms={fields:Or,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},fz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},fz._layout={};const vz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},_z=(t,e,i,s)=>{var n;const r=Gw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:yz(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,bz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},xz=(t,e)=>{if(!t)return null;const{x:i,y:s}=e,n=bz(t,(t=>"angle"===t.getOrient()),e),r=bz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Gw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=rB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=aB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=_z(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Gw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=rB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=aB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=_z(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function Sz(t){return"bottom"===t||"top"===t}function Az(t){return"left"===t||"right"===t}function kz(t){return"z"===t}function Mz(t,e){return ZF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Tz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function wz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Sz(t)?"linear":"band":Sz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Cz=t=>t.fieldX[0],Ez=t=>t.fieldY[0],Pz=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Bz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Rz=(t,e)=>t?e?Cz:Pz:e?Ez:Bz,Lz=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=bz(t,(t=>Sz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=bz(t,(t=>Az(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Gw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Oz(s,i,t,Rz(e,Gw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Oz(s,i,t,Rz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Oz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Iz(t,a,s)},Iz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=_z(e,t,"cartesian",null!=i?i:Sz(t.getOrient())?Cz:Ez);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Dz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Lz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=xz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Gw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return Sz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Iz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Fz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Fz||(Fz={}));const jz={[Fz.dimensionHover]:class extends Dz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!vz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Fz.dimensionClick]:class extends Dz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let zz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(jz[t]){const e=new jz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(jz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Hz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Nz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Vz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new Hz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Nz[a]&&(a=Nz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=St(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=xt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return pD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&ER.hasInteraction(e)}}function Gz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Wz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Uz=new Map;let Yz;function Kz(){Yz||(Yz=new va,Wz(Yz,"geojson",da),Wz(Yz,"topojson",pa),Gz(Yz,"simplify",Rr))}function Xz(t,e,i={type:"geojson",centroid:!0}){Uz.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),Kz();const s=new ya(Yz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Uz.set(t,s)}function $z(t){Uz.has(t)?Uz.delete(t):Jy(`map type of '${t}' does not exists.`)}function qz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Zz=(t,e)=>0===t.length?[]:1===t.length?qz(t[0],null==e?void 0:e.deep):t.map((t=>qz(t,null==e?void 0:e.deep)));function Jz(t,e,i){Gz(e=e instanceof va?e:t.dataSet,"copyDataView",Zz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:eH.copyDataView}),s}function Qz(t,e,i=[],s={}){var n,r,a;if(t instanceof ya)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new ya(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Qy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Qy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Jy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function tH(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var eH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(eH||(eH={}));const iH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:oH(this._option.mode),autoFit:!1,eventConfig:{gesture:nb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(O_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=O_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function hH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function cH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Rj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function dH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ii(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function uH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function pH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(rH||(rH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aH||(aH={}));class gH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},gH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}gH.defaultMarkInfo={};class mH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gH,this._markReverse=new gH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(rH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(rH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[rH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[rH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Fz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const fH={};Object.values(rH).forEach((t=>{fH[t]=!0}));const vH={[rH.STATE_HOVER]:rH.STATE_HOVER_REVERSE,[rH.STATE_SELECTED]:rH.STATE_SELECTED_REVERSE,[rH.STATE_DIMENSION_HOVER]:rH.STATE_DIMENSION_HOVER_REVERSE};function _H(t){return vH[t]}class yH{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=_H(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=_H(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=_H(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=_H(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class bH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class xH extends bH{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class SH extends xH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=nH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class AH extends bH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new SH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class kH extends AH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class MH extends kH{constructor(){super(...arguments),this.id=ob(),this.stateKeyToSignalName=t=>`${pB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===sH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===sH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?sH.none:sH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?sH.exit:"update"===e.diffState?sH.update:sH.appear}}}}class TH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Rj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class wH extends bH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=TH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new gH,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${pB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=fz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class CH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=tj(ej(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class EH extends wH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new CH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class PH extends TH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BH extends EH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=PH,this.modelType="region",this.specKey="region",this.type=BH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new yH,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new mH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aH)B(t.stateStyle[aH[e]])||this.interaction.registerMark(aH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function RH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function LH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function OH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function IH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),OH(c,!0,u,o),s&&LH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function DH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),OH(c,!1,u,a),s&&LH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function jH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"left"),n.length&&IH(n,e,i,!0,"left"),r.length&&DH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"top"),n.length&&FH(n,e,i,!0,"top"),r.length&&jH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"right"),n.length&&IH(n,e,i,!0,"right"),r.length&&DH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"bottom"),n.length&&FH(n,e,i,!0,"bottom"),r.length&&jH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}zH.type="base";const HH=["line","area","trail"];function NH(t){return HH.includes(t)}class VH extends kH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(NH)?s:!t.mark||NH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!fH[t])).map((t=>[t,10])),s=!t.mark||NH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(pB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(pB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(Nw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class GH extends xH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=nH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class WH extends GH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${pB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class UH extends xH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=nH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new VH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new zz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new WH(t)}stateKeyToSignalName(t){return`${pB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=rH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=rH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===sH.appear&&this.runAnimationByState(sH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(sH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class YH extends UH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,te)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Rj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=XF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):ND.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Vw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},UD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=_e.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)ND.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class KH extends YH{constructor(){super(...arguments),this.type=KH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}KH.type="group";const XH=()=>{bM(),aM(),ER.registerGraphic(DB.group,Cu),fz.registerMark(KH.type,KH)},$H={type:"fadeIn"};function qH(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return $H;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ZH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},JH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},QH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},tN=()=>{fz.registerAnimation("scaleInOut",(()=>JH))},eN=()=>{fz.registerAnimation("fadeInOut",(()=>QH))},iN=(t,e)=>({appear:qH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Wc,duration:ZH.update.duration,easing:ZH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),sN=()=>{fz.registerAnimation("line",iN)},nN=()=>{vO.useRegisters([$I,qI,ZI,JI,QI,tD,zI,HI])},rN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Aj.fontFamily,fontSize:Aj.fontSize}))(e,i,s).measure(t)};class aN{static instance(){return aN.instance_||(aN.instance_=new aN),aN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class oN{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class lN extends oN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class hN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>fz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>fz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>fz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return fz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>fz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){fz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}static getFunction(t){return t?aN.instance().getFunction(t):null}static getFunctionList(){return aN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=fz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=fz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Uz.get(e);var e}static hideTooltip(t=[]){$j.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=xt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=sb(p);v?Rx(th):"node"===p&&PA(th),v&&d&&(this._container=_(d)?O_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=qj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new lH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Vz(this,this._compiler),this._event=new zz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),$j.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Rj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Jj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;hN.getFunctionList()&&hN.getFunctionList().length&&(t=Qj(t,hN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=fz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return dH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:gB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:mB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof va?t:new va,Wz(this._dataSet,"dataview",ga),Wz(this._dataSet,"array",s),Gz(this._dataSet,"stackSplit",iH),Gz(this._dataSet,"copyDataView",Zz);for(const t in fz.transforms)Gz(this._dataSet,t,fz.transforms[t]);for(const t in fz.dataParser)Wz(this._dataSet,t,fz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(d=this._compiler)||void 0===d||d.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?sH.appear:sH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,$j.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof ya?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Qz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=uH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Rj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=Zj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Oj({},Zj(this._currentThemeName,!0),Zj(s,!0),Zj(n,!0));this._currentTheme=t}else{const t=Oj({},Zj(this._currentThemeName),Zj(s),Zj(n));this._currentTheme=jj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Zj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield hH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ij(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ij(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return aN.instance().getFunction(t)}registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}getFunctionList(){return aN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=fz.getChartPlugins();t.length>0&&(this._chartPlugin=new lN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}hN.InstanceManager=$j,hN.ThemeManager=qj,hN.globalConfig={uniqueTooltip:!0},hN.Utils=rN,hN.vglobal=O_;fz.registerRegion("region",BH),fz.registerLayout("base",zH),XH(),vO.useRegisters([nI,rI]),vO.useRegisters([oD,lD,NI,VI,rD,aD,hD,cD,dD]),qR(),$R(),Wj(Mj.name,Mj),at.getInstance(rt.Error);const cN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(dB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=fz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=fz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},dN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=cN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Tj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Rj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Rj(m,f),hasChanged:!0};const i=Rj({},t,f);wj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class uN{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const pN=t=>{fz.registerChartPlugin(t.type,t)};class gN extends uN{constructor(){super(gN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[gN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[gN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=Cj(this._option.globalInstance.getSpec(),["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Cj(this._baseChartSpec,["data",gN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=dN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=Cj(i,["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}gN.pluginType="chart",gN.specKey="media",gN.type="MediaQueryPlugin";const mN=/\{([^}]+)\}/,fN=/\{([^}]+)\}/g,vN=/:/;class _N extends uN{constructor(){super(_N.type),this.type="formatterPlugin",this._timeModeFormat={utc:di.getInstance().timeUTCFormat,local:di.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=yi.getInstance().format,this._numericSpecifier=yi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[_N.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),fz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=mN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(fN,((t,i)=>{if(!vN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(fi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}_N.pluginType="chart",_N.specKey="formatter",_N.type="formatterPlugin";const yN=()=>{pN(_N)};function bN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function xN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function SN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function AN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function kN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function MN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const TN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return FC(v)};class wN extends uN{constructor(){super(wN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Nw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&bN(c)&&bN(d)))return;const u=xN(t,c),p=xN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!AN(u,p))return}else if(0===y&&0===b){if(!AN(p,u))return}else if(_||A)if(_&&!A){if(!SN(u,p))return}else if(A&&!_){if(!SN(p,u))return}else{if(m===b)return;if(m>b){if(!kN(u,p))return}else if(!kN(p,u))return}else{if(0===m&&0===y){if(!MN(u,p))return}else if(0===b&&0===g&&!MN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Gz(e.getOption().dataSet,"tickAlign",TN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}wN.pluginType="component",wN.type="AxisSyncPlugin";const CN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,EN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ym||(ym=vm.CreateGraphic("richtext",{})),ym.setAttributes(a),ym.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},PN="vchart-tooltip-container",BN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function RN(t,e){return R(e,`component.${t}`)}function LN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=fz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const ON={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function IN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function DN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function FN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function jN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?RN("axisBand",i):["linear","log","symlog"].includes(e)?RN("axisLinear",i):{})&&void 0!==s?s:{},r=Sz(t)?RN("axisX",i):Az(t)?RN("axisY",i):RN("axisZ",i);return Rj({},RN("axis",i),n,r)},HN=(t,e,i)=>{var s;const n=null!==(s="band"===e?RN("axisBand",i):"linear"===e?RN("axisLinear",i):{})&&void 0!==s?s:{},r=RN("angle"===t?"axisAngle":"axisRadius",i);return Rj({},RN("axis",i),n,r)},NN=t=>"band"===t||"ordinal"===t||"point"===t;function VN(t,e){return{id:t,label:t,value:e,rawValue:t}}function GN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function WN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const UN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Gw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Nw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=WN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=IN(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Gw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Nw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=WN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=IN(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(KN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&YN(t,"top",r.label),e.visible&&YN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(KN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&YN(t,"left",a.label),e.visible&&YN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},YN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=LN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},KN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},XN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=qN(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},$N=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=qN(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},qN=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},ZN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},JN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},QN=(t,e)=>{var i,s;return null!==(s=null===(i=JN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},tV=(t,e)=>{var i,s;return null!==(s=null===(i=JN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},eV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=UN(3,e,i,s,n,r,a);return o?XN(r,o,d,h):l?$N(a,l,u,c):void 0},iV={fontFamily:Aj.fontFamily,spacing:10,wordBreak:"break-word"};function sV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:iV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},rV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,aV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),oV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function lV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=hV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>aV(i,s)(t)&&aV(n,r)(t)&&(u(a)||aV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(u.id),d}return"none"}const hV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=rV(c,t);let _=rV(d,t);const y=oV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(aV(c,v));if(!y&&(_=rV(d,i),!oV(_)))return;const n=e.type===dB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Gw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(aV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=rV(d,o),!oV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(aV(c,n));if(!y&&(_=rV(d,r),!oV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===dB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(aV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=rV(d,i),!oV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},cV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const dV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class uV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class pV extends uV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:mV(e.title,{seriesId:this.series.id},!0),content:fV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=cV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const gV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},mV=(t,e,i)=>p(t)?d(t)?(...s)=>gV(t(...s),e,i):gV(t,e,i):void 0,fV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>gV(t,e,i))):gV(t,e,i))):void 0;return s},vV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=dV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=dV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},_V=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=yV(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&cV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},yV=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),bV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},xV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=LN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},AV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class kV{}kV.dom=`${pB}_TOOLTIP_HANDLER_DOM`,kV.canvas=`${pB}_TOOLTIP_HANDLER_CANVAS`;const MV=20,TV={key:"其他",value:"..."},wV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=di.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},CV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=AV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==SV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:wV(SV(c,t,i,v),p,g),valueStyle:SV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=MV}=t,x=t.othersLine?Object.assign(Object.assign({},TV),t.othersLine):TV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=EV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=EV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},EV=(t,e,i)=>{const s=wV(SV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=wV(SV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==SV(e.visible,t,i)&&(p(s)||p(n)),a=SV(e.isKeyAdaptive,t,i),o=SV(e.spaceRow,t,i),l=SV(e.shapeType,t,i),h=SV(e.shapeColor,t,i),c=SV(e.shapeFill,t,i),d=SV(e.shapeStroke,t,i),u=SV(e.shapeLineWidth,t,i),g=SV(e.shapeHollow,t,i),m=SV(e.keyStyle,t,i),f=SV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class PV extends uN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=AV(x.position,b,e),M=null!==(n=AV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:gB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:mB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(sb(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=CN(t,e),j=CN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=eV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(QN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=eV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(tV(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=ZN(t,c),N=ZN(i,c),V=ZN(e,c),G=ZN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=ZN(t,c):Y(t),S(e)||d(e)?N=ZN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(QN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(tV(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,sb(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===QN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===QN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===tV(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===tV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(QN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(tV(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,St(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},BN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:BN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:BN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ei(d.padding),x=ej(d.padding),S=sV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=sV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=sV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:nV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Rj({},A,sV(b,void 0,{})),{width:s,height:n,text:r}=EN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Rj({},k,sV(x,void 0,{})),{width:e,height:s,text:n}=EN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Rj({},S,sV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=EN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(sb(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=CN(t,s),u=CN(l,c)}return s*=d,n*=d,sb(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(De(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Xe([c,a,o],r.x,r.y)||Xe([c,l,h],r.x,r.y)||Xe([c,a,h],r.x,r.y)||Xe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}PV.specKey="tooltip";const BV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",RV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let LV;const OV=(t=document.body)=>{if(u(LV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),LV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return LV};function IV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Rj({},e,t),s={};return s.width=BV(i),s}(C),R=DV(E),L=DV(P),{bottom:O,left:I,right:D,top:F}=ej(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:BV(T+2*M),minHeight:BV(g+2*M),paddingBottom:BV(O),paddingLeft:BV(I),paddingRight:BV(D),paddingTop:BV(F),borderColor:k,borderWidth:BV(M),borderRadius:BV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?BV(null==r?void 0:r.spaceRow):"0px"},DV(Rj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return FV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=FV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==ib?void 0:ib.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(FV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}FV.type="tooltipModel";const jV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},zV={boxSizing:"border-box"},HV={display:"inline-block",verticalAlign:"top"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},GV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},WV={lineHeight:"normal",boxSizing:"border-box"};class UV extends FV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=RV(u),y=t=>new Ag({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class YV extends FV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const KV={overflowWrap:"normal",wordWrap:"normal"};class XV extends FV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Rj({},HV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Rj({},o?VV:NV,Object.assign(Object.assign(Object.assign({height:BV(l)},KV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Rj({},GV,Object.assign(Object.assign(Object.assign({height:BV(s)},KV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Rj({},WV,Object.assign(Object.assign({height:BV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class $V extends FV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new XV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Rj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+RV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+OV(this._option.getContainer())}px`,maxHeight:BV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class qV extends FV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new UV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new YV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Rj({},jV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const ZV="99999999999999";class JV extends FV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:ZV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new qV(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new $V(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Rj({},zV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const QV=t=>{fz.registerComponentPlugin(t.type,t)};class tG extends PV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(tG.type),this.type=kV.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(ib&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=IV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!si(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}tG.type=kV.dom;class eG extends PV{constructor(){super(eG.type),this.type=kV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new JP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}eG.type=kV.canvas;const iG=()=>{QV(eG)},sG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},nG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tz([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return aG(a,n,o)},aG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t};class lG extends GH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hG=`${pB}_HIERARCHY_DEPTH`,cG=`${pB}_HIERARCHY_ROOT`,dG=`${pB}_HIERARCHY_ROOT_INDEX`;function uG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pG(t,e,i){t&&(i.needDefaultSeriesField&&(t[kD]=i.defaultSeriesField),t[SD]=e,t[AD]=i.getKey(t,e,i))}function gG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mG(t,e,i,s=0,n,r){void 0===r&&(r=e),pG(t,e,i),t[hG]=s,t[cG]=n||t[i.categoryField],t[dG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mG(e,s,i,t[hG]+1,t[cG],r)))}const fG=["appear","enter","update","exit","disappear","normal"];function vG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return SG(n)&&delete n.type,n.oneByOne&&(n=yG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Rj({},o[e],a);return SG(n)&&delete n.type,n.oneByOne&&(n=yG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function _G(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),AG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function yG(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function bG(t,e){var i,s;return null!==(i=null==t?void 0:t[SD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function xG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function SG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function AG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),AG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),AG(t[i],e)}function kG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class MG extends TH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=IF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Dj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Rj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Rj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Rj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class TG extends wH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${pB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=MG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=kG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"invalidTravel",oG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Qz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Jz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Jz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=aG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Gz(this._dataSet,"dimensionStatistics",rG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ya(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tz(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Gz(this._dataSet,"dimensionStatistics",rG);const s=new ya(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tz(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tz(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ya(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",sG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=vG({},_G(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Rj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Rj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:rH.STATE_HOVER_REVERSE,highlightState:rH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:rH.STATE_SELECTED_REVERSE,state:rH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:kD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:MD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,MD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new pV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},ZD),JD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>JD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ya||tH(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();kG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:kD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new YF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return jF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:kD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Rj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:AD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ED&&t!==BD&&t!==CD&&t!==PD||(t=this.getStackValueField()),null!==(e=iz(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=OF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:kD]}}function wG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Nw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function CG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}TG.mark=YD,TG.transformerConstructor=MG;class EG extends TG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Nw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${pB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(BD),this.setFieldX2(PD)):(this.setFieldY(BD),this.setFieldY2(PD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(LD),this.setFieldX2(RD)):(this.setFieldY(LD),this.setFieldY2(RD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(wG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const PG="monotone",BG="linear";class RG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(eF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:BG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===PG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(eF.point,{morph:xG(this._spec,eF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new ya(this._option.dataSet,{name:`${pB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[eF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Rj({},this._spec[eF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class LG extends YH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Vw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class OG extends LG{constructor(){super(...arguments),this.type=OG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===dB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}OG.type="line";const IG=()=>{fz.registerMark(OG.type,OG),bM(),cM(),ER.registerGraphic(DB.line,wg),nN()};class DG extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class FG extends DG{constructor(){super(...arguments),this.type=FG.type}}FG.type="symbol";const jG=()=>{fz.registerMark(FG.type,FG),xO()};class zG extends MG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class HG extends oN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function NG(t,e,i,s){switch(t){case r.cartesianBandAxis:return zN(Mz(i,["z"]),"band",e);case r.cartesianLinearAxis:return zN(Mz(i,["z"]),"linear",e);case r.cartesianLogAxis:return zN(Mz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return zN(Mz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return zN(Mz(i),void 0,e);case r.polarBandAxis:return HN(i.orient,"band",e);case r.polarLinearAxis:return HN(i.orient,"linear",e);case r.polarAxis:return HN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=RN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>Sz(t.orient)));let d;d=p(c)?Rj({},NN(c.type)?a:o,l):l;const u=n.find((t=>Az(t.orient)));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=RN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Rj({},NN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return VG(i,RN(t,e));default:return RN(t,e)}}const VG=(t,e)=>{var i;const s=Rj({},e,e[Tz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class GG extends TH{getTheme(t,e){return NG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},ej(e)),{[s]:0}))}}class WG extends EH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new HG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=GG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof rc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}WG.transformerConstructor=GG;class UG extends YH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(DB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}UG.type="component";const YG=()=>{fz.registerMark(UG.type,UG)},KG=t=>t;class XG extends WG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?HB.circleAxisGrid:HB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=vG(null===(o=fz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new GH(this._option,t)]}collectData(t,e){const i=[];return oB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Nw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return oB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(oB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uz(s=t.domainLine)).startSymbol=uz(s.startSymbol),s.endSymbol=uz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mz(Rj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mz(t.tick.style)),t.tick.state&&(i.tick.state=pz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mz(t.subTick.style)),t.subTick.state&&(i.subTick.state=pz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=ON[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Rj({},d,mz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mz(h.style)}),h.state&&(i.title.state.shape=pz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mz(o.style)}),o.state&&(i.title.state.background=pz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mz(t.background.style)),t.background.state&&(i.panel.state=pz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mz(Rj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=LN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Wz(this._option.dataSet,"scale",KG),Gz(this._option.dataSet,"ticks",qC);return new ya(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}XG.specKey="axes";const $G=()=>{ER.registerGraphicComponent(zB.lineAxis,((t,e)=>new Lw(t,e))),ER.registerGraphicComponent(zB.circleAxis,(t=>new Fw(t))),ER.registerComponent(FB.axis,VO),ER.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new tE(t,e))),ER.registerGraphicComponent(HB.circleAxisGrid,((t,e)=>new iE(t,e))),ER.registerComponent(FB.grid,UO),YG(),fz.registerAnimation("axis",(()=>({appear:{custom:zw},update:{custom:jw},exit:{custom:Xc}})))},qG=[wN];class ZG extends XG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{const e=this.getOrient();Sz(e)?t.setXAxisHelper(this.axisHelper()):Az(e)?t.setYAxisHelper(this.axisHelper()):kz(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Rj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Rj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Sz(this.getOrient()),n=t=>{var e;return(s?!Sz(t.getOrient()):Sz(t.getOrient()))&&Nw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=Mz(i,["z"]),kz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!FN(e))return null;const{axisType:t,componentName:s}=wz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!FN(t))return;const{axisType:s,componentName:n}=wz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];Sz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):kz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(qG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){Sz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Sz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!kz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Sz(this.getOrient())?t.fieldX:kz(this.getOrient())?t.fieldZ:t.fieldY,Nw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(Sz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Sz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return oB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:Sz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:kz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();oB(this._regions,(e=>{Sz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Az(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):kz(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Sz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=Sz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Rj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return VN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=DN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=JG?10:n>=QG?5:n>=tW?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class iW extends ZG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}iW.type=r.cartesianLinearAxis,iW.specKey="axes",U(iW,eW);const sW=()=>{$G(),fz.registerComponent(iW.type,iW)};class nW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=VN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>VN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class rW extends ZG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=eC(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$G(),fz.registerComponent(rW.type,rW)};class oW extends iW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{Sz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Rj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new GH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=di.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>VN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>VN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}oW.type=r.cartesianTimeAxis,oW.specKey="axes";class lW extends iW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new OC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}lW.type=r.cartesianLogAxis,lW.specKey="axes",U(lW,eW);class hW extends iW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new IC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}hW.type=r.cartesianSymlogAxis,hW.specKey="axes",U(hW,eW);class cW extends EG{constructor(){super(...arguments),this.type=dB.line,this.transformerConstructor=zG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),_G("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=CG(this);this._symbolMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_G("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}cW.type=dB.line,cW.mark=iF,cW.transformerConstructor=zG,U(cW,RG);class dW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{tH(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ya)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class uW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tz(e,[{key:t,operations:Nw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tz(e,[{key:i.field,operations:Nw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?XF("colorOrdinal"):XF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Nw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Nw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Nw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Nw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class pW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=sz(t,!0);for(const e in a)for(const i in a[e].nodes)oz(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)az(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class gW extends bH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:gB,height:mB},this._viewRect={width:gB,height:mB},this._viewBox={x1:0,y1:0,x2:gB,y2:mB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=ej(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new zz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new dW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new pW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=fz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=fz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof YH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof YH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&tH(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=dH(this._spec,this._option,{width:gB,height:mB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=jF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new uW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){uH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=jF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{uH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,uH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):uH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=tj(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(rH.STATE_SELECTED)}clearHovered(){this.clearState(rH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Fz.dimensionHover||s===Fz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Gw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class fW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);wj(t,r,l.spec),wj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));wj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=fz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class vW extends fW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Rj(i,pH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class _W extends vW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class yW extends gW{constructor(){super(...arguments),this.transformerConstructor=_W,this.type="line",this.seriesType=dB.line,this._canStack=!0}}yW.type="line",yW.seriesType=dB.line,yW.transformerConstructor=_W;class bW extends LG{constructor(){super(...arguments),this.type=bW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}bW.type="area";const xW=()=>{fz.registerMark(bW.type,bW),bM(),tM(),ER.registerGraphic(DB.area,$g),nN()};class SW extends pV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const AW=()=>{fz.registerAnimation("area",iN),sN(),tN()};class kW extends zG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Rj({},m.style,g.style),l.state=Rj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class MW extends EG{constructor(){super(...arguments),this.type=dB.area,this.transformerConstructor=kW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(MW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===PG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return $F(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return $F(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),_G("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),_G("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=CG(this);this._symbolMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_G("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new SW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}MW.type=dB.area,MW.mark=nF,MW.transformerConstructor=kW,U(MW,RG);class TW extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class wW extends gW{constructor(){super(...arguments),this.transformerConstructor=TW,this.type="area",this.seriesType=dB.area,this._canStack=!0}}wW.type="area",wW.seriesType=dB.area,wW.transformerConstructor=TW;function CW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CW(t,e)}),PW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:CW(t,e)}),BW={type:"fadeIn"},RW={type:"growCenterIn"};function LW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BW;case"scaleIn":return RW;default:return EW(t)}}class OW extends YH{constructor(){super(...arguments),this.type=OW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}OW.type="rect";const IW=()=>{fz.registerMark(OW.type,OW),yO(),vO.useRegisters([UI,YI,KI,XI,GI,WI])};function DW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):$F(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[XD]):$F(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):$F(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[qD]):$F(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},zW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:xG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(zW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Gz(this._option.dataSet,"addVChartProperty",sG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Gz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ya(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=qD,s=$D,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=XD,s=KD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)DW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=$F(this[n](t),o),d=$F(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[CD],n=t[ED],r=t[PD],h=t[BD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[CD]:i,[ED]:s}),a?{[PD]:o,[BD]:l}:void 0);t.push(Pg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>$F(this._dataToPosY(t),a),y1:t=>$F(this._dataToPosY1(t),a)}:{y:t=>$F(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>$F(this._dataToPosX(t),r),x1:t=>$F(this._dataToPosX1(t),r)}:{x:t=>$F(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=CG(this);this._barMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),_G(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=sj(this._spec.barWidth,a)),l&&(c=Math.max(c,sj(this._spec.barMinWidth,a))),h&&(c=Math.min(c,sj(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sj(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=Nw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}zW.type=dB.bar,zW.mark=QD,zW.transformerConstructor=jW;const HW=()=>{aI(),IW(),fz.registerAnimation("bar",((t,e)=>({appear:LW(t,e),enter:EW(t,!1),exit:PW(t,!1),disappear:PW(t)}))),aW(),sW(),fz.registerSeries(zW.type,zW)};class NW extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),cH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class VW extends gW{constructor(){super(...arguments),this.transformerConstructor=NW,this.type="bar",this.seriesType=dB.bar,this._canStack=!0}}VW.type="bar",VW.seriesType=dB.bar,VW.transformerConstructor=NW;class GW extends YH{constructor(){super(...arguments),this.type=GW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}GW.type="rect3d";class WW extends zW{constructor(){super(...arguments),this.type=dB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}WW.type=dB.bar3d,WW.mark=tF;class UW extends NW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class YW extends VW{constructor(){super(...arguments),this.transformerConstructor=UW,this.type="bar3d",this.seriesType=dB.bar3d}}YW.type="bar3d",YW.seriesType=dB.bar3d,YW.transformerConstructor=UW;const KW=[10,20],XW=Iw.Linear,$W="circle",qW=Iw.Ordinal,ZW=["circle","square","triangle","diamond","star"],JW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class QW extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class tU extends EG{constructor(){super(...arguments),this.type=dB.scatter,this.transformerConstructor=QW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${pB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${pB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:XW,defaultRange:KW},"size")}getShapeAttribute(t,e){return u(e)?$W:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qW,defaultRange:ZW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(tU.mark.point,{morph:xG(this._spec,tU.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=CG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),_G("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:$W},rH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}tU.type=dB.scatter,tU.mark=sF,tU.transformerConstructor=QW;const eU=()=>{jG(),fz.registerAnimation("scatter",((t,e)=>Object.assign({appear:JW(0,e)},JH))),aW(),sW(),fz.registerSeries(tU.type,tU)};class iU extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class sU extends gW{constructor(){super(...arguments),this.transformerConstructor=iU,this.type="scatter",this.seriesType=dB.scatter,this._canStack=!0}}sU.type="scatter",sU.seriesType=dB.scatter,sU.transformerConstructor=iU;Ln();const nU={},rU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function aU(t,e){t&&_(t)||ub("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(nU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ln().projection(s),s.copy=s.copy||function(){const t=i();return rU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),nU[i]||null}const oU={albers:Jn,albersusa:function(){var t,e,i,s,n,r,a=Jn(),o=Zn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Zn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(oU).forEach((t=>{aU(t,oU[t])}));const lU="Feature",hU="FeatureCollection";function cU(t){const e=Y(t);return 1===e.length?e[0]:{type:hU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===hU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===lU?t:{type:lU,geometry:t}))}(e))),[])}}const dU=rU.concat(["pointRadius","fit","extent","size"]);function uU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{dU.includes(s)&&(i=i.concat(fR(t[s],e)))})),i):i}let pU=class extends tL{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(fR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(fR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(fR(this.spec.size,this.view)),this.spec.size=t,this.attach(fR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(fR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(fR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(fR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(fR(t,this.view)),this.commit(),this}configure(t){return this.detach(uU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(uU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=aU((t||"mercator").toLowerCase());return e||ub("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),rU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,_R(this.spec[t],e,aU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(_R(this.spec.pointRadius,e,aU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=cU(_R(this.spec.fit,e,aU));this.spec.extent?this.projection.fitExtent(_R(this.spec.extent,e,aU),t):this.spec.size&&this.projection.fitSize(_R(this.spec.size,e,aU),t)}return this.projection}output(){return this.projection}};const gU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class mU extends TG{constructor(){super(...arguments),this.type=dB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${pB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const fU=`${pB}_MAP_LOOK_UP_KEY`,vU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[SD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[fU]=e.nameMap[n]:t[fU]=n})),t.features);class _U extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class yU extends YH{constructor(){super(...arguments),this.type=yU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}yU.type="path";const bU=()=>{fz.registerMark(yU.type,yU),_O()};class xU{constructor(t){this.projection=aU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class SU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class AU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function kU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:SU}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:AU}:null}const MU={debounce:xt,throttle:St};class TU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),kU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return kU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,MU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,MU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||kU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:De({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,MU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,MU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){kU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;De({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||kU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=MU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=MU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function wU(t,e){return`${pB}_${e}_${t}`}class CU extends WG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:wU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Rj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new xU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===dB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),oB(this._regions,(t=>{var e;if(t.type===dB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new oe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===dB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}CU.type=r.geoCoordinate,U(CU,TU);const EU=()=>{fz.registerComponent(CU.type,CU)};class PU extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class BU extends mU{constructor(){super(...arguments),this.type=dB.map,this.transformerConstructor=PU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Uz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Gz(this._dataSet,"copyDataView",Zz),Gz(this._dataSet,"map",vU),Gz(this._dataSet,"lookup",gU);const i=Uz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ya(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:eH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:fU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lG(this._option,s)}initMark(){this._pathMark=this._createMark(BU.mark.area,{morph:xG(this._spec,BU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:kD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(vG(null===(t=fz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),_G("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new _U(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[SD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[SD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new oe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new oe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return SD}getActiveMarks(){return[this._pathMark]}}BU.type=dB.map,BU.mark=hF,BU.transformerConstructor=PU;const RU=()=>{ER.registerGrammar("projection",pU,"projections"),EU(),bU(),fz.registerSeries(BU.type,BU),fz.registerImplement("registerMap",Xz),fz.registerImplement("unregisterMap",$z),eN()},LU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[DD]=!0:delete t[DD]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=OU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=IU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Kt(_,e)):(t[c]=+y,y=Kt(y,e)),t[d]=Kt(t[c],e),f=Kt(f,e),b=Xt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=OU(a,t,n,r,h,l,i,e),r.push(n)})),r};function OU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=IU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Kt(i.positive,e)):(t[h]=+i.negative,i.negative=Kt(i.negative,e)),t[c]=Kt(t[h],e),i.end=Kt(i.end,e)}i.isTotal=e,(u(p)||p===vD)&&(t[vD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function IU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Kt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const DU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Kt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},FU={type:"fadeIn"},jU={type:"growCenterIn"};function zU(t,e){switch(e){case"fadeIn":return FU;case"scaleIn":return jU;default:return EW(t,!1)}}class HU extends YH{constructor(){super(...arguments),this.type=HU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}HU.type="rule";const NU=()=>{fz.registerMark(HU.type,HU),bO()},VU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:GU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function GU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>GU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class WU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ya(e instanceof va?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Gz(e,"dimensionTree",VU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class UU extends jW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const YU={rect:ZU,symbol:$U,arc:QU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=$U(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tY,line:eY,area:eY,rect3d:ZU,arc3d:QU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function KU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=LN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function XU(t){return d(t)?e=>t(e.data):t}function $U(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QU(t){var e;const{labelSpec:i}=t,s=null!==(e=XU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tY(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=KU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),yp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class iY extends zW{constructor(){super(...arguments),this.type=dB.waterfall,this.transformerConstructor=UU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new WU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=vD)}getSeriesKeys(){return this._seriesField===vD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Gz(this._dataSet,"waterfallFillTotal",DU),Gz(this._dataSet,"waterfall",LU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Jz(this.getViewData(),this._dataSet,{name:`${pB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:CD,endAs:ED,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=CG(this);this._barMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),_G("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(iY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tY(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?$F(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):$F(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}iY.type=dB.waterfall,iY.mark=_F,iY.transformerConstructor=UU;const sY=()=>{NU(),IW(),fz.registerAnimation("waterfall",((t,e)=>({appear:zU(t,e),enter:EW(t,!1),exit:PW(t,!1),disappear:PW(t,!1)}))),eN(),aW(),sW(),fz.registerSeries(iY.type,iY)},nY=`${pB}_BOX_PLOT_OUTLIER_VALUE`;var rY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(rY||(rY={}));const aY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[nY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class oY extends pV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===rY.OUTLIER)return this.series.getOutliersField();if(t===rY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case rY.MIN:return this.series.getMinField();case rY.MAX:return this.series.getMaxField();case rY.MEDIAN:return this.series.getMedianField();case rY.Q1:return this.series.getQ1Field();case rY.Q3:return this.series.getQ3Field();case rY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===rY.OUTLIER)return e[nY];if(t===rY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case rY.MIN:return e[this.series.getMinField()];case rY.MAX:return e[this.series.getMaxField()];case rY.MEDIAN:return e[this.series.getMedianField()];case rY.Q1:return e[this.series.getQ1Field()];case rY.Q3:return e[this.series.getQ3Field()];case rY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[nY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(rY.OUTLIER),value:this.getContentValue(rY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(rY.MAX),value:this.getContentValue(rY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.Q3),value:this.getContentValue(rY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.MEDIAN),value:this.getContentValue(rY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.Q1),value:this.getContentValue(rY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.MIN),value:this.getContentValue(rY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.SERIES_FIELD),value:this.getContentValue(rY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class lY extends YH{constructor(){super(...arguments),this.type=lY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}lY.type="boxPlot";const hY=()=>{fz.registerMark(lY.type,lY),ER.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(wO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ab(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ab(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),ER.registerAnimationType("boxplotScaleIn",CO),ER.registerAnimationType("boxplotScaleOut",EO),AO(),yO(),bO(),ER.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(BO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),ER.registerAnimationType("barBoxplotScaleIn",RO),ER.registerAnimationType("barBoxplotScaleOut",LO),AO(),yO(),bO()};class cY extends EG{constructor(){super(...arguments),this.type=dB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(cY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(cY.mark.outlier,{progressive:t,key:SD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,rH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>$F(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>$F(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>$F(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>$F(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>$F(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},rH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>$F(e(this.getDatumPositionValues(t,nY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>$F(e(this.getDatumPositionValues(t,nY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,rH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"foldOutlierData",aY),Gz(this._dataSet,"addVChartProperty",sG);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${pB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._outlierDataView=new lG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=CG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=fz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(_G("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(vG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(vG(null===(a=fz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new oY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}cY.type=dB.boxPlot,cY.mark=yF;class dY extends YH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=dY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}dY.type="text";const uY=()=>{fz.registerMark(dY.type,dY),SO(),bM(),_M(),ER.registerGraphic(DB.richtext,Gg)};function pY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class gY extends pV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const mY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),fY={type:"fadeIn"},vY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function _Y(t,e){return"fadeIn"===e?fY:mY(t)}class yY extends jW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class bY extends zW{constructor(){super(...arguments),this.type=dB.rangeColumn,this._barMarkType="rect",this._barName=dB.bar,this.transformerConstructor=yY}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(bY.mark.bar,{morph:xG(this._spec,bY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(bY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(bY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});pY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});pY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=CG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),_G("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(vG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),_G("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new gY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}bY.type=dB.rangeColumn,bY.mark=MF,bY.transformerConstructor=yY;const xY=()=>{IW(),uY(),fz.registerAnimation("rangeColumn",((t,e)=>({appear:_Y(t,e),enter:mY(t),exit:vY(t),disappear:vY(t)}))),eN(),aW(),sW(),fz.registerSeries(bY.type,bY)};class SY extends bY{constructor(){super(...arguments),this.type=dB.rangeColumn3d,this._barMarkType="rect3d",this._barName=dB.bar3d}}SY.type=dB.rangeColumn3d,SY.mark=TF;class AY extends pV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class kY extends MW{constructor(){super(...arguments),this.type=dB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(kY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new AY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}kY.type=dB.rangeArea,kY.mark=PF;class MY extends TG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=LB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Nw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Nw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&wG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const TY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{asStartAngle:s,asEndAngle:n,asMiddleAngle:r,asRadian:a,asRatio:o,asQuadrant:l,asK:h}=e,c=e.angleField(),d=e.startAngle(),u=e.endAngle(),p=e.minAngle(),g=(t,e,i)=>{t[s]=e,t[n]=e+i,t[r]=e+i/2,t[a]=i,t[l]=function(t){return(t=re(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[c]))),y=u-d;let b=d,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[SB],s=m?i/m:0;let n=s*y;n{g(e,d+i*t,t)}))}else{const t=x/S;b=d,i.forEach((e=>{const i=e[a]===p?p:e[SB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][n]=u),i};function wY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const CY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:wY(t,!0,sH.appear)}),EY={type:"fadeIn"},PY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:wY(t,!0,sH.enter)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:wY(t,!0,sH.exit)}),RY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:wY(t,!0,sH.exit)});function LY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return EY;case"growRadius":return CY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return CY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class OY extends YH{constructor(t,e){super(t,e),this.type=IY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>se({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[wB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class IY extends OY{constructor(){super(...arguments),this.type=IY.type}}IY.type="arc";const DY=()=>{bM(),Jk(),ER.registerGraphic(DB.arc,Jg),vO.useRegisters([sD,nD,eD,iD]),fz.registerMark(IY.type,IY)};class FY extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Rj({},this._theme,i,t);const n=(t,e)=>Rj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const jY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:RB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:LB,layoutRadius:e.layoutRadius}},zY=(t,e,i,s=0,n=0*Math.PI)=>{if(S(t))return t;if(d(t))return t(e(),i());const r=e();return"auto"===t&&r.width>0&&r.height>0?ae(r,i(),s,n):Math.min(r.width/2,r.height/2)};class HY extends MY{constructor(){super(...arguments),this.transformerConstructor=FY,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}},this._startAngle=PB,this._endAngle=BB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[wB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return se(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?te(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?te(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?te(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Gz(this._dataSet,"pie",TY),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?te(this._spec.minAngle):0,asStartAngle:kB,asEndAngle:MB,asRatio:AB,asMiddleAngle:wB,asRadian:EB,asQuadrant:CB,asK:TB}},!1);const e=new ya(this._dataSet,{name:`${pB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},HY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:xG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:AD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return cB(kB)(t)}endAngleScale(t){return cB(MB)(t)}_computeLayoutRadius(){return zY(this._spec.layoutRadius,this.getLayoutRect,this.getCenter,this._startAngle,this._endAngle)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:qF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:qF(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:cB(yB).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[wB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return se(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===sH.appear)return this._startAngle;if(i===sH.disappear)return this._endAngle;const n=[sH.disappear,sH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[SD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[wB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[wB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[wB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[wB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}HY.transformerConstructor=FY,HY.mark=aF;class NY extends HY{constructor(){super(...arguments),this.type=dB.pie}}NY.type=dB.pie;const VY=()=>{DY(),fz.registerAnimation("pie",((t,e)=>({appear:LY(t,e),enter:PY(t),exit:BY(t),disappear:RY(t)}))),fz.registerSeries(NY.type,NY)};class GY extends OY{constructor(){super(...arguments),this.type=GY.type,this._support3d=!0}}GY.type="arc3d";class WY extends FY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class UY extends HY{constructor(){super(...arguments),this.type=dB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=WY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[wB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}UY.type=dB.pie3d,UY.mark=oF,UY.transformerConstructor=WY;const YY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},KY={type:"fadeIn"},XY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),$Y=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),qY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function ZY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return KY;case"growAngle":return YY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return YY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class JY extends MY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(ED),this.setInnerRadiusField(CD)}setValueFieldToPercent(){this.setRadiusField(BD),this.setInnerRadiusField(PD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class QY extends MG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class tK extends XG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!jN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=jY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s,n;const r=[],a=[];return e.forEach(((e,o)=>{if(!jN(e))return;const{axisType:l,componentName:h,startAngle:c,endAngle:d,center:u,outerRadius:p,layoutRadius:g}=jY(e,t);e.center=u,e.startAngle=c,e.endAngle=d,e.outerRadius=p,e.type=l,e.layoutRadius=g;const m={spec:e,specPath:[this.specKey,o],specInfoPath:["component",this.specKey,o],type:h};i.push(m),"radius"===e.orient?(r.push(m),n=o):(a.push(m),s=o)})),r.forEach((t=>{t.angleAxisIndex=s})),a.forEach((t=>{t.radiusAxisIndex=n})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=PB,this._endAngle=BB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:IN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){oB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Nw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return se(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>VN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=qt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return zY(this._spec.layoutRadius,this.getRefLayoutRect,this.getCenter,this._startAngle,this._endAngle)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=LB,e=0;const i=this.getChart().getSpec();return oB(this.getRegions(),(s=>{const n=s;if(r=n.type,[dB.rose,dB.radar,dB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Rj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Rj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}tK.type=r.polarAxis,tK.specKey="axes";class eK extends tK{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}eK.type=r.polarLinearAxis,eK.specKey="axes",U(eK,eW);const iK=()=>{$G(),fz.registerComponent(eK.type,eK)};class sK extends tK{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}sK.type=r.polarBandAxis,sK.specKey="axes",U(sK,nW);const nK=()=>{$G(),fz.registerComponent(sK.type,sK)};class rK extends JY{constructor(){super(...arguments),this.type=dB.rose,this.transformerConstructor=QY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(rK.mark.rose,{morph:xG(this._spec,rK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>$F(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=$F(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),_G("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rK.type=dB.rose,rK.mark=lF,rK.transformerConstructor=QY;const aK=()=>{fz.registerSeries(rK.type,rK),DY(),fz.registerAnimation("rose",((t,e)=>({appear:ZY(t,e),enter:XY(t),exit:$Y(t),disappear:qY(t)}))),nK(),iK()};class oK extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,QP(this._fromAngle,this._toAngle)&&QP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class lK extends Wc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=re(s.angle),a=re(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=re(o.angle),c=re(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new $t(m,f,v,_);return y.defined=e.defined,y}}const hK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cK(t,e,i){return"fadeIn"===e?hK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dK(t,e,i){return"fadeIn"===e?hK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const uK=(t,e)=>({custom:Yc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class pK extends JY{constructor(){super(...arguments),this.type=dB.radar,this.transformerConstructor=zG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(pK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:BG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?te(this._spec.startAngle):PB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),_G("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=fz.getAnimationInKey(e);t.setAnimationConfig(vG(null==i?void 0:i(n,r),_G(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}pK.type=dB.radar,pK.mark=rF,pK.transformerConstructor=zG,U(pK,RG);const gK=()=>{fz.registerSeries(pK.type,pK),oI(),xW(),IG(),jG(),fz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cK(t,e,"in"),enter:cK(t,e,"in"),exit:cK(t,e,"out"),disappear:"clipIn"===e?void 0:cK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:lK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:oK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarGroup",((t,e)=>({appear:uK(t,"in"),disappear:uK(t,"out")}))),Jk(),nK(),iK()};class mK extends pV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>di.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const fK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},vK={fill:"#bbb",fillOpacity:.2};class _K extends EG{constructor(){super(...arguments),this.type=dB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Gz(this._option.dataSet,"objFlat",fK),Gz(this._option.dataSet,"copyDataView",Zz),Wz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:eH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Rj(vK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(_K.mark.group),this._containerMark=this._createMark(_K.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(_K.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(_K.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(_K.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(_K.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(_K.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(_K.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new YF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:kD}}initTooltip(){this._tooltipHelper=new mK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}_K.type=dB.dot,_K.mark=pF;class yK extends pV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>di.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const bK=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class xK extends EG{constructor(){super(...arguments),this.type=dB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Gz(this._option.dataSet,"linkDotInfo",bK),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:eH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(xK.mark.group),this._containerMark=this._createMark(xK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(xK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(xK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new yK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}xK.type=dB.link,xK.mark=uF;class SK extends MY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:FD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ED:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?te(n):PB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):BB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[ED]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(SK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+te(s),n=te(i)/2;return Jg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Pg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const MK=()=>{fz.registerAnimation("circularProgress",((t,e)=>({appear:kK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class TK extends MG{constructor(){super(...arguments),this._supportStack=!0}}class wK extends SK{constructor(){super(...arguments),this.type=dB.circularProgress,this.transformerConstructor=TK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(wK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(wK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ED:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),_G("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}wK.type=dB.circularProgress,wK.mark=dF,wK.transformerConstructor=TK;function CK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const EK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:CK(t)}),PK={type:"fadeIn"};function BK(t,e){return!1===e?{}:"fadeIn"===e?PK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CK(t)}))(t)}class RK extends pV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class LK extends EG{constructor(){super(...arguments),this.type=dB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(LK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return $F(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(LK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(LK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=$F(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Pg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=$F(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Pg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),_G("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new RK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}LK.type=dB.linearProgress,LK.mark=vF;const OK=()=>{IW(),fz.registerAnimation("linearProgress",((t,e)=>({appear:BK(t,e),enter:{type:"grow"},disappear:EK(t)}))),eN(),fz.registerSeries(LK.type,LK)},IK=[0],DK=[20,40],FK=[200,500],jK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},zK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],HK=`${pB}_WORD_CLOUD_WEIGHT`,NK=`${pB}_WORD_CLOUD_TEXT`;class VK extends TG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=DK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:FK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:IK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?NK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:jK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:IK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!zK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(VK.mark.word,{key:AD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(vG(fz.getAnimationInKey("wordCloud")(n,s),_G("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new YF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new BC,o=this._fontWeightRange;if(r){const[e,i]=vb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:HK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:NK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:sb(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:AD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:HK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:AD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:HK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}VK.mark=gF;function GK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||ZH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function UK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function YK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const KK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function XK(t){return d(t)?t:function(){return t}}class $K{constructor(t){var e,i,s;switch(this.options=z({},$K.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,WK[s]?WK[s]():WK.circle()),this.getText=null!==(e=XK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=XK(this.options.fontWeight),this.getTextFontSize=XK(this.options.fontSize),this.getTextFontStyle=XK(this.options.fontStyle),this.getTextFontFamily=XK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>KK(10,50);break;case"random-light":this.getTextColor=()=>KK(50,90);break;default:this.getTextColor=XK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return te(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return te(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class ZK extends $K{constructor(t){var e;super(z({},ZK.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=ZK.defaultOptions.minFontSize&&(this.options.minFontSize=ZK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=qK[this.options.spiral])&&void 0!==e?e:qK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=XK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=YK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(O_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(eX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(tX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}eX(p,this._size)&&(p=iX(p,this._size))}else if(eX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||QK(p,i))&&(!i||!JK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function JK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function QK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,eX=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function iX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=YK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}nX.defaultOptions={enlarge:!1};const aX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},oX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?lX(t.fontFamily):"sans-serif",d=t.fontStyle?lX(t.fontStyle):"normal",u=t.fontWeight?lX(t.fontWeight):"normal",p=t.rotate?lX(t.rotate):0,g=lX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?lX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||aX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?lX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=cX(dX(t,l),C);w=i=>e(t(i))}let E=ZK;"fast"===t.layoutType?E=nX:"grid"===t.layoutType&&(E=sX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},lX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],hX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),cX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=hX(t[0]),s=hX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(hX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},dX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function uX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{ER.registerTransform("wordcloud",{transform:oX,markPhase:"beforeJoin"},!0),uY(),fz.registerAnimation("wordCloud",((t,e)=>({appear:GK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),fz.registerSeries(pX.type,pX)};(class extends VK{constructor(){super(...arguments),this.type=dB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(VK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),_G("word",this._spec,this._markAttributeContext)))}}).type=dB.wordCloud3d;const mX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},fX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},vX=`${pB}_FUNNEL_TRANSFORM_RATIO`,_X=`${pB}_FUNNEL_REACH_RATIO`,yX=`${pB}_FUNNEL_HEIGHT_RATIO`,bX=`${pB}_FUNNEL_VALUE_RATIO`,xX=`${pB}_FUNNEL_LAST_VALUE_RATIO`,SX=`${pB}_FUNNEL_NEXT_VALUE_RATIO`,AX=`${pB}_FUNNEL_LAST_VALUE`,kX=`${pB}_FUNNEL_CURRENT_VALUE`,MX=`${pB}_FUNNEL_NEXT_VALUE`,TX=`${pB}_FUNNEL_TRANSFORM_LEVEL`,wX=20;class CX extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[_X])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class EX extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class PX extends EX{constructor(){super(...arguments),this.type=PX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}PX.type="polygon";const BX=()=>{fz.registerMark(PX.type,PX),bM(),gM(),ER.registerGraphic(DB.polygon,em),vO.useRegisters([$I,qI])};class RX extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class LX extends TG{constructor(){super(...arguments),this.type=dB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=RX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"funnel",mX),Gz(this._dataSet,"funnelTransform",fX);const t=new ya(this._dataSet,{name:`${pB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:kX,asTransformRatio:vX,asReachRatio:_X,asHeightRatio:yX,asValueRatio:bX,asNextValueRatio:SX,asLastValueRatio:xX,asLastValue:AX,asNextValue:MX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:TX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},LX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:xG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},LX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(LX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(LX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new CX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*cB(_X).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),_G("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(vG(fz.getAnimationInKey("fadeInOut")(),_G(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(vG(fz.getAnimationInKey("funnel")({},o),_G(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(vG(null===(a=fz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),_G("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[xX])/2:this._getSecondaryAxisLength(t[bX])/2,n=this._getSecondaryAxisLength(t[bX])/2):(s=this._getSecondaryAxisLength(t[bX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[SX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[TX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[AD]===t[AD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?wX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{BX(),uY(),NU(),fz.registerSeries(LX.type,LX),fz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},QH))),fz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Kc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Kc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),eN()};class IX extends EX{constructor(){super(...arguments),this.type=IX.type}}IX.type="pyramid3d";class DX extends RX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class FX extends LX{constructor(){super(...arguments),this.type=dB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=DX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},FX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},FX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(FX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(FX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}FX.type=dB.funnel3d,FX.mark=fF,FX.transformerConstructor=DX;const jX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zX=t=>{const e=t.mark.elements.filter((t=>t.diffState===IB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},NX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=HX(r,s,n);return jX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=HX(r,s,n);return jX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},GX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=VX(r);return jX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=VX(r);return jX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),WX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},UX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):UX(t.children,e,i)))})),e};function YX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=$X(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,wt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},qX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=qX(t.children,e,t,n))})),s},ZX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=ZX(t.children,e,t,n)),n=e(t,s,i,n)})),n},JX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:YX,slice:KX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?KX:YX)(t,e,i,s,n)}};class QX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},QX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?gb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?XX(this.options.aspectRatio):null!==(e=JX[this.options.splitType])&&void 0!==e?e:JX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=$X(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}QX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const t$=(t,e)=>{const i=new QX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return UX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},e$={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class i${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];YX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),e$);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},i$.defaultOpionts,t):Object.assign({},i$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+yb(this.options.center[0],t.width),s=t.y0+yb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>yb(t,n))):yb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>yb(t,n))):yb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=yb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=$X(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=se({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}i$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const s$=4294967296;function n$(t,e){let i,s;if(o$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function o$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function d$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function u$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function p$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function g$(t){return{_:t,next:null,prev:null}}function m$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];d$(n,s,r);let a,o,l,h,c,d,u,p=g$(s),g=g$(n),m=g$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=$X(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%s$)/s$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:y$.defaultOpionts.nodeSort;qX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)qX([o],f$(h)),ZX([o],v$(this._getPadding,.5,a)),qX([o],_$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);qX([o],f$(y$.defaultOpionts.setRadius)),ZX([o],v$(fb,1,a)),c&&ZX([o],v$(this._getPadding,o.radius/t,a)),qX([o],_$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}y$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const b$=(t,e={})=>{if(!t)return[];const i=[];return UX(t,i,e),i},x$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new i$(i).layout(t,{width:s,height:n})};class S$ extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var A$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(A$||(A$={}));const k$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===A$.DrillDown){return Y(hz(t,n,s,"children"))}if(i.type===A$.DrillUp){const e=cz(t,n,s,"children");if(e)return Y(e)}return t};class M${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=kU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Gz(t,"drillFilter",k$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:A$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:A$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:A$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:A$.DrillUp},model:this}),r}}class T$ extends MY{constructor(){super(...arguments),this.type=dB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"sunburstLayout",x$),Gz(this._dataSet,"flatten",b$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",sG),t.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(T$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(T$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new S$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}T$.type=dB.sunburst,T$.mark=kF,U(T$,M$);const w$=()=>{fz.registerSeries(T$.type,T$),DY(),uY(),eN(),fz.registerAnimation("sunburst",((t,e)=>({appear:WX(0,e),enter:NX(t),exit:GX(t),disappear:GX(t)})))},C$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new y$(i).layout(t,{width:s,height:n})};class E$ extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const P$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class B$ extends EG{constructor(){super(...arguments),this.type=dB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"circlePackingLayout",C$),Gz(this._dataSet,"flatten",b$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",sG),t.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(B$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(B$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}B$.type=dB.circlePacking,B$.mark=wF,U(B$,M$);const R$=()=>{fz.registerSeries(B$.type,B$),DY(),uY(),tN(),fz.registerAnimation("circlePacking",((t,e)=>({appear:P$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},L$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=L$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function O$(t){return t.depth}function I$(t,e){return e-1-t.endDepth}const D$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),F$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},j$={left:O$,right:I$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:O$,end:I$},z$=yt(0,1);class H${constructor(t){this._ascendingSourceBreadth=(t,e)=>D$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>D$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},H$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):j$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};kb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),kb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];L$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[F$(s[t.source]),F$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*z$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(D$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(D$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new H$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},V$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&V$(t,e.children,i)}))},G$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},W$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new H$(e),r=[];return r.push(n.layout(s,i)),r},U$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},Y$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class K$ extends pV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const X$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),$$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:X$(t),q$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class Z$ extends YH{constructor(){super(...arguments),this.type=Z$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}Z$.type="linkPath";const J$=()=>{ER.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(DO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),ER.registerAnimationType("linkPathGrowIn",FO),ER.registerAnimationType("linkPathGrowOut",jO),ER.registerAnimationType("linkPathUpdate",zO),AO(),_O(),fz.registerMark(Z$.type,Z$)};class Q$ extends EG{constructor(){super(...arguments),this.type=dB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Jt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(rH.STATE_SANKEY_EMPHASIS),e.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS)):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(rH.STATE_SANKEY_EMPHASIS),s.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Gz(this._dataSet,"sankeyLayout",W$),Gz(this._dataSet,"sankeyFormat",G$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:eH.sankeyLayout});const{dataSet:a}=this._option;Gz(a,"sankeyNodes",U$),Gz(a,"flatten",b$);const o=new ya(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._nodesSeriesData=new lG(this._option,o),Gz(a,"sankeyLinks",Y$);const l=new ya(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._linksSeriesData=new lG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Q$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(Q$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(Q$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},rH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),_G("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),_G("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(vG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),_G("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([rH.STATE_SANKEY_EMPHASIS_REVERSE,rH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new K$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new YF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return V$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}Q$.type=dB.sankey,Q$.mark=xF;const tq=()=>{ER.registerTransform("sankey",{transform:N$,markPhase:"beforeJoin"},!0),IW(),J$(),uY(),fz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:$$(t,e)},QH))),fz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:q$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),eN(),fz.registerSeries(Q$.type,Q$)},eq=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=b$(n);return i=rG([{latestData:r}],e),i};class iq extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const sq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class nq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class rq extends EG{constructor(){super(...arguments),this.type=dB.treemap,this.transformerConstructor=nq,this._viewBox=new Jt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new oe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:AD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",sG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Gz(this._dataSet,"hierarchyDimensionStatistics",eq),Gz(this._dataSet,"flatten",b$);const i=new ya(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(rq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(rq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new iq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}rq.type=dB.treemap,rq.mark=bF,rq.transformerConstructor=nq,U(rq,M$),U(rq,TU);const aq=()=>{IW(),uY(),fz.registerAnimation("treemap",((t,e)=>({appear:sq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),eN(),ER.registerTransform("treemap",{transform:t$,markPhase:"beforeJoin"},!0),fz.registerSeries(rq.type,rq)},oq={type:"fadeIn"};function lq(t,e){return"fadeIn"===e?oq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class hq extends MG{constructor(){super(...arguments),this._supportStack=!1}}class cq extends SK{constructor(){super(...arguments),this.type=dB.gaugePointer,this.transformerConstructor=hq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(cq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},cq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(cq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),_G("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}cq.type=dB.gaugePointer,cq.mark=AF,cq.transformerConstructor=hq;const dq=()=>{fz.registerSeries(cq.type,cq),bU(),IW(),fz.registerAnimation("gaugePointer",((t,e)=>{const i=lq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),nK(),iK()};class uq extends MG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class pq extends SK{constructor(){super(...arguments),this.type=dB.gauge,this.transformerConstructor=uq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=te(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Gz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[jD]=t[this._angleField[0]],t[FD]=e>0?i[e-1][jD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(pq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(pq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[FD])?this.angleAxisHelper.dataToPosition([t[FD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[jD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),_G("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}pq.type=dB.gauge,pq.mark=SF,pq.transformerConstructor=uq;class gq extends DG{constructor(){super(...arguments),this.type=gq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}gq.type="cell";const mq=()=>{fz.registerMark(gq.type,gq),bM(),SM(),ER.registerGraphic(DB.cell,kg),ER.registerMark(DB.cell,uD)};function fq(t){return!1===t?{}:{type:"fadeIn"}}class vq extends pV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class _q extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class yq extends EG{constructor(){super(...arguments),this.type=dB.heatmap,this.transformerConstructor=_q}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(yq.mark.cell,{morph:xG(this._spec,yq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(yq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ei(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=CG(this);this._cellMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),_G("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new vq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}yq.type=dB.heatmap,yq.mark=CF,yq.transformerConstructor=_q;const bq=()=>{uY(),mq(),fz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},QH),{appear:fq(e)}))),aW(),sW(),fz.registerSeries(yq.type,yq)},xq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=te(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=te(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=yb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=yb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+yb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+yb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=gb(e.field),C=t.map(w),[E,P]=vb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:gb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?vb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=Sq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),Aq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Aq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[SD]:null==n?void 0:n[SD],[kD]:null==n?void 0:n[kD]}};class Mq extends YH{constructor(){super(...arguments),this.type=Mq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Mq.type="ripple";const Tq=()=>{fz.registerMark(Mq.type,Mq),ER.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),AO(),xO()},wq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Cq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Eq extends MY{constructor(){super(...arguments),this.type=dB.correlation,this.transformerConstructor=Cq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Gz(this._dataSet,"correlation",xq);const s=new va;Wz(s,"dataview",ga),Gz(s,"correlationCenter",kq);const n=new ya(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(Eq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:SD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(Eq.mark.ripplePoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Eq.mark.centerPoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[_D],y:t=>t[yD],size:t=>t[bD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),_G("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Eq.type=dB.correlation,Eq.mark=EF,Eq.transformerConstructor=Cq;const Pq=()=>{jG(),Tq(),fz.registerSeries(Eq.type,Eq),fz.registerAnimation("correlation",((t,e)=>Object.assign({appear:wq(0,e)},JH)))};class Bq extends YH{constructor(){super(...arguments),this.type=Bq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Bq.type="liquid";const Rq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Lq extends pV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Oq extends TG{constructor(){super(...arguments),this.type=dB.liquid,this.transformerConstructor=zG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=kg({x:s,y:n,size:r,symbolType:Rq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=ej(this._spec.outlineMargin),this._paddingSpec=ej(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Oq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Oq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Oq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Oq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Lq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),_G("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),_G("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Oq.type=dB.liquid,Oq.mark=BF,Oq.transformerConstructor=zG;const Iq=t=>Y(t).join(",");class Dq extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Iq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Iq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Fq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class jq extends TG{constructor(){super(...arguments),this.type=dB.venn,this.transformerConstructor=Fq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:AD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(jq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(jq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},rH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},rH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Iq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},rH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Iq(t.sets)},rH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Dq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Iq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Iq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Iq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Iq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}}jq.type=dB.venn,jq.mark=RF,jq.transformerConstructor=Fq;class zq extends fW{_isValidSeries(t){return t===dB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class Hq extends gW{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="map",this.seriesType=dB.map}}Hq.type="map",Hq.seriesType=dB.map,Hq.transformerConstructor=zq;class Nq extends fW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Vq extends Nq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=DN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Rj({},s,l)),n&&Object.assign(o,Rj({},n,o))}}class Gq extends Nq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Wq extends Nq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,layoutRadius:t.layoutRadius})}}class Uq extends gW{constructor(){super(...arguments),this.transformerConstructor=Wq}}Uq.transformerConstructor=Wq;class Yq extends Uq{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="pie",this.seriesType=dB.pie}}Yq.type="pie",Yq.seriesType=dB.pie,Yq.transformerConstructor=Wq;class Kq extends Wq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Xq extends Uq{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="pie3d",this.seriesType=dB.pie3d}}Xq.type="pie3d",Xq.seriesType=dB.pie3d,Xq.transformerConstructor=Kq;class $q extends Gq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:LB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:LB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class qq extends gW{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="rose",this.seriesType=dB.rose,this._canStack=!0}}qq.type="rose",qq.seriesType=dB.rose,qq.transformerConstructor=$q;class Zq extends Gq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Rj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Jq extends gW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="radar",this.seriesType=dB.radar,this._canStack=!0}}Jq.type="radar",Jq.seriesType=dB.radar,Jq.transformerConstructor=Zq;class Qq extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Rj(e,pH(this.type,t))})),this._transformAxisSpec(t)}}class tZ extends gW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="common",this._canStack=!0}}tZ.type="common",tZ.transformerConstructor=Qq;class eZ extends vW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class iZ extends gW{constructor(){super(...arguments),this.transformerConstructor=eZ,this._canStack=!0}}iZ.transformerConstructor=eZ;class sZ extends eZ{transformSpec(t){super.transformSpec(t),cH(t)}}class nZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="histogram",this.seriesType=dB.bar}}nZ.type="histogram",nZ.seriesType=dB.bar,nZ.transformerConstructor=sZ;class rZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="histogram3d",this.seriesType=dB.bar3d}}rZ.type="histogram3d",rZ.seriesType=dB.bar3d,rZ.transformerConstructor=sZ;class aZ extends Vq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class oZ extends gW{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="circularProgress",this.seriesType=dB.circularProgress,this._canStack=!0}}oZ.type="circularProgress",oZ.seriesType=dB.circularProgress,oZ.transformerConstructor=aZ;class lZ extends Vq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:dB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===dB.gauge||t.type===dB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===dB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class hZ extends gW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="gauge",this.seriesType=dB.gaugePointer}}hZ.type="gauge",hZ.seriesType=dB.gaugePointer,hZ.transformerConstructor=lZ;class cZ extends fW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dZ extends gW{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}dZ.transformerConstructor=cZ;class uZ extends cZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class pZ extends dZ{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}pZ.type="wordCloud",pZ.seriesType=dB.wordCloud,pZ.transformerConstructor=uZ;class gZ extends cZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class mZ extends dZ{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="wordCloud3d",this.seriesType=dB.wordCloud3d}}mZ.type="wordCloud3d",mZ.seriesType=dB.wordCloud3d,mZ.transformerConstructor=gZ;class fZ extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class vZ extends gW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="funnel",this.seriesType=dB.funnel}}vZ.type="funnel",vZ.seriesType=dB.funnel,vZ.transformerConstructor=fZ;class _Z extends gW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="funnel3d",this.seriesType=dB.funnel3d}}_Z.type="funnel3d",_Z.seriesType=dB.funnel3d,_Z.transformerConstructor=fZ;class yZ extends vW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=DN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=DN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class bZ extends gW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="linearProgress",this.seriesType=dB.linearProgress,this._canStack=!0}}bZ.type="linearProgress",bZ.seriesType=dB.linearProgress,bZ.transformerConstructor=yZ;class xZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),cH(t)}}class SZ extends gW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="rangeColumn",this.seriesType=dB.rangeColumn}}SZ.type="rangeColumn",SZ.seriesType=dB.rangeColumn,SZ.transformerConstructor=xZ;class AZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class kZ extends gW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="rangeColumn3d",this.seriesType=dB.rangeColumn3d}}kZ.type="rangeColumn3d",kZ.seriesType=dB.rangeColumn3d,kZ.transformerConstructor=AZ;class MZ extends fW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:RB,i=p(t.endAngle)?t.endAngle:e+ee(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=dB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class TZ extends gW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="sunburst",this.seriesType=dB.sunburst}}TZ.type="sunburst",TZ.seriesType=dB.sunburst,TZ.transformerConstructor=MZ;class wZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=dB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CZ extends gW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="circlePacking",this.seriesType=dB.circlePacking}}CZ.type="circlePacking",CZ.seriesType=dB.circlePacking,CZ.transformerConstructor=wZ;class EZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class PZ extends gW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="treemap",this.seriesType=dB.treemap}}PZ.type="treemap",PZ.seriesType=dB.treemap,PZ.transformerConstructor=EZ;class BZ extends NW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),cH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class RZ extends VW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="waterfall",this.seriesType=dB.waterfall}}RZ.type="waterfall",RZ.seriesType=dB.waterfall,RZ.transformerConstructor=BZ;class LZ extends vW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),cH(t)}}class OZ extends gW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="boxPlot",this.seriesType=dB.boxPlot}}OZ.type="boxPlot",OZ.seriesType=dB.boxPlot,OZ.transformerConstructor=LZ;class IZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class DZ extends gW{constructor(){super(...arguments),this.transformerConstructor=IZ,this.type="sankey",this.seriesType=dB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}DZ.type="sankey",DZ.seriesType=dB.sankey,DZ.transformerConstructor=IZ;class FZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),cH(t)}}class jZ extends gW{constructor(){super(...arguments),this.transformerConstructor=FZ,this.type="rangeArea",this.seriesType=dB.rangeArea}}jZ.type="rangeArea",jZ.seriesType=dB.rangeArea,jZ.transformerConstructor=FZ;class zZ extends vW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class HZ extends gW{constructor(){super(...arguments),this.transformerConstructor=zZ,this.type="heatmap",this.seriesType=dB.heatmap}}HZ.type="heatmap",HZ.seriesType=dB.heatmap,HZ.transformerConstructor=zZ;class NZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=dB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class VZ extends gW{constructor(){super(...arguments),this.transformerConstructor=NZ,this.type="correlation",this.seriesType=dB.correlation}}VZ.type="correlation",VZ.seriesType=dB.correlation,VZ.transformerConstructor=NZ;function GZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mz(t.style)),B(t.textStyle)||Rj(s.textStyle,mz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mz(s.background.style),s}const WZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},UZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:kD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class YZ extends WG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=ZF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new GH(this._option,e),this._initSelectedData(),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(oB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Rj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}YZ.specKey="legends";class KZ extends YZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Gz(this._option.dataSet,"discreteLegendFilter",UZ),Gz(this._option.dataSet,"discreteLegendDataMake",WZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return oB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iz(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=GZ(s)),B(n.focusIconStyle)||mz(n.focusIconStyle),n.shape&&(n.shape=uz(n.shape)),n.label&&(n.label=uz(n.label)),n.value&&(n.value=uz(n.value)),n.background&&(n.background=uz(n.background)),JF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),JF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),JF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mz(r.railStyle),B(r.sliderStyle)||mz(r.sliderStyle)):(B(r.textStyle)||mz(r.textStyle),r.handler&&uz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Rj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return fP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(hP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(hP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(hP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=LN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=LN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}KZ.specKey="legends",KZ.type=r.discreteLegend;const XZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},$Z=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function qZ(t){return"color"===t||"size"===t}const ZZ={color:xP,size:AP},JZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],QZ=[2,10];class tJ extends YZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return qZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{qZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Gz(this._option.dataSet,"continuousLegendFilter",$Z),Gz(this._option.dataSet,"continuousLegendDataMake",XZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iz(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iz(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?JZ:QZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Rj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=GZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=mz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=mz(r.style)),B(a.style)||(w.trackStyle=mz(a.style)),w.startText=uz(o),w.endText=uz(l),w.handlerText=uz(h),B(c)||(w.sizeBackground=mz(c)),d.visible&&!B(d.style)&&(Rj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return ZZ[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}tJ.specKey="legends",tJ.type=r.continuousLegend;class eJ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Lz(n,a,!0))&&void 0!==e?e:[],...null!==(i=xz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Gw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=cV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=cV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(yV(s).every((t=>{var e;return!cV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=cV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=vV(t,i,s),m=_V(t,i,s),f=Rj({},I(e[t]),m),v=g.title,_=xV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=mV(f.title,Object.assign(Object.assign({},v),_)):f.title=mV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=bV(y);f.content=fV(f.content,(e=>xV(e,f,u.shape,t)))}else f.content=fV(y,(t=>xV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=CV(a,t,e),l=!!p(o)&&!1!==AV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class iJ extends eJ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class sJ extends eJ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class nJ extends eJ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const rJ=t=>p(t)&&!y(t),aJ=t=>p(t)&&y(t);class oJ extends GG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Rj({},this._theme,s.style),s.offset=Rj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=cV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}class lJ extends WG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=oJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&rJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&aJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&hN.globalConfig.uniqueTooltip&&l&&hN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?kV.canvas:kV.dom,n=fz.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new sJ(this),dimension:new iJ(this),group:new nJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(nb(i)||rb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=lV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(aJ(t)){if(rJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>vz(t,e[i])))))return!1}else{if(aJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&si(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}lJ.type=r.tooltip,lJ.transformerConstructor=oJ,lJ.specKey="tooltip";var hJ,cJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(hJ||(hJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(cJ||(cJ={}));const dJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class uJ extends WG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{dJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){Sz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=hB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=UN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=XN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=$N(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),GN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}pJ.specKey="crosshair",pJ.type=r.cartesianCrosshair;class gJ extends uJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:qt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=hB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Rj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=IN(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=IN(s.getSpec())),c.angle=a.angle,c.axis=s,Rj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=LN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=LN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:se(o,s,i),end:se(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},se(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ne(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=se(t,r,p),f=se(t,r,g),v=Re([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(qt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},se(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),GN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}gJ.specKey="crosshair",gJ.type=r.polarCrosshair;const mJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},fJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class vJ extends WG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Lt(s/n)>=.5:Lt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=Mz(t),this._isHorizontal="horizontal"===Tz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(Nw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};oB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=Nw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else oB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Wz(s,"dataview",ga),Gz(s,"dataFilterComputeDomain",fJ);const n=new ya(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new GH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(Nw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&Nw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Nw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new cC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Gz(this._option.dataSet,"dataFilterWithNewDomain",mJ),oB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>Nw(this._stateScale.type)},level:eH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Gw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Gw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(vJ,TU);class _J extends GG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Rj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class yJ extends vJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=_J,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new BC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Nw(t.type)||e[0]!==e[1])&&(!Gw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new hE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mz(g.style)},selectedBackgroundStyle:mz(this._spec.selectedBackground.style),dragMaskStyle:mz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Rj(mz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Rj(mz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=LN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}yJ.type=r.dataZoom,yJ.transformerConstructor=_J,yJ.specKey="dataZoom";class bJ extends vJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=QP(this._start,e)&&QP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}bJ.type=r.scrollBar,bJ.specKey="scrollBar";const xJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class SJ extends WG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==SJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Gz(this._option.dataSet,"indicatorFilter",xJ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new GH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Rj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?sj(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?sj(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},gz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new TP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}SJ.type=r.indicator,SJ.specKey="indicator";const AJ=["sum","average","min","max","variance","standardDeviation","median"];function kJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function MJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&kJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=JF(t.x)?EJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function TJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&kJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=JF(t.y)?EJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function wJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&kJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function CJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&kJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function EJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function PJ(t){return AJ.includes(t)}function BJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=MJ(t,m,n,d,h,a),i=TJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=MJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=TJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function RJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=wJ(t,l,n,r),i=CJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=wJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=CJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function LJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=JF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=JF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&kJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&kJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function OJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&kJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&kJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function IJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=EJ(e,r)),e+=s,JF(i)&&(i=EJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=EJ(e,s)),JF(i)&&(i=EJ(i,n)),{x:e,y:i}}))}function DJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function FJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},mz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},zJ(mz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=zJ(mz(n),i)),t}return{visible:!1}}function jJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function zJ(t,e){return d(t)?t(e):t}function HJ(t,e){return d(t)?t(e):t}function NJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function VJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function GJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function WJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function UJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>KJ(i,t,e))):s.x=KJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>KJ(i,t,e))):s.y=KJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>KJ(i,t,e))):s.angle=KJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>KJ(i,t,e))):s.radius=KJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=KJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const YJ={min:(t,e)=>tB(t[0].latestData,e.field),max:(t,e)=>eB(t[0].latestData,e.field),sum:function(t,e){return iB(t[0].latestData,e.field)},average:function(t,e){return sB(t[0].latestData,e.field)},variance:function(t,e){return nB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(nB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function KJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return YJ[i](e,{field:s})}return t}class XJ extends WG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&PJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&PJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&PJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&PJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&PJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new va;return e.registerParser("array",s),new ya(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=hB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=QF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function $J(t,e){return function(t,e,i){const{predict:s}=Sb(t,(t=>t[e]),(t=>t[i])),n=tB(t,e),r=eB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function qJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class ZJ extends XJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=VJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:zJ(mz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:FJ(y,this._markerData),state:{line:jJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:jJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:jJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:jJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:jJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:mz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:mz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=VJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerRegression",$J),Gz(this._option.dataSet,"markerFilter",qJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ya(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}ZJ.specKey="markLine";class JJ extends ZJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=VJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=BJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=LJ(i,r,d,e.coordinatesOffset):c&&(y=IJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(JF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=VJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}JJ.type=r.markLine,JJ.coordinateType="cartesian";class QJ extends ZJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=VJ(this._spec);return e||i?new JE(t):new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=VJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=RJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>se(m,t.radius,t.angle)))}}else u&&(p=OJ(i,r,a),g={points:p.map((t=>se(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=VJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}QJ.type=r.polarMarkLine,QJ.coordinateType="polar";class tQ extends WG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=ZF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new kP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}tQ.type=r.title,tQ.specKey=r.title;class eQ extends XJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=GJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:zJ(mz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:FJ(u,this._markerData),state:{area:jJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:jJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:jJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=GJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerFilter",qJ);const c=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}eQ.specKey="markArea";class iQ extends eQ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=GJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=BJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=BJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=LJ(i,r,d,e.coordinatesOffset):c&&(u=IJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=GJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}iQ.type=r.markArea,iQ.coordinateType="cartesian";class sQ extends eQ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=GJ(this._spec);return i||e||s?new QE(t):new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=GJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=RJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=OJ(i,r,c),u={points:d.map((t=>se(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=GJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}sQ.type=r.polarMarkArea,sQ.coordinateType="polar";const nQ=t=>mz(Object.assign({},t)),rQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mz(t.style))}),aQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=nQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=nQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mz(Object.assign({},y)));var y;const b=rQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=rQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=rQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=rQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},oQ=t=>"left"===t||"right"===t,lQ=t=>"top"===t||"bottom"===t;class hQ extends WG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},aQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},aQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new HP(t):this._playerComponent=new GP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=oQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=oQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=oQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=lQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):oQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):lQ(this._orient)?this._maxSize():t.height}_computeDx(t){return oQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return lQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}hQ.specKey="player",hQ.type=r.player;class cQ extends WG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}cQ.type=r.label;class dQ extends dY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}dQ.type="text",dQ.constructorType="label";const uQ=()=>{fz.registerMark(dQ.constructorType,dQ),SO()};class pQ extends GG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class gQ extends cQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=pQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),oB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Rj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=YU[t])&&void 0!==i?i:YU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:KU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}gQ.type=r.label,gQ.specKey="label",gQ.transformerConstructor=pQ;class mQ extends cQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[OD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Rj({textStyle:{pickable:!0===this._spec.interactive},position:fQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[DD]))},a))}})).encode((e=>KU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function fQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}mQ.type=r.totalLabel,mQ.specKey="totalLabel";class vQ extends XJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=WJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:HJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:HJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:zJ(B.style,this._markerData)},state:{line:jJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:jJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:jJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:jJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:jJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:jJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:jJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:jJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:jJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:jJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=mz(zJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=zJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=FJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=zJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mz(z.style)}):{visible:!1};return new eP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:NJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:NJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=WJ(t);if(!(p(t.coordinate)||e||i||s))return;Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerFilter",qJ);const{options:n}=this._computeOptions(),r=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}vQ.specKey="markPoint";class _Q extends vQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=BJ(i,s,s,s,o)[0][0]:r?l=LJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=IJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=WJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}_Q.type=r.markPoint,_Q.coordinateType="cartesian";class yQ extends vQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=RJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:se({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}yQ.type=r.polarMarkPoint,yQ.coordinateType="polar";class bQ extends vQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}bQ.type=r.geoMarkPoint,bQ.coordinateType="geo";const xQ="inBrush",SQ="outOfBrush";class AQ extends WG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),xQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),SQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new KP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(NP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,SQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(NP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(NP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(xQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(xQ),i.addState(SQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(xQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(xQ),i.addState(SQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ze(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ze(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(xQ),i.removeState(SQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}AQ.type=r.brush,AQ.specKey="brush";class kQ extends WG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${pB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=vG({},_G(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Jt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Jt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}kQ.type=r.customMark,kQ.specKey="customMark";function MQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function TQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function wQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:TQ(t.rect),anchorCandidates:LQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>MQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tMQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function CQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Ue(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=BQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ci(r,s,i);if(!BQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],EQ(PQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=EQ(PQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=RQ(t.rect,a,0),t}));return wQ(h)}function EQ(t){return t>180?t-360:t}function PQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function BQ(t,e){for(let i=0;i{const{x:r,y:a}=RQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class OQ extends WG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ya(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:eH.copyDataView},!1),this._data=new GH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new eP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=ej(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Cu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Pg(mz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=kg(mz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=yp(mz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=yp(mz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=RQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):wQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}OQ.type=r.mapLabel,OQ.specKey="mapLabel";class IQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>DQ(t))),a=n.filter((t=>!DQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>DQ(t))),h=o.filter((t=>!DQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function DQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}IQ.type="grid";hN.useRegisters([()=>{aI(),oI(),IG(),jG(),sN(),tN(),aW(),sW(),fz.registerSeries(cW.type,cW),fz.registerChart(yW.type,yW)},()=>{aI(),oI(),IG(),xW(),jG(),AW(),aW(),sW(),fz.registerSeries(MW.type,MW),fz.registerChart(wW.type,wW)},()=>{HW(),fz.registerChart(VW.type,VW)},()=>{eU(),fz.registerChart(sU.type,sU)},()=>{VY(),fz.registerChart(Yq.type,Yq)},()=>{aK(),fz.registerChart(qq.type,qq)},()=>{gK(),fz.registerChart(Jq.type,Jq)},()=>{HW(),fz.registerChart(nZ.type,nZ)},()=>{RU(),fz.registerChart(Hq.type,Hq)},()=>{dq(),fz.registerSeries(pq.type,pq),DY(),MK(),iK(),fz.registerChart(hZ.type,hZ)},()=>{gX(),fz.registerChart(pZ.type,pZ)},()=>{OX(),fz.registerChart(vZ.type,vZ)},()=>{sY(),fz.registerChart(RZ.type,RZ)},()=>{hY(),jG(),tN(),aW(),sW(),fz.registerSeries(cY.type,cY),fz.registerChart(OZ.type,OZ)},()=>{fz.registerSeries(wK.type,wK),DY(),MK(),eN(),nK(),iK(),fz.registerChart(oZ.type,oZ)},()=>{OK(),fz.registerChart(bZ.type,bZ)},()=>{xY(),fz.registerChart(SZ.type,SZ)},()=>{xW(),aW(),sW(),fz.registerSeries(kY.type,kY),fz.registerChart(jZ.type,jZ)},()=>{w$(),fz.registerChart(TZ.type,TZ)},()=>{R$(),fz.registerChart(CZ.type,CZ)},()=>{aq(),fz.registerChart(PZ.type,PZ)},()=>{tq(),fz.registerChart(DZ.type,DZ)},()=>{bq(),fz.registerChart(HZ.type,HZ)},()=>{Pq(),fz.registerChart(VZ.type,VZ)},()=>{fz.registerChart(tZ.type,tZ)},sW,aW,()=>{$G(),fz.registerComponent(oW.type,oW)},()=>{$G(),fz.registerComponent(lW.type,lW)},()=>{$G(),fz.registerComponent(hW.type,hW)},nK,iK,()=>{fz.registerComponent(KZ.type,KZ)},()=>{fz.registerComponent(tJ.type,tJ)},()=>{fz.registerComponent(lJ.type,lJ)},()=>{fz.registerComponent(pJ.type,pJ)},()=>{fz.registerComponent(gJ.type,gJ)},()=>{fz.registerComponent(yJ.type,yJ)},()=>{fz.registerComponent(bJ.type,bJ)},()=>{fz.registerComponent(SJ.type,SJ)},EU,()=>{fz.registerComponent(JJ.type,JJ),XE()},()=>{fz.registerComponent(iQ.type,iQ),qE()},()=>{fz.registerComponent(_Q.type,_Q),tP()},()=>{fz.registerComponent(QJ.type,QJ),JE._animate=PE,XE()},()=>{fz.registerComponent(sQ.type,sQ),QE._animate=RE,qE()},()=>{fz.registerComponent(yQ.type,yQ),tP()},()=>{fz.registerComponent(bQ.type,bQ),tP()},()=>{fz.registerComponent(tQ.type,tQ)},()=>{fz.registerComponent(hQ.type,hQ)},()=>{WO(),uQ(),YG(),fz.registerComponent(gQ.type,gQ,!0)},()=>{WO(),uQ(),YG(),fz.registerComponent(mQ.type,mQ,!0)},()=>{fz.registerComponent(AQ.type,AQ)},()=>{fz.registerComponent(kQ.type,kQ)},()=>{fz.registerComponent(OQ.type,OQ)},()=>{th.load(pT)},()=>{fz.registerLayout(IQ.type,IQ)},iG,yN,qR,$R]),hN.useRegisters([()=>{gA(th)}]),t.ARC_END_ANGLE=MB,t.ARC_K=TB,t.ARC_MIDDLE_ANGLE=wB,t.ARC_QUADRANT=CB,t.ARC_RADIAN=EB,t.ARC_RATIO=AB,t.ARC_START_ANGLE=kB,t.ARC_TRANSFORM_VALUE=SB,t.AxisSyncPlugin=wN,t.BASE_EVENTS=pD,t.CORRELATION_SIZE=bD,t.CORRELATION_X=_D,t.CORRELATION_Y=yD,t.CanvasTooltipHandler=eG,t.DEFAULT_CHART_HEIGHT=mB,t.DEFAULT_CHART_WIDTH=gB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=WD,t.DEFAULT_DATA_INDEX=SD,t.DEFAULT_DATA_KEY=AD,t.DEFAULT_DATA_SERIES_FIELD=kD,t.DEFAULT_GRADIENT_CONFIG=UD,t.DEFAULT_LABEL_ALIGN=vB,t.DEFAULT_LABEL_LIMIT=fB,t.DEFAULT_LABEL_TEXT=_B,t.DEFAULT_LABEL_VISIBLE=yB,t.DEFAULT_LABEL_X=bB,t.DEFAULT_LABEL_Y=xB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=VD,t.DEFAULT_MEASURE_CANVAS_ID=xD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=GD,t.DEFAULT_SERIES_STYLE_NAME=MD,t.DomTooltipHandler=tG,t.Factory=fz,t.FormatterPlugin=_N,t.GradientType=ND,t.MediaQuery=gN,t.POLAR_DEFAULT_RADIUS=LB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=BB,t.POLAR_START_ANGLE=RB,t.POLAR_START_RADIAN=PB,t.PREFIX=pB,t.SEGMENT_FIELD_END=jD,t.SEGMENT_FIELD_START=FD,t.STACK_FIELD_END=ED,t.STACK_FIELD_END_OffsetSilhouette=LD,t.STACK_FIELD_END_PERCENT=BD,t.STACK_FIELD_KEY=wD,t.STACK_FIELD_START=CD,t.STACK_FIELD_START_OffsetSilhouette=RD,t.STACK_FIELD_START_PERCENT=PD,t.STACK_FIELD_TOTAL=OD,t.STACK_FIELD_TOTAL_PERCENT=ID,t.STACK_FIELD_TOTAL_TOP=DD,t.ThemeManager=qj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=hN,t.WaterfallDefaultSeriesField=vD,t.builtinThemes=zj,t.computeActualDataScheme=zF,t.darkTheme=Mj,t.dataScheme=nj,t.default=hN,t.defaultThemeName=Hj,t.getActualColor=NF,t.getColorSchemeBySeries=UF,t.getDataScheme=jF,t.getMergedTheme=Xj,t.getTheme=Uj,t.hasThemeMerged=Gj,t.isColorKey=VF,t.isProgressiveDataColorScheme=GF,t.isTokenKey=Sj,t.lightTheme=kj,t.queryColorFromColorScheme=HF,t.queryToken=xj,t.registerCanvasTooltipHandler=iG,t.registerChartPlugin=pN,t.registerDomTooltipHandler=()=>{QV(tG)},t.registerFormatPlugin=yN,t.registerMediaQuery=()=>{pN(gN)},t.registerTheme=Wj,t.removeTheme=Yj,t.themeExist=Kj,t.themes=Nj,t.token=Aj,t.transformColorSchemeToStandardStruct=WF,t.version="1.11.12",t.vglobal=O_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index 68ff0742f7..c40cdb22f0 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/openinula-vchart", - "version": "1.11.11", + "version": "1.11.12", "sideEffects": false, "description": "The openinula version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:1.11.11", + "@visactor/vchart": "workspace:1.11.12", "@visactor/vutils": "~0.18.10", "@visactor/vrender-core": "0.19.24", "@visactor/vrender-kits": "0.19.24", diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 974828caec..3ef599fc43 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "1.11.11", + "version": "1.11.12", "sideEffects": false, "description": "The react version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:1.11.11", + "@visactor/vchart": "workspace:1.11.12", "@visactor/vutils": "~0.18.10", "@visactor/vrender-core": "0.19.24", "@visactor/vrender-kits": "0.19.24", diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index b60aaff859..ad32e8d459 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "1.11.11", + "version": "1.11.12", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "lib/src/index.js", @@ -42,7 +42,7 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:1.11.11" + "@visactor/vchart": "workspace:1.11.12" }, "devDependencies": { "@internal/eslint-config": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index a57ced9648..1c51451f12 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(Mt.source,"g");function wt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Lt=Math.abs,Ot=Math.atan2,It=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Vt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Yt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Kt(t,e){return Ut(t+e,10**Math.max(Yt(t),Yt(e)))}function Xt(t,e){return Ut(t-e,10**Math.max(Yt(t),Yt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class qt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Zt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Jt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Jt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Qt extends Jt{}function te(t){return t*(Math.PI/180)}function ee(t){return 180*t/Math.PI}const ie=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function se(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ne(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function re(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ae(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=re(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new oe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new oe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new oe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ee(r.rotateDeg),r}}class le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function he(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ce(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const de=/^#([0-9a-f]{3,8})$/,ue={transparent:4294967040},pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return S(t)?new ye(t>>16,t>>8&255,255&t,1):y(t)?new ye(t[0],t[1],t[2]):new ye(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ve(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class _e{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof _e?t:new _e(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(ue[t]))return function(t){return S(t)?new ye(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ye(t[0],t[1],t[2],t[3]):new ye(255,255,255,1)}(ue[t]);if(p(pe[t]))return me(pe[t]);const e=`${t}`.trim().toLowerCase(),i=de.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ye((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=he(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ye(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=_e.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ye(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=ce(this.color.r,this.color.g,this.color.b),r=he(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ye(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=de.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new ye((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?me(s):8===n?new ye(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=pe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _e(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ve(t.color.r),this.color.g=ve(t.color.g),this.color.b=ve(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ye{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${ge(this.r)+ge(this.g)+ge(this.b)+(1===this.opacity?"":ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ye(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ce});function Se(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ae,ke,Me,Te,we,Ce,Ee,Pe;function Be(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Le(t,e,i){return null===t?e:null===e?t:(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,i&&(Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>=Ce||ke<=we||Me>=Pe||Te<=Ee?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ae,we),y1:Math.max(Me,Ee),x2:Math.min(ke,Ce),y2:Math.min(Te,Pe)})}var Oe;function Ie(t,e,i){return!(t&&e&&(i?(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee]),Ae>Ce||kePe||Tee.x2||t.x2e.y2||t.y2ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),t.x>=Ae&&t.x<=ke&&t.y>=Me&&t.y<=Te):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Fe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function je(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function ze(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function He(t,e){const i=e?t.angle:te(t.angle),s=ze(t);return[je({x:t.x1,y:t.y1},i,s),je({x:t.x2,y:t.y1},i,s),je({x:t.x2,y:t.y2},i,s),je({x:t.x1,y:t.y2},i,s)]}let Ne,Ve,Ge,We;function Ue(t){return Ne=1/0,Ve=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ne>t.x&&(Ne=t.x),Get.y&&(Ve=t.y),Wee&&r>s||rn?o:0}function qe(t,e){return Math.abs(t-e)0&&Ke(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Je=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";const ti=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ei(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ii(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function si(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const ni=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ri=6371008.8,ai={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ri,kilometers:6371.0088,kilometres:6371.0088,meters:ri,metres:ri,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ri/1852,radians:1,yards:6967335.223679999};function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function hi(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===De(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ci(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=te(t[0]),r=te(t[1]),a=te(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ai[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:ee(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:ee(l)}}class di{static getInstance(){return di.instance||(di.instance=new di),di.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let pi;function gi(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class mi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vi(t){let e;if(e=fi.exec(t))return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const _i=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class yi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}newFormat(t){const e=vi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):bi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=bi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?_i[8+pi/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=vi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=ui(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=_i[8+n/3];return function(t){return s(r*t)+a}}}const bi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gi(100*t,e),r:gi,s:function(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(pi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+ui(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function xi(){return new Si}function Si(){this.reset()}Si.prototype={constructor:Si,reset:function(){this.s=this.t=0},add:function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},valueOf:function(){return this.s}};var Ai=new Si;function ki(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Mi=1e-6,Ti=Math.PI,wi=Ti/2,Ci=Ti/4,Ei=2*Ti,Pi=180/Ti,Bi=Ti/180,Ri=Math.abs,Li=Math.atan,Oi=Math.atan2,Ii=Math.cos,Di=Math.exp,Fi=Math.log,ji=Math.pow,zi=Math.sin,Hi=Math.sign||function(t){return t>0?1:t<0?-1:0},Ni=Math.sqrt,Vi=Math.tan;function Gi(t){return t>1?0:t<-1?Ti:Math.acos(t)}function Wi(t){return t>1?wi:t<-1?-wi:Math.asin(t)}function Ui(){}function Yi(t,e){t&&Xi.hasOwnProperty(t.type)&&Xi[t.type](t,e)}var Ki={Feature:function(t,e){Yi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sTi?t+Math.round(-t/Ei)*Ei:t,e]}function os(t,e,i){return(t%=Ei)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Ti?e-Ei:e<-Ti?e+Ei:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Ii(t),s=zi(t),n=Ii(e),r=zi(e);function a(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*i+o*s;return[Oi(l*n-c*r,o*i-h*s),Wi(c*n+l*r)]}return a.invert=function(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*n-l*r;return[Oi(l*n+h*r,o*i+c*s),Wi(c*i-o*s)]},a}function ds(t,e){(e=Qi(e))[0]-=t,ns(e);var i=Gi(-e[1]);return((-e[2]<0?-i:i)+Ei-Mi)%Ei}function us(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ui,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return Ri(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function fs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ss(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function As(t,e,i,s){return function(n){var r,a,o,l=e(n),h=us(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=Ss(a);var t=function(t,e){var i=bs(e),s=e[1],n=zi(s),r=[zi(i),-Ii(i),0],a=0,o=0;ys.reset(),1===n?s=wi+Mi:-1===n&&(s=-wi-Mi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Ti,w=m*x;if(ys.add(Oi(w*k*zi(M),f*S+w*Ii(M))),a+=T?A+k*Ei:A,T^p>=i^y>=i){var C=es(Qi(u),Qi(_));ns(C);var E=es(r,C);ns(E);var P=(T^A>=0?-1:1)*Wi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Mi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ks))}return u}}function ks(t){return t.length>1}function Ms(t,e){return((t=t.x)[0]<0?t[1]-wi-Mi:wi-t[1])-((e=e.x)[0]<0?e[1]-wi-Mi:wi-e[1])}1===(vs=xs).length&&(_s=vs,vs=function(t,e){return xs(_s(t),e)});var Ts=As((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ti:-Ti,l=Ri(r-i);Ri(l-Ti)0?wi:-wi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ti&&(Ri(i-n)Mi?Li((zi(e)*(r=Ii(s))*zi(i)-zi(s)*(n=Ii(e))*zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*wi,s.point(-Ti,n),s.point(0,n),s.point(Ti,n),s.point(Ti,0),s.point(Ti,-n),s.point(0,-n),s.point(-Ti,-n),s.point(-Ti,0),s.point(-Ti,n);else if(Ri(t[0]-e[0])>Mi){var r=t[0]0,n=Ri(e)>Mi;function r(t,i){return Ii(t)*Ii(i)>e}function a(t,i,s){var n=[1,0,0],r=es(Qi(t),Qi(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=es(n,r),u=ss(n,h);is(u,ss(r,c));var p=d,g=ts(u,p),m=ts(p,p),f=g*g-m*(ts(u,u)-1);if(!(f<0)){var v=Ni(f),_=ss(p,(-g-v)/m);if(is(_,u),_=Ji(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ri(_[0]-b)Ti^(b<=_[0]&&_[0]<=x)){var T=ss(p,(-g+v)/m);return is(T,u),[_,Ji(T)]}}}function o(e,i){var n=s?t:Ti-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return As(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Ti:-Ti),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ps(e,p)||ps(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Ii(e),o=zi(e),l=s*i;null==n?(n=e+s*Ei,r=e-l/2):(n=ds(a,n),r=ds(a,r),(s>0?nr)&&(n+=s*Ei));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ri(s[0]-t)0?0:3:Ri(s[0]-i)0?2:1:Ri(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=us(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Ss(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ms(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Es,Math.min(Cs,g)),m=Math.max(Es,Math.min(Cs,m))],b=[r=Math.max(Es,Math.min(Cs,r)),a=Math.max(Es,Math.min(Cs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Bs(t){return t}var Rs,Ls,Os,Is,Ds=xi(),Fs=xi(),js={point:Ui,lineStart:Ui,lineEnd:Ui,polygonStart:function(){js.lineStart=zs,js.lineEnd=Vs},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=Ui,Ds.add(Ri(Fs)),Fs.reset()},result:function(){var t=Ds/2;return Ds.reset(),t}};function zs(){js.point=Hs}function Hs(t,e){js.point=Ns,Rs=Os=t,Ls=Is=e}function Ns(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Vs(){Ns(Rs,Ls)}var Gs=js,Ws=1/0,Us=Ws,Ys=-Ws,Ks=Ys;var Xs,$s,qs,Zs,Js={point:function(t,e){tYs&&(Ys=t);eKs&&(Ks=e)},lineStart:Ui,lineEnd:Ui,polygonStart:Ui,polygonEnd:Ui,result:function(){var t=[[Ws,Us],[Ys,Ks]];return Ys=Ks=-(Us=Ws=1/0),t}},Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln=0,hn={point:cn,lineStart:dn,lineEnd:gn,polygonStart:function(){hn.lineStart=mn,hn.lineEnd=fn},polygonEnd:function(){hn.point=cn,hn.lineStart=dn,hn.lineEnd=gn},result:function(){var t=ln?[an/ln,on/ln]:rn?[sn/rn,nn/rn]:en?[Qs/en,tn/en]:[NaN,NaN];return Qs=tn=en=sn=nn=rn=an=on=ln=0,t}};function cn(t,e){Qs+=t,tn+=e,++en}function dn(){hn.point=un}function un(t,e){hn.point=pn,cn(qs=t,Zs=e)}function pn(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,cn(qs=t,Zs=e)}function gn(){hn.point=cn}function mn(){hn.point=vn}function fn(){_n(Xs,$s)}function vn(t,e){hn.point=_n,cn(Xs=qs=t,$s=Zs=e)}function _n(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,an+=(n=Zs*t-qs*e)*(qs+t),on+=n*(Zs+e),ln+=3*n,cn(qs=t,Zs=e)}var yn=hn;function bn(t){this._context=t}bn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ei)}},result:Ui};var xn,Sn,An,kn,Mn,Tn=xi(),wn={point:Ui,lineStart:function(){wn.point=Cn},lineEnd:function(){xn&&En(Sn,An),wn.point=Ui},polygonStart:function(){xn=!0},polygonEnd:function(){xn=null},result:function(){var t=+Tn;return Tn.reset(),t}};function Cn(t,e){wn.point=En,Sn=kn=t,An=Mn=e}function En(t,e){kn-=t,Mn-=e,Tn.add(Ni(kn*kn+Mn*Mn)),kn=t,Mn=e}var Pn=wn;function Bn(){this._string=[]}function Rn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ln(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Zi(t,i(s))),s.result()}return r.area=function(t){return Zi(t,i(Gs)),Gs.result()},r.measure=function(t){return Zi(t,i(Pn)),Pn.result()},r.bounds=function(t){return Zi(t,i(Js)),Js.result()},r.centroid=function(t){return Zi(t,i(yn)),yn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Bs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Bn):new bn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function On(t){return function(e){var i=new In;for(var s in t)i[s]=t[s];return i.stream=e,i}}function In(){}function Dn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Zi(i,t.stream(Js)),e(Js.result()),null!=s&&t.clipExtent(s),t}function Fn(t,e,i){return Dn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function jn(t,e,i){return Fn(t,[[0,0],e],i)}function zn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Hn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Bn.prototype={_radius:4.5,_circle:Rn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Rn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},In.prototype={constructor:In,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Nn=16,Vn=Ii(30*Bi);function Gn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Ni(b*b+x*x+S*S),k=Wi(S/=A),M=Ri(Ri(S)-1)e||Ri((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Bi:0,E()):[f*Pi,v*Pi,_*Pi]},w.angle=function(t){return arguments.length?(y=t%360*Bi,E()):y*Pi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Gn(o,T=t*t),P()):Ni(T)},w.fitExtent=function(t,e){return Fn(w,t,e)},w.fitSize=function(t,e){return jn(w,t,e)},w.fitWidth=function(t,e){return zn(w,t,e)},w.fitHeight=function(t,e){return Hn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function $n(t){var e=0,i=Ti/3,s=Xn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Bi,i=t[1]*Bi):[e*Pi,i*Pi]},n}function qn(t,e){var i=zi(t),s=(i+zi(e))/2;if(Ri(s)2?t[2]*Bi:0),e.invert=function(e){return(e=t.invert(e[0]*Bi,e[1]*Bi))[0]*=Pi,e[1]*=Pi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===sr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function rr(t){return Vi((wi+t)/2)}function ar(t,e){var i=Ii(t),s=t===e?zi(t):Fi(i/Ii(e))/Fi(rr(e)/rr(t)),n=i*ji(rr(t),s)/s;if(!s)return sr;function r(t,e){n>0?e<-wi+Mi&&(e=-wi+Mi):e>wi-Mi&&(e=wi-Mi);var i=n/ji(rr(e),s);return[i*zi(s*t),n-i*Ii(s*t)]}return r.invert=function(t,e){var i=n-e,r=Hi(s)*Ni(t*t+i*i),a=Oi(t,Ri(i))*Hi(i);return i*s<0&&(a-=Ti*Hi(t)*Hi(i)),[a/s,2*Li(ji(n/r,1/s))-wi]},r}function or(t,e){return[t,e]}function lr(t,e){var i=Ii(t),s=t===e?zi(t):(i-Ii(e))/(e-t),n=i/s+t;if(Ri(s)Mi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},vr.invert=tr(Wi),_r.invert=tr((function(t){return 2*Li(t)})),yr.invert=function(t,e){return[-e,2*Li(Di(t))-wi]};var Sr={exports:{}},Ar=function(t,e){this.p1=t,this.p2=e};Ar.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ar.prototype.run=function(){return this.p2[0]-this.p1[0]},Ar.prototype.slope=function(){return this.rise()/this.run()},Ar.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ar.prototype.isVertical=function(){return!isFinite(this.slope())},Ar.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ar.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ar.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ar.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ar.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var kr=Ar,Mr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new kr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Mr(t.slice(0,s),e),o=Mr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Tr=Mr;!function(t){var e=Tr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Cr(Br,e),{tolerance:s}=i;return wr(t,s)};var Lr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Lr||(Lr={}));const Or=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+zr(e,6):zr(e,4))+"-"+zr(t.getUTCMonth()+1,2)+"-"+zr(t.getUTCDate(),2)+(r?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"."+zr(r,3)+"Z":n?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"Z":s||i?"T"+zr(i,2)+":"+zr(s,2)+"Z":"")}function Nr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Dr;if(h)return h=!1,Ir;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.DSV;const i=Cr(Wr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Nr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Vr(t)},Kr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Gr(t)};function Xr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return $r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return $r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zr(t);default:throw new Error("unknown GeoJSON type")}}function $r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qr(t.properties),e.geometry=Zr(t.geometry),e}function qr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=qr(s):e[i]=s})),e):e}function Zr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Zr(t)})),e):(e.coordinates=Jr(t.coordinates),e)}function Jr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Jr(t)}))}function Qr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ta(t){for(var e,i,s=Qr(t),n=0,r=1;r0}function ea(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Xr(t));var r=[];switch(t.type){case"GeometryCollection":return ia(t,(function(t){na(t,s)})),t;case"FeatureCollection":return ea(t,(function(t){ea(na(t,s),(function(t){r.push(t)}))})),li(r)}return na(t,s)}function na(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ia(t,(function(t){na(t,e)})),t;case"LineString":return ra(Qr(t),e),t;case"Polygon":return aa(Qr(t),e),t;case"MultiLineString":return Qr(t).forEach((function(t){ra(t,e)})),t;case"MultiPolygon":return Qr(t).forEach((function(t){aa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ra(t,e){ta(t)===e&&t.reverse()}function aa(t,e){ta(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=oa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},da=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.GEO;const i=Cr(ha,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ca(t))})):e.push(ca(t))})),e})(t);let o=t.features;return a&&(o=sa(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=la.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=la.bounds(t);t.bbox=e}})),t.features=o,t},ua={},pa=(t,e,i)=>{i.type=Lr.GEO;const s=Cr(ha,ua,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return xr(a,t)}))}:xr(a,o));var a,o;return da(r,s,i)},ga=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ma=0;function fa(){return ma>1e8&&(ma=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ma++}class va{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:fa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const _a="_data-view-diff-rank";class ya{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:fa("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[_a]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[_a]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[_a]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Or),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ba{static GenAutoIncrementId(){return ba.auto_increment_id++}}ba.auto_increment_id=0;class xa{constructor(t){this.id=ba.GenAutoIncrementId(),this.registry=t}}const Sa="named",Aa="inject",ka="multi_inject",Ma="inversify:tagged",Ta="inversify:paramtypes";class wa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Sa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ca=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ea(e,0,s,t)}}function Ba(t){return e=>(i,s,n)=>Pa(new wa(t,e))(i,s,n)}const Ra=Ba(Aa),La=Ba(ka);function Oa(){return function(t){return Ca.defineMetadata(Ta,null,t),t}}function Ia(t){return Pa(new wa(Sa,t))}const Da="Singleton",Fa="Transient",ja="ConstantValue",za="DynamicValue",Ha="Factory",Na="Function",Va="Instance",Ga="Invalid";class Wa{constructor(t,e){this.id=ba.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ga,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wa(this.serviceIdentifier,this.scope);return t.activated=t.scope===Da&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ua{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ca.getMetadata(Ta,t),userGeneratedMetadata:Ca.getMetadata(Ma,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ya=(Ka=Sa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ka&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const qa=Symbol("ContributionProvider");class Za{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ja(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).inSingletonScope().whenTargetNamed(e)}class Qa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class to extends Qa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const eo=Symbol.for("EnvContribution"),io=Symbol.for("VGlobal");var so=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},no=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ro=function(t,e){return function(i,s){e(i,s,t)}};let ao=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ba.GenAutoIncrementId(),this.hooks={onSetEnv:new to(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ao=so([Oa(),ro(0,Ra(qa)),ro(0,Ia(eo)),no("design:paramtypes",[Object])],ao);const oo=Bt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,mo,fo,vo,_o,yo;var bo,xo,So,Ao,ko,Mo,To,wo,Co;function Eo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Po(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=te(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Lo(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Go extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Wo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Uo(t,e,i){const s=null!=e?e:Lt(i[i.length-1].x-i[0].x)>Lt(i[i.length-1].y-i[0].y)?To.ROW:To.COLUMN;return"monotoneY"===t?new Go(t,s):new Vo(t,s)}class Yo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ko(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new Yo(n,s),t),n}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("basis",i,t);return function(t,e){Wo(t,e)}(new $o(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneX",i,t);return function(t,e){Wo(t,e)}(new el(n,s),t),n}function nl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneY",i,t);return function(t,e){Wo(t,e)}(new il(n,s),t),n}let rl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function al(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Lt(t[t.length-1].x-t[0].x)>Lt(t[t.length-1].y-t[0].y)?To.ROW:To.COLUMN);return function(t,e){Wo(t,e)}(new rl(r,e,n),t),r}class ol extends Yo{lineEnd(){this.context.closePath()}}function ll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new ol(n,s),t),n}function hl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function cl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Ko(i,n);const o=Uo(t,r,i);return Wo(new e(o,s,a),i),o}}const dl=cl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ul=cl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function pl(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}class gl extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[];Bo(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Lo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===To.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.y-e.p1.y)}if(this.direction===To.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const ml=["l",0,0,0,0,0,0,0];function fl(t,e,i){const s=ml[0]=t[0];if("a"===s||"A"===s)ml[1]=e*t[1],ml[2]=i*t[2],ml[3]=t[3],ml[4]=t[4],ml[5]=t[5],ml[6]=e*t[6],ml[7]=i*t[7];else if("h"===s||"H"===s)ml[1]=e*t[1];else if("v"===s||"V"===s)ml[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Rl=Object.assign(Object.assign({},kl),{points:[],cornerRadius:0,closePath:!0}),Ll=Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ol=Object.assign(Object.assign({},kl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},kl),xl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dl=Object.assign(Object.assign(Object.assign({},kl),xl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kl),{fill:!0,cornerRadius:0}),jl=Object.assign(Object.assign({},Fl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const zl=new class{},Hl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Nl=!0,Vl=!1,Gl=/\w|\(|\)|-/,Wl=/[.?!,;:/,。?!、;:]/,Ul=/\S/;function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=zl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Kl(t,a)),a}function Kl(t,e){let i=e;for(;Gl.test(t[i-1])&&Gl.test(t[i])||Wl.test(t[i]);)if(i--,i<=0)return e;return i}function Xl(t,e){const i=zl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var $l=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Il.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Kl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Kl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=$l([Oa()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Oa()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Fa,this.options=e,this.id=ba.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ua}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Sa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wa(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new $a(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Aa],multiInject:s[ka]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case ja:case Na:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Da&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,zl.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-xh&&txh||t<-xh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Rt)<0&&(t+=Rt),t}function fh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Ah=[-1,-1,-1],kh=[-1,-1];function Mh(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Th(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Ah);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Ah);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ah[0]=-l,Ah[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=Ah[0]+t&&a<=Ah[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=Ah[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=fh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Bh[0]=S,Bh[1]=A,Ph(Bh,Boolean(a[6])),S=Bh[0],A=Bh[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case po.M:u=f,p=v,c=u,d=p;break;case po.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=fh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case po.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=fh(c,d,o,l,s,n),i){if(yh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ch(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case po.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=fh(o,p,o,l,s,n),h+=fh(u,l,u,p,s,n);break;case po.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=fh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new to(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=zl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Oh([Oa(),Ih("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=zl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Lh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:xl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Qe(Object.assign({defaultFontParams:{fontFamily:xl.fontFamily,fontSize:xl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Oa(),Nh(0,Ra(qa)),Nh(0,Ia(Jl)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new oe;let Uh=class{constructor(){this.matrix=new oe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Oa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:Ml,area:Tl,circle:wl,line:Pl,path:Bl,symbol:Ol,text:Il,rect:Ll,polygon:Rl,richtext:Dl,richtextIcon:jl,image:Fl,group:Cl,glyph:El},Kh=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const $h={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Kh.forEach((t=>{this._defaultTheme[t]=Object.create($h[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Kh.forEach((s=>{const n=Object.create($h[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Kh.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ba.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class uc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{static Avaliable(){return!!zl.global.getRequestAnimationFrame()}avaliable(){return gc.Avaliable()}tick(t,e){zl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var mc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(mc||(mc={}));class fc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-fc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*fc.bounceIn(2*t):.5*fc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}fc.quadIn=fc.getPowIn(2),fc.quadOut=fc.getPowOut(2),fc.quadInOut=fc.getPowInOut(2),fc.cubicIn=fc.getPowIn(3),fc.cubicOut=fc.getPowOut(3),fc.cubicInOut=fc.getPowInOut(3),fc.quartIn=fc.getPowIn(4),fc.quartOut=fc.getPowOut(4),fc.quartInOut=fc.getPowInOut(4),fc.quintIn=fc.getPowIn(5),fc.quintOut=fc.getPowOut(5),fc.quintInOut=fc.getPowInOut(5),fc.backIn=fc.getBackIn(1.7),fc.backOut=fc.getBackOut(1.7),fc.backInOut=fc.getBackInOut(1.7),fc.elasticIn=fc.getElasticIn(1,.3),fc.elasticOut=fc.getElasticOut(1,.3),fc.elasticInOut=fc.getElasticInOut(1,.3*1.5);class vc{constructor(){this.id=ba.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ao.END?this.removeAnimate(e):e.status===Ao.RUNNING||e.status===Ao.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ao.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const _c=new vc;class yc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class bc extends yc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let xc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ba.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new Sc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&ko.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:So.ANIMATE_PLAY})}runCb(t){const e=new bc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===Ao.RUNNING&&(this.status=Ao.PAUSED)}resume(){this.status===Ao.PAUSED&&(this.status=Ao.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Sc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ao.RUNNING&&(this.status=Ao.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ao.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};xc.mode=ko.NORMAL,xc.interpolateMap=new Map;class Sc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Ac(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?fc[i]:i,n=this._addStep(e,null,s);return n.type=Mo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?fc[i]:i,r=this._addStep(e,null,n);return r.type=Mo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=Mo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Mo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Ac(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Ac{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Mc="cubicOut",Tc=1e3,wc="quadInOut";var Cc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Cc||(Cc={}));const Ec=[!1,!1,!1,!1],Pc=[0,0,0,0],Bc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Pc[0]=t[0],Pc[2]=t[0],Pc[1]=t[1],Pc[3]=t[1],Pc):t:t:0,Rc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Lc=[1,2,3,0,1,2,3,0];function Oc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Rc[0].x=i,Rc[1].y=i,Rc[2].x=-i,Rc[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(It(t)*i,jt(t)*i),s.add(It(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:zc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}zc.TimeOut=1e3/60;const Hc=new zc,Nc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Vc extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Yt(this.fromNumber),Yt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Gc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Gc||(Gc={}));class Wc extends yc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Ic(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Uc extends yc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:So.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:So.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Yc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=zl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Kc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=zl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Xc extends yc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class $c extends yc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?fc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function qc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Zc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{pt(e,s)&&pt(i,n)||t.push(e,i,s,n,s,n)};function sd(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function nd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function od(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),cd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},dd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Jt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return cd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return cd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);dd(n[0],s,i),dd(n[1],e-s,i)}};var ud;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ud||(ud={}));class pd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ud.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ud.Color1){const e=pd.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=_e.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];pd.store1[t]=e,pd.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=pd.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=_e.parseColorString(t);return n&&(pd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],pd.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===ud.Color1){if(pd.store1[t])return;pd.store1[t]=i,pd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(pd.store255[t])return;pd.store255[t]=i,pd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function gd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function md(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>fd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):fd(t,e,i,s,n)}function fd(t,e,i,s,n){if(!t||!e)return t&&gd(t)||e&&gd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=pd.Get(t,ud.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=pd.Get(e,ud.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:gd(a)})))});return o?md(r,l,i,s,n):md(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),gd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}pd.store255={},pd.store1={};const vd=[0,0,0,0],_d=[0,0,0,0];function yd(t,e,i){return pd.Get(t,ud.Color255,vd),pd.Get(e,ud.Color255,_d),`rgba(${Math.round(vd[0]+(_d[0]-vd[0])*i)},${Math.round(vd[1]+(_d[1]-vd[1])*i)},${Math.round(vd[2]+(_d[2]-vd[2])*i)},${vd[3]+(_d[3]-vd[3])*i})`}const bd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=md(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},xd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?sd(t):[],n=sd(e);i&&s&&(i.fromTransform&&nd(s,i.fromTransform.clone().getInverse()),nd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Ad=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],kd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Ad.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?pd.Get(t[n],ud.Color255):t[n],to:"string"==typeof r?pd.Get(r,ud.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class Md extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;xd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&bd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Td=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Sd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=kd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new Md({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Tc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wc)),c};class wd extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;xd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&bd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Cd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Fc.includes(t))(i)||(e[i]=t[i])})),e},Ed=(t,e,i)=>{const s=Cd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=zl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Pd=(t,e,i)=>{const s=[],n=i?null:Cd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Cd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ad(t.attribute),n=od(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(zl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=od(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=od(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ld(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ld(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(zl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:hd(i)}];const s=[];return dd(i,e,s),s})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return dd(r,e,h),h})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=sd(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(zl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Ed(t,s,e),s};class Rd{static GetImage(t,e){var i;const s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Rd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Rd.cache.set(t,s),s.dataPromise=zl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Rd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Rd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=zl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=zl.global.loadBlob(t):"json"===e&&(i.dataPromise=zl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Rd.isLoading&&Rd.toLoadAueue.length){Rd.isLoading=!0;const t=Rd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Rd.cache.set(i,n),n.dataPromise=zl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()})).catch((t=>{console.error(t),Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()}))}}),0)}static loadImage(t,e){const i=Ld(t,Rd.toLoadAueue);if(-1!==i)return Rd.toLoadAueue[i].marks.push(e),void Rd.loading();Rd.toLoadAueue.push({url:t,marks:[e]}),Rd.loading()}static improveImageLoading(t){const e=Ld(t,Rd.toLoadAueue);if(-1!==e){const t=Rd.toLoadAueue.splice(e,1);Rd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ld(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Qt,this._updateTag=bo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Hd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Hd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Hd.x=n,Hd.y=r;return Hd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new oe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(zl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Mc),c&&this.setAttributes(c,!1,{type:So.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:So.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bo.UPDATE_SHAPE_AND_BOUNDS)===bo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=bo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=bo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&bo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,scaleX:i=vl.scaleX,scaleY:s=vl.scaleY,angle:n=vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=It(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),zl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Od.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:So.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=md(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Jh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:zl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new gl).fromString(t):this.pathProxy=new gl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",zl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Vd.mixin(hc);class Gd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Wd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Yd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Kd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Wd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Gd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Xd(t,e){return $d(t)}function $d(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let eu=0;function iu(){return eu++}var su;function nu(t){const e=[];let i=0,s="";for(let n=0;nru.set(t,!0)));const au=new Map;function ou(t){if(ru.has(t))return!0;if(au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>au.set(t,!0)));const lu=iu(),hu=iu(),cu=iu(),du=iu(),uu=iu(),pu=iu(),gu=iu(),mu=iu(),fu=iu(),vu=iu();iu();const _u=iu();iu();const yu=iu(),bu=iu(),xu=iu(),Su=Symbol.for("GraphicService"),Au=Symbol.for("GraphicCreator"),ku={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Mu=Object.keys(ku);var Tu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tu||(Tu={}));let wu=class t extends Vd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=pu,this._childUpdateTag=bo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,dx:i=vl.dx,dy:s=vl.dy,scaleX:n=vl.scaleX,scaleY:r=vl.scaleY,angle:a=vl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Jh(this).group;this._AABBBounds.clear();const i=zl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Bc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),zl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),zl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,zl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{zl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=zl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cu(t){return new wu(t)}wu.NOWORK_ANIMATE_ATTR=Nd;class Eu extends wu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Pu=Symbol.for("TransformUtil"),Bu=Symbol.for("GraphicUtil"),Ru=Symbol.for("LayerService"),Lu=Symbol.for("StaticLayerHandlerContribution"),Ou=Symbol.for("DynamicLayerHandlerContribution"),Iu=Symbol.for("VirtualLayerHandlerContribution");var Du,Fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zu=Du=class{static GenerateLayerId(){return`${Du.idprefix}_${Du.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=zl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(Lu):"dynamic"===t?th.get(Ou):th.get(Iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Eu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Du.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};zu.idprefix="visactor_layer",zu.prefix_count=0,zu=Du=Fu([Oa(),ju("design:paramtypes",[])],zu);var Hu=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Dh).to(jh),t(Bu).to(Vh).inSingletonScope(),t(Pu).to(Uh).inSingletonScope(),t(Ru).to(zu).inSingletonScope()}));function Nu(t,e){return!(!t&&!e)}function Vu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Gu(t,e,i){return i&&t*e>0}function Wu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Uu(t,e){return t*e>0}function Yu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Ku(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $u(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Lt(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*It(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*It(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*It(f),P=n*jt(f),B=r*It(_),R=r*jt(_);let L,O,I,D;if((T>Ct||M>Ct)&&(L=n*It(v),O=n*jt(v),I=r*It(b),D=r*jt(b),hCt){const t=Ft(x,w),r=Ft(S,w),o=Xu(I,D,E,P,n,t,Number(c)),l=Xu(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,n,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*It(Ot(l.y01,l.x01)),s+l.cy+r*jt(Ot(l.y01,l.x01))):e.moveTo(i+L,s+n*jt(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*It(v),s+n*jt(v));if(!(r>Ct)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>Ct){const t=Ft(k,C),n=Ft(A,C),o=Xu(B,R,L,O,r,-n,Number(c)),l=Xu(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,r,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*It(Ot(l.y01,l.x01)),s+l.cy+t*jt(Ot(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*It(b),s+r*jt(b))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class qu{static GetCanvas(){try{return qu.canvas||(qu.canvas=zl.global.createCanvas({})),qu.canvas}catch(t){return null}}static GetCtx(){if(!qu.ctx){const t=qu.GetCanvas();qu.ctx=t.getContext("2d")}return qu.ctx}}class Zu extends le{static getInstance(){return Zu._instance||(Zu._instance=new Zu),Zu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=qu.GetCanvas(),s=qu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Zu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ju{static GetSize(t){for(let e=0;e=t)return Ju.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ju.GenKey(t,e,i,s,n),l=Ju.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ju.GenKey(t,e,i,s,n);Ju.cache[l]?Ju.cache[l].push({width:a,height:o,pattern:r}):Ju.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ju.cache={},Ju.ImageSize=[20,40,80,160,320,640,1280,2560];const Qu=Symbol.for("ArcRenderContribution"),tp=Symbol.for("AreaRenderContribution"),ep=Symbol.for("CircleRenderContribution"),ip=Symbol.for("GroupRenderContribution"),sp=Symbol.for("ImageRenderContribution"),np=Symbol.for("PathRenderContribution"),rp=Symbol.for("PolygonRenderContribution"),ap=Symbol.for("RectRenderContribution"),op=Symbol.for("SymbolRenderContribution"),lp=Symbol.for("TextRenderContribution"),hp=Symbol.for("InteractiveSubRenderContribution"),cp=["radius","startAngle","endAngle",...Dd];class dp extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=du}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Jh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateCircleAABBBounds(i,Jh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,cp)}needUpdateTag(t){return super.needUpdateTag(t,cp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new gl;return o.arc(0,0,n,r,a),o}clone(){return new dp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function up(t){return new dp(t)}function pp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function gp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}dp.NOWORK_ANIMATE_ATTR=Nd;class fp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=xu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Jh(this).text;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Jh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Nc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=zl.graphicUtil.textMeasure,k=new fp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===su.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=gp(x,o),M=mp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Jh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Nc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=zl.graphicUtil.textMeasure,y=new fp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Jh(this).text,a=zl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Nc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=gp(x,o),e=this.cache.verticalList.length*b,i=mp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>nu(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===su.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const k=gp(x,o),M=this.cache.verticalList.length*b,T=mp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yp(t){return new _p(t)}_p.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Nd),_p.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_p.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class bp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function xp(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Sp=new class extends bp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return xp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return xp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Ap=new class extends bp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function kp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Mp=new class extends bp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return kp(t,e/2+n,i,s,r)}};function Tp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var wp=new class extends bp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Tp(t,e/2+n,i,s)}};class Cp extends bp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Ep=new Cp;var Pp=new class extends Cp{constructor(){super(...arguments),this.type="triangle"}};const Bp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Rp=Math.sin(Bt/10)*Bp,Lp=-Math.cos(Bt/10)*Bp;function Op(t,e,i,s){const n=Rp*e,r=Lp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ip=new class extends bp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};const Dp=zt(3);function Fp(t,e,i,s){const n=e,r=n/Dp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var jp=new class extends bp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Fp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Fp(t,e/2+n,i,s)}};function zp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Hp=new class extends bp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return zp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return zp(t,e/2+n,i,s)}};function Np(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Vp=new class extends bp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};const Gp=-.5,Wp=zt(3)/2,Up=1/zt(12);function Yp(t,e,i,s){const n=e/2,r=e*Up,a=n,o=e*Up+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Gp*n-Wp*r+i,Wp*n+Gp*r+s),t.lineTo(Gp*a-Wp*o+i,Wp*a+Gp*o+s),t.lineTo(Gp*l-Wp*h+i,Wp*l+Gp*h+s),t.lineTo(Gp*n+Wp*r+i,Gp*r-Wp*n+s),t.lineTo(Gp*a+Wp*o+i,Gp*o-Wp*a+s),t.lineTo(Gp*l+Wp*h+i,Gp*h-Wp*l+s),t.closePath(),!1}var Kp=new class extends bp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Yp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Yp(t,e/2+n,i,s)}};var Xp=new class extends bp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends bp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var qp=new class extends bp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Zp=zt(3);function Jp(t,e,i,s){const n=e*Zp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Qp=new class extends Cp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Jp(t,e/2/Zp,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/2/Zp+n,i,s)}};function tg(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var eg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return tg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return tg(t,e/4+n,i,s)}};function ig(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var sg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return ig(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ig(t,e/4+n,i,s)}};function ng(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var rg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return ng(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ng(t,e/4+n,i,s)}};function ag(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var og=new class extends bp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ag(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ag(t,e/4+n,i,s)}};function lg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var hg=new class extends bp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return lg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return lg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function cg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var dg=new class extends bp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return cg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return cg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ug(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var pg=new class extends bp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return ug(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ug(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function mg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var fg=new class extends bp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?mg(t,e,i,s):gg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?mg(t,e+2*n,i,s):gg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const vg=new Qt;class _g{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;vg.x1=s.bounds.x1*t,vg.y1=s.bounds.y1*t,vg.x2=s.bounds.x2*t,vg.y2=s.bounds.y2*t,e.union(vg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const yg={};[Sp,Ap,Mp,wp,Qp,Pp,Ip,jp,Hp,Vp,Kp,Xp,$p,Ep,qp,eg,sg,rg,og,fg,hg,dg,pg].forEach((t=>{yg[t.type]=t}));const bg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},xg=new Qt,Sg=["symbolType","size",...Dd];let Ag=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Jh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=yg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=bg[i]||i,!0===((n=i).startsWith("{const e=(new gl).fromString(t.d),i={};Mu.forEach((e=>{t[e]&&(i[ku[e]]=t[e])})),r.push({path:e,attribute:i}),xg.union(e.bounds)}));const a=xg.width(),o=xg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new _g(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new gl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new _g(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Jh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateSymbolAABBBounds(i,Jh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new gl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new gl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.userSymbolMap={},Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Nd);const Mg=["segments","points","curveType","curveTension",...Dd];let Tg=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=mu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}doUpdateAABBBounds(){const t=Jh(this).line;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateLineAABBBounds(e,Jh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.attribute,e=new gl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const Cg=["width","x1","y1","height","cornerRadius",...Dd];class Eg extends Vd{constructor(t){super(t),this.type="rect",this.numberType=_u}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Jh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRectAABBBounds(e,Jh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ad(t),r=new gl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Nd;class Bg extends Vd{constructor(t){super(t),this.type="glyph",this.numberType=uu,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=zl.graphicService.updateGlyphAABBBounds(this.attribute,Jh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Bg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Nd;class Lg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Hl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Og{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Nc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Vl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Nl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Ig=["width","height","image",...Dd];class Dg extends Vd{constructor(t){super(t),this.type="image",this.numberType=gu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Jh(this).image;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateImageAABBBounds(e,Jh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Fl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ig)}needUpdateTag(t){return super.needUpdateTag(t,Ig)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Nd);class jg extends Dg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Bc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Bc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fl.width,height:e=Fl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class zg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Hl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Ul.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof jg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Xl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof jg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Hl[this.direction]}store(t){if(t instanceof jg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new zg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof jg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,s=Yl(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==s){const[e,i]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character),new Og(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Dd];class Vg extends Vd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Jh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRichTextAABBBounds(e,Jh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Lg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Hg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i,n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s)})),n}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Nd);const Wg=["path","customPath",...Dd];class Ug extends Vd{constructor(t){super(t),this.type="path",this.numberType=fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Jh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof gl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof gl?this.cache:t.path)}doUpdateAABBBounds(){const t=Jh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePathAABBBounds(e,Jh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new gl).fromString(t.path):t.customPath&&(this.cache=new gl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}toCustomPath(){return(new gl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Nd);const Kg=["segments","points","curveType","curveTension",...Dd];class Xg extends Vd{constructor(t){super(t),this.type="area",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Jh(this).area;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateAreaAABBBounds(e,Jh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){const t=new gl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Dd];class Zg extends Vd{constructor(t){super(t),this.type="arc",this.numberType=lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Jh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Jh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ie(e),i=e+r,s&&Lt(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Jh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Lt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Vt(Number(l)/o*jt(g)),n=Vt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Jh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateArcAABBBounds(i,Jh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}getDefaultAttribute(t){return Jh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Lt(i-e),a=i>e;if(n=Rt-Ct)o.moveTo(0+n*It(e),0+n*jt(e)),o.arc(0,0,n,e,i,!a),s>Ct&&(o.moveTo(0+s*It(i),0+s*jt(i)),o.arc(0,0,s,i,e,a));else{const t=n*It(e),r=n*jt(e),l=s*It(i),h=s*jt(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Nd);const Qg=["points","cornerRadius",...Dd];class tm extends Vd{constructor(t){super(t),this.type="polygon",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Jh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePolygonAABBBounds(e,Jh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){const t=this.attribute.points,e=new gl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new tm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tm.NOWORK_ANIMATE_ATTR}}function em(t){return new tm(t)}tm.NOWORK_ANIMATE_ATTR=Nd;class im extends wu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function sm(t){return new im(t)}class nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class rm extends nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;tu(i,s+(r+o)/2,!0,a)}return i}}class am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};function um(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function pm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function gm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),um(t,t,[n+o,r+l,a+h]),um(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),um(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=lm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}um(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),um(i,i,[-s[0],-s[1],0]),gm(t,t,i)}}let fm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new to(["graphic"]),onSetStage:new to(["graphic","stage"]),onRemove:new to(["graphic"]),onRelease:new to(["graphic"]),onAddIncremental:new to(["graphic","group","stage"]),onClearIncremental:new to(["graphic","group","stage"]),beforeUpdateAABBBounds:new to(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new to(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Qt,this.tempAABBBounds2=new Qt,this._rectBoundsContribitions=[new nm],this._symbolBoundsContribitions=[new rm],this._imageBoundsContribitions=[new nm],this._circleBoundsContribitions=[new nm],this._arcBoundsContribitions=[new nm],this._pathBoundsContribitions=[new nm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new lo(t);return Lo(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=mp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=gp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){tu(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Zt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Rt-Ct?i.set(-a,-a,a,a):Oc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=Ct?i.set(0,0,0,0):Math.abs(l-h)>Rt-Ct?i.set(-n,-n,n,n):(Oc(h,l,n,i),Oc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){tu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;tu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Zt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};fm=hm([Oa(),dm(0,Ra(Au)),cm("design:paramtypes",[Object])],fm);const vm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let _m,ym;function bm(t){return _m||(_m=vm.CreateGraphic("text",{})),_m.initAttributes(t),_m.AABBBounds}const xm={x:0,y:0,z:0,lastModelMatrix:null};class Sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Gu(o,l,n),p=Uu(o,c),g=Nu(n,r),m=Vu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;xm.x=n,xm.y=r,xm.z=a,xm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=lm.allocate(),n=lm.allocate();mm(n,t,e),gm(s,d||s,n),xm.x=0,xm.y=0,xm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),lm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,xm.z=a,i.setTransformForCurrent()}else if(p)xm.x=0,xm.y=0,xm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,this.transformWithoutTranslate(i,xm.x,xm.y,xm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),xm.x=0,xm.y=0,xm.z=0;return xm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Gu(d,u,h),y=Uu(d,g),b=Nu(h),x=Vu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Lo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&lm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Am=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class km{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(km.IsGradientStr(t))try{const e=Am(t)[0];if(e){if("linear"===e.type)return km.ParseLinear(e);if("radial"===e.type)return km.ParseRadial(e);if("conic"===e.type)return km.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Mm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};class Pm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Lh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Lh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Bm=new Pm;let Rm=class{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Rm=wm([Oa(),Em(0,Ra(qa)),Em(0,Ia(hp)),Cm("design:paramtypes",[Object])],Rm);class Lm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Lh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Lh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Om=new Lm;const Im=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),$u(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),$u(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Dm=Om,Fm=Bm;const jm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},zm=Om,Hm=Bm;const Nm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vm=Et/2;function Gm(t,e,i,s,n,r){let a;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))a=[r=Lt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Lt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Lt(t[0]),i=Lt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Lt(a[0]),a[1]=Lt(a[1]),a[2]=Lt(a[2]),a[3]=Lt(a[3])}}else a=[0,0,0,0];if(s<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,s,n);const[o,l,h,c]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],d=Math.min(s/2,n/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],m=[l[0]-u[1],l[1]],f=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],y=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(m[0],m[1]),!q(m,f)){const e=m[0],i=m[1]+u[1];t.arc(e,i,u[1],-Vm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Vm,!1)}if(t.lineTo(y[0],y[1]),!q(y,b)){const e=y[0],i=y[1]-u[3];t.arc(e,i,u[3],Vm,Et,!1)}if(t.lineTo(g[0],g[1]),!q(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],Et,Et+Vm,!1)}return t.closePath(),t}var Wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Um{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Gm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Gm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Ym=class{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ym=Wm([Oa()],Ym);let Km=class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke}=t.attribute;let{width:v,height:_}=t.attribute;if(v=(null!=v?v:u-g)||0,_=(null!=_?_:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+v,s):e.moveTo(i+v,s),f[1]?e.lineTo(i+v,s+_):e.moveTo(i+v,s+_),f[2]?e.lineTo(i,s+_):e.moveTo(i,s+_),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Km=Wm([Oa()],Km);const Xm=new Um,$m=Om,qm=Bm;const Zm=new class extends Um{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Bc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Gm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Qm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},tf=Om,ef=Bm;var sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rf=function(t,e){return function(i,s){e(i,s,t)}};let af=class extends Sm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=lu,this.builtinContributions=[Im,Fm,Dm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Lt(d-c),p=d>c;let g=!1;if(nCt||C>Ct)&&(D=n*It(x),F=n*jt(x),j=r*It(A),z=r*jt(A),uCt){const t=Ft(k,P),r=Ft(M,P),a=Xu(j,z,R,L,n,t,Number(p)),o=Xu(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>Ct)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>Ct){const t=Ft(w,B),n=Ft(T,B),a=Xu(O,I,D,F,r,-n,Number(p)),o=Xu(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Ot(a.y01,a.x01),Ot(a.y11,a.x11),!p);const t=Ot(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*It(A),s+r*jt(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Lt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Ec[s]=t,i&&(i=!(null!==(e=Ec[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ec[e]=!!t[e],i&&(i=!!Ec[e]);else Ec[0]=!1,Ec[1]=!1,Ec[2]=!1,Ec[3]=!1;return{isFullStroke:i,stroke:Ec}})(d);if((v||C)&&(e.beginPath(),$u(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),$u(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Lt(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),md(o.color,l.color,h,!1)}(0,0,h,n);a||Gu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};af=sf([Oa(),rf(0,Ra(qa)),rf(0,Ia(Qu)),nf("design:paramtypes",[Object])],af);var of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(i,s){e(i,s,t)}};let cf=class extends Sm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=du,this.builtinContributions=[jm,Hm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function df(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function uf(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),df(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=To.ROW:"y"===s?m=To.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gf=class extends Sm{constructor(){super(...arguments),this.numberType=mu}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=pl(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function mf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function ff(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),df(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),df(t,l,1,s),o=!1):o=!0}t.closePath()}gf=pf([Oa()],gf);const vf=new class extends Lm{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:jc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:jc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_f=Bm;var yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xf=function(t,e){return function(i,s){e(i,s,t)}};function Sf(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}let Af=class extends Sm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=cu,this.builtinContributions=[vf,_f],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S,doStroke:A}=x,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Sf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Sf(e,C,{curveTension:b}),n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=To.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Lt(E.x-P.x),L=Lt(E.y-P.y);B=null==E.x1?To.ROW:null==E.y1?To.COLUMN:Number.isFinite(R+L)?R>L?To.ROW:To.COLUMN:To.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),mf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),mf(t,e,i,s),e.length=0,i.length=0)}n=o})),mf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?To.ROW:To.COLUMN,Number.isFinite(u)||(h=To.COLUMN),Number.isFinite(p)||(h=To.ROW);const g=i*(h===To.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Sm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Mf,kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Lo(t.pathShape.commandList,e,i,s,1,1,g);else{Lo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(np)),wf("design:paramtypes",[Object])],Ef);var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rf=function(t,e){return function(i,s){e(i,s,t)}};let Lf=class extends Sm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=_u,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Wu(g,m,k,M,c),w=Yu(g,v,k,M),C=Nu(c,d),E=Vu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Gm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(ap)),Bf("design:paramtypes",[Object])],Lf);var Of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Df=function(t,e){return function(i,s){e(i,s,t)}};let Ff=class extends Sm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bu,this.builtinContributions=[Qm,ef,tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Ff=Of([Oa(),Df(0,Ra(qa)),Df(0,Ia(op)),If("design:paramtypes",[Object])],Ff);const jf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Qt)}allocate(t,e,i,s){if(!this.pools.length)return(new Qt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Qt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const zf=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=jf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=bm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Gm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&jf.free(C),w()}};var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Sm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xu,this.builtinContributions=[zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Nc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=om.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),om.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=gp(l,f),_=mp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Wf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Sm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=vu,this.builtinContributions=[Xf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Wf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Uf(d,u),b=Uf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Yf(h,_,y,d,u),A=Yf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Uf(k,M),w=Yf(h,Uf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(rp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=pu}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Wu(u,f,p,g,h),k=Yu(u,v,p,g),M=Nu(h,c),T=Vu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Gm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Nm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave(),n.baseGlobalAlpha*=a;const o=Jh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=lm.allocate(),i=lm.allocate();mm(i,t,o),gm(e,l||e,i),n.modelMatrix=e,lm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&n.translate(h,c),s&&s.drawingCb&&(d=s.drawingCb()),n.modelMatrix!==l&&lm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};iv=Qf([Oa(),ev(0,Ra(qa)),ev(0,Ia(ip)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];let ov=class extends Sm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=gu,this.builtinContributions=[Zm,Jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Gm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,av[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Rd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};ov=sv([Oa(),rv(0,Ra(qa)),rv(0,Ia(sp)),nv("design:paramtypes",[Object])],ov);const lv=Symbol.for("IncrementalDrawContribution"),hv=Symbol.for("ArcRender"),cv=Symbol.for("AreaRender"),dv=Symbol.for("CircleRender"),uv=Symbol.for("GraphicRender"),pv=Symbol.for("GroupRender"),gv=Symbol.for("LineRender"),mv=Symbol.for("PathRender"),fv=Symbol.for("PolygonRender"),vv=Symbol.for("RectRender"),_v=Symbol.for("SymbolRender"),yv=Symbol.for("TextRender"),bv=Symbol.for("RichTextRender"),xv=Symbol.for("GlyphRender"),Sv=Symbol.for("ImageRender"),Av=Symbol.for("DrawContribution");var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tv=Symbol.for("DrawItemInterceptor"),wv=new Qt,Cv=new Qt;class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){wv.copy(s.dirtyBounds),Cv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(wv),s.backupDirtyBounds.copy(Cv)),!0}}class Pv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Bv=class{constructor(){this.order=1,this.interceptors=[new Ev,new Lv,new Rv,new Pv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===hu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&lm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};const Fv=Symbol.for("RenderService");let jv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jv=Ov([Oa(),Dv(0,Ra(Av)),Iv("design:paramtypes",[Object])],jv);var zv=new xa((t=>{t(Fv).to(jv)}));const Hv=Symbol.for("PickerService"),Nv=Symbol.for("GlobalPickerService");var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Gv=Symbol.for("PickItemInterceptor");let Wv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=om.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Wv=Vv([Oa()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Uv=Vv([Oa()],Uv);let Yv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===hu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Yv=Vv([Oa()],Yv);var Kv=new xa(((t,e,i)=>{i(Hv)||(t(Nv).toSelf(),t(Hv).toService(Nv)),t(Yv).toSelf().inSingletonScope(),t(Gv).toService(Yv),t(Wv).toSelf().inSingletonScope(),t(Gv).toService(Wv),t(Uv).toSelf().inSingletonScope(),t(Gv).toService(Uv),Ja(t,Gv)})),Xv=new xa((t=>{t(Su).to(fm).inSingletonScope(),t(Au).toConstantValue(vm)}));const $v=Symbol.for("AutoEnablePlugins"),qv=Symbol.for("PluginService");var Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qv=function(t,e){return function(i,s){e(i,s,t)}};let t_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound($v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};t_=Zv([Oa(),Qv(0,Ra(qa)),Qv(0,Ia($v)),Jv("design:paramtypes",[Object])],t_);var e_=new xa((t=>{t(qv).to(t_),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,$v)})),i_=new xa((t=>{Ja(t,eo)})),s_=new xa((t=>{t(Jl).to(Ql).inSingletonScope(),Ja(t,Jl)})),n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let a_=class{constructor(){this.type="static",this.offscreen=!1,this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};a_=n_([Oa(),r_("design:paramtypes",[])],a_);var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let h_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=zl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};h_=o_([Oa(),l_("design:paramtypes",[])],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=sh({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};u_=c_([Oa(),d_("design:paramtypes",[])],u_);var p_=new xa((t=>{t(a_).toSelf(),t(u_).toSelf(),t(h_).toSelf(),t(Lu).toService(a_),t(Ou).toService(u_),t(Iu).toService(h_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function m_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return g_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function v_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Jt,this.backupDirtyBounds=new Jt,this.global=zl.global,this.layerService=zl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,om.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,kl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ie(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=jf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=om.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):m_(t,kl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jf.free(n),om.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(lv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends gf{constructor(){super(...arguments),this.numberType=mu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Gu(u,p,c),_=Uu(u,g),y=Nu(c),b=Vu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Oa()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Af{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Gu(u,d,c),m=Nu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Oa()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let B_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new to([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,kl.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield f_(t,kl.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};B_=w_([Oa(),E_(0,La(uv)),E_(1,Ra(A_)),E_(2,Ra(M_)),E_(3,Ra(qa)),E_(3,Ia(Tv)),C_("design:paramtypes",[Array,Object,Object,Object])],B_);var R_=new xa((t=>{t(Pm).toSelf().inSingletonScope(),t(Lm).toSelf().inSingletonScope(),t(Av).to(x_),t(lv).to(B_),t(pv).to(iv).inSingletonScope(),t(uv).toService(pv),Ja(t,ip),t(Rm).toSelf().inSingletonScope(),Ja(t,hp),Ja(t,uv),t(Bv).toSelf().inSingletonScope(),t(Tv).toService(Bv),Ja(t,Tv)}));function L_(){L_.__loaded||(L_.__loaded=!0,th.load(Hu),th.load(Xv),th.load(zv),th.load(Kv),th.load(e_),function(t){t.load(i_),t.load(s_),t.load(p_)}(th),function(t){t.load(R_)}(th))}L_.__loaded=!1,L_();const O_=th.get(io);zl.global=O_;const I_=th.get(Bu);zl.graphicUtil=I_;const D_=th.get(Pu);zl.transformUtil=D_;const F_=th.get(Su);zl.graphicService=F_;const j_=th.get(Ru);zl.layerService=j_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),zl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class H_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),zl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){zl.graphicService.hooks.onAddIncremental.taps=zl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onClearIncremental.taps=zl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,zl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class V_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.unTap(this.key),zl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?zl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:zl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=ni(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Jh(t).text)}getTransformOfText(t){const e=Jh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=ti(h,c);o=t.x,l=t.y}const p=zl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));zl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===zl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&zl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===zl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const G_=new Qt;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(G_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(G_,t.parent&&t.parent.globalTransMatrix)))})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),zl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.taps=zl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const U_=new Qt;class Y_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ba.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Qt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Jh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&U_.copy(s)})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(U_.equals(i)||this.tryLayout(t,!1))})),zl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const K_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===mc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=mc.INITIAL,zl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),zl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:gc},{mode:"timeout",cons:pc},{mode:"manual",cons:uc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==mc.INITIAL&&(this.status=mc.PAUSE,!0)}resume(){return this.status!==mc.INITIAL&&(this.status=mc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===mc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===mc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=mc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=mc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};K_.addTimeline(_c),K_.setFPS(60);class X_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=pd.Get(e,ud.Color1),this.ambient=i;const s=zt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Ft(Dt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?pd.Get(e,ud.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function $_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function q_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Z_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&zl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ey="white";class iy extends wu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ey}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=zl.global,!this.global.env&&Q_()&&this.global.setEnv("browser"),this.window=th.get(Dh),this.renderService=th.get(Fv),this.pluginService=th.get(qv),this.layerService=th.get(Ru),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ey,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||K_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new vc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new X_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Z_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new H_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Jt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Y_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new V_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new ty))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=th.get(Hv));const i=this.pickerService.pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry=new oe(1,0,0,1,0,0),ay={x:0,y:0};let oy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this.path=new gl,this._clearMatrix=new oe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ay),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,ay.x,ay.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ay);const i=Mm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,ay.x,ay.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ry,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};oy=sy([Oa(),ny("design:paramtypes",[Object,Number])],oy);var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cy={WIDTH:500,HEIGHT:500,DPR:1};let dy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=cy.WIDTH,height:n=cy.HEIGHT,dpr:r=cy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};dy.env="browser",dy=ly([Oa(),hy("design:paramtypes",[Object])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let py=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Qt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};py=uy([Oa()],py);var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fy=class{constructor(){this._uid=ba.GenAutoIncrementId(),this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};fy=gy([Oa(),my("design:paramtypes",[])],fy);var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yy=function(t,e){return function(i,s){e(i,s,t)}};let by=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=zl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Qt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new oe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=lm.allocate();if(pm(i,e),a){if(i){const t=lm.allocate();r.modelMatrix=gm(t,a,i),lm.free(i)}}else pm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&lm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),om.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function xy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&xy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&xy(t,a,i,s,n))}function Sy(t,e){const i=t.length-1,s=[t[0]];return xy(t,0,i,e,s),s.push(t[i]),s}by=vy([Oa(),yy(0,Ra(qa)),yy(0,Ia(Gv)),_y("design:paramtypes",[Object])],by);let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(af).toSelf().inSingletonScope(),t(hv).to(af).inSingletonScope(),t(uv).toService(hv),t(Qu).toService(Rm),Ja(t,Qu))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(Lf).toSelf().inSingletonScope(),t(vv).to(Lf).inSingletonScope(),t(uv).toService(vv),t(Km).toSelf(),t(Ym).toSelf(),t(ap).toService(Km),t(ap).toService(Ym),t(ap).toService(Rm),Ja(t,ap))}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(gf).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(gv).to(gf).inSingletonScope(),t(uv).toService(gv))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(Af).toSelf().inSingletonScope(),t(cv).to(Af).inSingletonScope(),t(uv).toService(cv),t(tp).toService(Rm),Ja(t,tp),t(M_).toSelf().inSingletonScope())}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(Ff).toSelf().inSingletonScope(),t(_v).to(Ff).inSingletonScope(),t(uv).toService(_v),t(op).toService(Rm),Ja(t,op))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(cf).toSelf().inSingletonScope(),t(dv).to(cf).inSingletonScope(),t(uv).toService(dv),t(ep).toService(Rm),Ja(t,ep))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(yv).to(Gf).inSingletonScope(),t(uv).toService(yv),t(lp).toService(Rm),Ja(t,lp))}));let Fy=!1;const jy=new xa((t=>{Fy||(Fy=!0,t(Ef).toSelf().inSingletonScope(),t(mv).to(Ef).inSingletonScope(),t(uv).toService(mv),t(np).toService(Rm),Ja(t,np))}));let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(fv).to(Jf).inSingletonScope(),t(uv).toService(fv),t(rp).toService(Rm),Ja(t,rp))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vy=class{constructor(){this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Vy=Ny([Oa()],Vy);let Gy=!1;const Wy=new xa((t=>{Gy||(Gy=!0,t(xv).to(Vy).inSingletonScope(),t(uv).toService(xv))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=class extends Sm{constructor(){super(),this.numberType=yu,this.builtinContributions=[zf],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Gu(o,l,!0),d=Gu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Gm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};Ky=Uy([Oa(),Yy("design:paramtypes",[])],Ky);let Xy=!1;const $y=new xa((t=>{Xy||(Xy=!0,t(bv).to(Ky).inSingletonScope(),t(uv).toService(bv))}));let qy=!1;const Zy=new xa((t=>{qy||(qy=!0,t(Sv).to(ov).inSingletonScope(),t(uv).toService(Sv),t(sp).toService(Rm),Ja(t,sp))}));const Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Q_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),db=t=>e=>R(e,t),ub=t=>{at.getInstance().error(t)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ub("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ub("Access path missing closing bracket: "+t),a&&ub("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return cb((i&&i.get||db)(s),[n],e||n)},gb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>pb(t,e,i)));return t=>s.map((e=>e(t)))}return pb(t,e,i)};gb("id");const mb=cb((function(t){return t}),[],"identity"),fb=cb((function(){return 0}),[],"zero");cb((function(){return 1}),[],"one"),cb((function(){return!0}),[],"true"),cb((function(){return!1}),[],"false"),cb((function(){return{}}),[],"emptyObject");const vb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>_b(t,r,n)))))},yb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function bb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function xb(t,e,i,s,n){let r=0,a=0;return bb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Sb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;bb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xb(t,e,i,n,h)}}function Ab(t){return"horizontal"===t}function kb(t){return"vertical"===t}const Mb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Tb extends wu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,Mb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Mb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const tx=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},ex=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ix extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||tx(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=ex(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=ex(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=tx(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ac.now()-i>this.config.press.time&&ex(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rx=[0,0,0];let ax=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},_l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},xl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this._clearMatrix=new oe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new oe(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ju.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=zl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:xl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:xl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=Tm(this,l,t,i,s)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=Mm(this,l,this.dpr),r.strokeStyle=Tm(this,h,t,i,s),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=pp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=pp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};ax.env="browser",ax=sx([Oa(),nx("design:paramtypes",[Object,Number])],ax);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hx=class extends dy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=zl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ax(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function cx(t,e){return new xa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}hx.env="browser",hx=ox([Oa(),lx("design:paramtypes",[Object])],hx);const dx=cx(hx,ax);var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let mx=class extends by{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Lh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vx=class{constructor(){this.type="group",this.numberType=pu}contains(t,e,i){return!1}};vx=fx([Oa()],vx);const _x=new xa(((t,e,i,s)=>{_x.__vloaded||(_x.__vloaded=!0,t(Zb).to(vx).inSingletonScope(),t(Jb).toService(Zb),Ja(t,Jb))}));_x.__vloaded=!1;var yx=_x;const bx=new xa(((t,e,i,s)=>{i(mx)||t(mx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(mx):t(Hv).toService(mx)}));var xx,Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=xx=class extends fy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${xx.idprefix}_${xx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=zl.global,this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:xx.GenerateCanvasId(),canvasControled:!0};this.canvas=new hx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new hx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};kx.env="browser",kx.idprefix="visactor_window",kx.prefix_count=0,kx=xx=Sx([Oa(),Ax("design:paramtypes",[])],kx);const Mx=new xa((t=>{t(kx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(kx))).whenTargetNamed(kx.env)}));var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends py{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Qt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ba.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Tx([Oa(),wx("design:paramtypes",[])],Px);const Bx=new xa((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(eo).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(dx),t.load(Mx),e&&function(t){t.load(yx),t.load(bx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ox=class extends ax{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};Ox.env="feishu",Ox=Lx([Oa()],Ox);var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fx=class extends dy{constructor(t){super(t)}init(){this._context=new Ox(this,this._dpr)}release(){}};Fx.env="feishu",Fx=Ix([Oa(),Dx("design:paramtypes",[Object])],Fx);const jx=cx(Fx,Ox);var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};class Vx{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Gx=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new Vx}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Fx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Gx.env="feishu",Gx=zx([Oa(),Nx(0,Ra(io)),Hx("design:paramtypes",[Object])],Gx);const Wx=new xa((t=>{t(Gx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Gx))).whenTargetNamed(Gx.env)}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends by{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new oy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xx=Ux([Oa(),Kx(0,Ra(qa)),Kx(0,Ia(wb)),Kx(1,Ra(qa)),Kx(1,Ia(Gv)),Yx("design:paramtypes",[Object,Object])],Xx);const $x=new xa((t=>{$x.__vloaded||($x.__vloaded=!0,Ja(t,wb))}));$x.__vloaded=!1;var qx=$x,Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([Oa(),Qx(0,Ra(hv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new xa(((t,e,i,s)=>{eS||(eS=!0,t(Cb).to(tS).inSingletonScope(),t(wb).toService(Cb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};aS=sS([Oa(),rS(0,Ra(cv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new xa(((t,e,i,s)=>{oS||(oS=!0,t(Eb).to(aS).inSingletonScope(),t(wb).toService(Eb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([Oa(),dS(0,Ra(dv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new xa(((t,e,i,s)=>{pS||(pS=!0,t(Pb).to(uS).inSingletonScope(),t(wb).toService(Pb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};_S=mS([Oa(),vS(0,Ra(xv)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(jb).to(_S).inSingletonScope(),t(_S).toService(jb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};SS=xS([Oa()],SS);let AS=!1;const kS=new xa(((t,e,i,s)=>{AS||(AS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([Oa(),wS(0,Ra(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new xa(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(wb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OS=BS([Oa(),LS(0,Ra(fv)),RS("design:paramtypes",[Object])],OS);let IS=!1;const DS=new xa(((t,e,i,s)=>{IS||(IS=!0,t(Fb).to(OS).inSingletonScope(),t(wb).toService(Fb))}));var FS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zS=function(t,e){return function(i,s){e(i,s,t)}};let HS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};HS=FS([Oa(),zS(0,Ra(mv)),jS("design:paramtypes",[Object])],HS);let NS=!1;const VS=new xa(((t,e,i,s)=>{NS||(NS=!0,t(Lb).to(HS).inSingletonScope(),t(wb).toService(Lb))}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},US=function(t,e){return function(i,s){e(i,s,t)}};const YS=new Qt;let KS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;YS.setValue(i.x1,i.y1,i.x2,i.y2),YS.expand(-r/2),h=!YS.containsPoint(e)}}return s.highPerformanceRestore(),h}};KS=GS([Oa(),US(0,Ra(vv)),WS("design:paramtypes",[Object])],KS);let XS=!1;const $S=new xa(((t,e,i,s)=>{XS||(XS=!0,t(Ob).to(KS).inSingletonScope(),t(wb).toService(Ob))}));let qS=!1;const ZS=new xa(((t,e,i,s)=>{qS||(qS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};eA=JS([Oa(),tA(0,Ra(_v)),QS("design:paramtypes",[Object])],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Ib).to(eA).inSingletonScope(),t(wb).toService(Ib))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class{constructor(){this.type="text",this.numberType=xu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};rA=nA([Oa()],rA);let aA=!1;const oA=new xa(((t,e,i,s)=>{aA||(aA=!0,t(Db).to(rA).inSingletonScope(),t(wb).toService(Db))})),lA=new xa(((t,e,i,s)=>{i(Xx)||t(Xx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(Xx):t(Hv).toService(Xx)}));class hA{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uA=class extends py{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new hA(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};uA=cA([Oa(),dA("design:paramtypes",[])],uA);const pA=new xa((t=>{pA.isFeishuBound||(pA.isFeishuBound=!0,t(uA).toSelf().inSingletonScope(),t(eo).toService(uA))}));function gA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];gA.__loaded||(gA.__loaded=!0,t.load(pA),t.load(jx),t.load(Wx),e&&function(t){t.load(qx),t.load(lA),t.load(iS),t.load(lS),t.load(gS),t.load(bS),t.load(kS),t.load(PS),t.load(DS),t.load(VS),t.load($S),t.load(ZS),t.load(sA),t.load(oA)}(t))}pA.isFeishuBound=!1,gA.__loaded=!1;var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends ax{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vA.env="node",vA=mA([Oa(),fA("design:paramtypes",[Object,Number])],vA);var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bA=class extends dy{constructor(t){super(t)}init(){this._context=new vA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bA.env="node",bA=_A([Oa(),yA("design:paramtypes",[Object])],bA);const xA=cx(bA,vA);var SA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,s){e(i,s,t)}};let MA=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new bA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};MA.env="node",MA=SA([Oa(),kA(0,Ra(io)),AA("design:paramtypes",[Object])],MA);const TA=new xa((t=>{t(MA).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(MA))).whenTargetNamed(MA.env)}));var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CA=class extends py{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};CA=wA([Oa()],CA);const EA=new xa((t=>{EA.isNodeBound||(EA.isNodeBound=!0,t(CA).toSelf().inSingletonScope(),t(eo).toService(CA))}));function PA(t){PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(xA),t.load(TA))}EA.isNodeBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([Oa(),LA(0,Ra(hv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new xa(((t,e,i,s)=>{IA||(IA=!0,t(zb).to(OA).inSingletonScope(),t(Jb).toService(zb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Qt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([Oa(),zA(0,Ra(vv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new xa(((t,e,i,s)=>{VA||(VA=!0,t(Ub).to(NA).inSingletonScope(),t(Jb).toService(Ub))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends Sm{};UA=WA([Oa()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Jh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([Oa(),XA(0,Ra(gv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new xa(((t,e,i,s)=>{qA||(qA=!0,t(Gb).to($A).inSingletonScope(),t(Jb).toService(Gb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([Oa(),tk(0,Ra(cv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new xa(((t,e,i,s)=>{ik||(ik=!0,t(Hb).to(ek).inSingletonScope(),t(Jb).toService(Hb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Jh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&lm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([Oa(),ak(0,Ra(_v)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new xa(((t,e,i,s)=>{lk||(lk=!0,t(Yb).to(ok).inSingletonScope(),t(Jb).toService(Yb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([Oa(),uk(0,Ra(dv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new xa(((t,e,i,s)=>{gk||(gk=!0,t(Nb).to(pk).inSingletonScope(),t(Jb).toService(Nb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Jh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=mp(a,u,n),v=gp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&lm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([Oa(),_k(0,Ra(yv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new xa(((t,e,i,s)=>{bk||(bk=!0,t(Kb).to(yk).inSingletonScope(),t(Jb).toService(Kb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([Oa(),kk(0,Ra(mv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new xa(((t,e,i,s)=>{Tk||(Tk=!0,t(Wb).to(Mk).inSingletonScope(),t(Jb).toService(Wb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([Oa(),Pk(0,Ra(fv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new xa(((t,e,i,s)=>{Rk||(Rk=!0,t(Xb).to(Bk).inSingletonScope(),t(Jb).toService(Xb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([Oa(),Dk(0,Ra(xv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new xa(((t,e,i,s)=>{jk||(jk=!0,t(qb).to(Fk).inSingletonScope(),t(Jb).toService(qb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([Oa(),Vk(0,Ra(bv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t($b).to(Gk).inSingletonScope(),t(Jb).toService($b))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([Oa()],Kk);let Xk=!1;const $k=new xa(((t,e,i,s)=>{Xk||(Xk=!0,t(Vb).to(Kk).inSingletonScope(),t(Jb).toService(Vb))})),qk=Q_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,vm.RegisterGraphicCreator("arc",Jg),th.load(ky),th.load(qk?DA:iS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,vm.RegisterGraphicCreator("area",$g),th.load(Py),th.load(qk?sk:lS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,vm.RegisterGraphicCreator("circle",up),th.load(Oy),th.load(qk?mk:gS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,vm.RegisterGraphicCreator("glyph",Rg),th.load(Wy),th.load(qk?zk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,vm.RegisterGraphicCreator("group",Cu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,vm.RegisterGraphicCreator("image",Fg),th.load(Zy),th.load(qk?$k:kS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,vm.RegisterGraphicCreator("line",wg),th.load(Cy),th.load(qk?ZA:PS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,vm.RegisterGraphicCreator("path",Yg),th.load(jy),th.load(qk?wk:VS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,vm.RegisterGraphicCreator("polygon",em),th.load(Hy),th.load(qk?Lk:DS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,vm.RegisterGraphicCreator("rect",Pg),th.load(Ty),th.load(qk?GA:$S))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,vm.RegisterGraphicCreator("richtext",Gg),th.load($y),th.load(qk?Uk:ZS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,vm.RegisterGraphicCreator("shadowRoot",sm))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,vm.RegisterGraphicCreator("symbol",kg),th.load(Ry),th.load(qk?hk:sA))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,vm.RegisterGraphicCreator("text",yp),th.load(Dy),th.load(qk?xk:oA))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:xt,throttle:St};MM();let LM=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===O_.env?(O_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===O_.env?(O_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ei(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ei(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new _e(t).toHex(),o=new _e(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=_e.getColorBrightness(new _e(e));return _e.getColorBrightness(new _e(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:bm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=bm({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?vm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),vm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:Gke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>we&&keEe&&TeAe&&CeMe&&PeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([Oa()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([Oa()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([Oa()],uT);const pT=new xa(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(hp).toService(hT)),i(dT)||(t(dT).toSelf(),t($v).toService(dT)),i(uT)||(t(uT).toSelf(),t($v).toService(uT))}));class gT extends Tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=se(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Vc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Tb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Ie(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=vm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new gl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==So.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===So.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,xo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=ti(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,l+c)||gt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new gl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Tb{getStartAngle(){return re(this._startAngle)}getEndAngle(){return re(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=vm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=vm.line;Y(i)[0].cornerRadius&&(t=vm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=vm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=vm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function lw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function hw(t,e,i,s){const n=bm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const pw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},gw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,mw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class fw extends Tb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=pw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=vm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=vm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=vm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=vm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=vm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=vm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=vm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Lt(s[0])>Lt(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function vw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function _w(t,e){return Ie(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=He(t,i),r=He(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=ze(t),l=ze(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:te(t.angle);let m=i?t.angle+Pt:te(90-t.angle);const f=i?e.angle:te(e.angle);let v=i?e.angle+Pt:te(90-e.angle);m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Fe(n,i)+Fe(n,s))/2>Fe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const yw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&bw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function bw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function xw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Aw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Tw(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},ww(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),vw(e)}function Mw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Tw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function ww(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Cw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Ew(){aM(),cM(),_M(),kM()}var Pw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Tw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return ww(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=te(e)})),kw(i,t),!Aw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(Sw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),vw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:yw[n]||yw.parity;if(s.length>=3&&xw(s,r)){do{s=a(s,r)}while(s.length>=3&&xw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&bw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=vm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ei(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Bw.defaultAttributes=aw,U(Bw,Cw);class Rw{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return se(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Lw,Ow=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=vm.circle(c);d.name=sw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},rw,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Ow(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Iw.defaultAttributes=aw,U(Iw,Rw);class Dw extends yc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=Tt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=Tt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:At(i,s)})),r=Tt.lastIndex;return r{jw[t]=!0}));const Gw=t=>-Math.log(-t),Ww=t=>-Math.exp(-t),Uw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Yw=t=>10===t?Uw:t===Math.E?Math.exp:e=>Math.pow(t,e),Kw=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Xw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$w=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function qw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Zw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Jw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Qw(t,e,i,s){return 1===i&&(i=0),Jw(t,i,s)*(e/(1-i))}function tC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function eC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class nC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=tC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const rC=Symbol("implicit");class aC extends nC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Lw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=rC}clone(){const t=(new aC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==rC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class lC extends aC{constructor(t){super(),this.type=Lw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Qw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:oC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return oC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new lC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:hC}=xe;function cC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=_e.parseColorString(e)){const e=hC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?hC(t,e):e instanceof _e?hC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class dC extends nC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Vw,this._piecewise=Zw,this._interpolate=cC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?eC:Zw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Vw),this.rescale(i)):this._clamp!==Vw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const uC=Math.sqrt(50),pC=Math.sqrt(10),gC=Math.sqrt(2),mC=[1,2,5,10],fC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=bC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?_C(0,-(e-1)/s,s):_C((e-1)/s,0,s)},vC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return fC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return fC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=_C(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=_C(t,e,l);return n&&r.reverse(),r})),bC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=mC[0];return i>=uC?s=mC[3]:i>=pC?s=mC[2]:i>=gC&&(s=mC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function xC(t,e,i){const s=(e-t)/Math.max(0,i);return bC(s)}function SC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=xC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function kC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const MC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),TC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),wC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=yC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?MC(t,e,n):MC(t,e,sC(n)),h=MC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),CC=ft(((t,e,i,s,n)=>SC(s(t),s(e),i).map((t=>sC(n(t))))));class EC extends dC{constructor(){super(...arguments),this.type=Lw.Linear}clone(){return(new EC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return vC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=yC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return SC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=kC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=AC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=AC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=AC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function PC(t){return e=>-t(-e)}function BC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class RC extends dC{constructor(){super(Kw(10),Yw(10)),this.type=Lw.Log,this._limit=BC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new RC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Kw(this._base),s=Yw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=PC(i),this._pows=PC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Gw,this.untransformer=Ww):(this._logs=i,this._pows=s,this._limit=BC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Vw}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return TC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class LC extends EC{constructor(){super(Xw(1),$w(1)),this.type=Lw.Symlog,this._const=1}clone(){return(new LC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Xw(t),this.untransformer=$w(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return TC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class OC{constructor(){this.type=Lw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new OC).domain(this._domain).range(this._range).unknown(this._unknown)}}const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Qt(t).expand(i/2),n=new Qt(e).expand(i/2);return s.intersects(n)};function FC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function jC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=te(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=zC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=zC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=zC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=zC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Qt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},NC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=se({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Qt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},VC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&FC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},GC=(t,e,i,s)=>HC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),WC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},UC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!WC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?UC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},XC=(t,e)=>{if(zw(t.type))return((t,e)=>{if(!zw(t.type))return IC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return IC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=HC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&jC(n,i);)n=VC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return IC(h)})(t,e);if(Nw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=GC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=YC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=GC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=NC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)})(t,e)}return IC(t.domain())};function $C(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function qC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=qt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function ZC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=$C(t,!!n),o=$C(r,!!n);const h=qt.distancePP(s,l),c=qt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=qC(e,t,!1,!!n),o=qC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=$C(t,!!n),o=$C(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class JC extends Tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=$C(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=qC(t,o,!1,!!a)}const u=vm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=$C(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=vm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(QC,Cw);var tE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(eE,Rw);const iE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",sE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},nE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var rE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(rE||(rE={}));var aE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=rE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=rE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=rE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===O_.env&&(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===rE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===rE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=rE.endHandler):h+=l:this._activeTag===rE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===rE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===O_.env&&(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=aE(i,["formatMethod"]),{formatMethod:a}=s,o=aE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Jt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},nE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},nE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},nE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},nE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Sy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var hE,cE,dE,uE;function pE(){aM(),tT()}function gE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function mE(t,e){const{dx:i,dy:s}=gE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}lE.defaultAttributes=sE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(hE||(hE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(cE||(cE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(dE||(dE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(uE||(uE={}));class fE extends Tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=pw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=vm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=vm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=vm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function vE(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function _E(t,e,i,s){t&&(vE(t.startSymbol,e,i,s),t.lines.forEach((t=>vE(t,e,i,s))),vE(t.line,e,i,s),vE(t.endSymbol,e,i,s))}function yE(t,e,i,s){t&&(vE(t.getTextShape(),e,i,s),vE(t.getBgRect(),e,i,s))}function bE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function xE(t,e,i,s){t&&(bE(t.startSymbol,e,i,s),t.lines.forEach((t=>bE(t,e,i,s))),bE(t.line,e,i,s),bE(t.endSymbol,e,i,s))}function SE(t,e,i,s){t&&(bE(t.getTextShape(),e,i,s),bE(t.getBgRect(),e,i,s))}function AE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;vE(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),vE(t.endSymbol,s+r+a,o,n),vE(e.getTextShape(),s+r+a+o,l,n),vE(e.getBgRect(),s+r+a+o,l,n)}function kE(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}function ME(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function TE(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function wE(t,e,i,s,n,r){var a;_E(t,n,s,r),vE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?yE(i,n,s,r):vE(i,n,s,r)}function CE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;vE(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),vE(e,n+o+l,h,r),vE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(vE(i.getTextShape(),n+o+l+h+c,d,r),vE(i.getBgRect(),n+o+l+c,d,r)):vE(i,n+o+l+c,d,r)}function EE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?AE(t,e,s,r,a):"fadeIn"===i&&kE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?AE(t,e,s,n,a):"fadeIn"===i&&kE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?wE(n,r,e,i,s,o):"callIn"===t&&CE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?wE(n,r,e,i,s,a):"callIn"===t&&CE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;xE(t,n,s,r),bE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?SE(i,n,s,r):bE(i,n,s,r)}(n,r,e,t,i,s)}}const LE={type:"clipIn",duration:500,easing:"linear",delay:0},OE={type:"fadeIn",duration:500,easing:"linear",delay:0},IE={type:"callIn",duration:500,easing:"linear",delay:0},DE={type:"fadeOut",duration:500,easing:"linear",delay:0};class FE extends fE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=LE,this.defaultExitAnimation=DE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;mE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const jE=.001,zE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:hE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},NE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:dE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},VE={interactive:!0,label:{position:cE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},GE={interactive:!0,label:{position:dE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},UE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},YE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function KE(){XE._animate=EE}pE(),QT();class XE extends FE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,jE)||FM(Math.abs(e),3*Math.PI/2,jE)?jM(i,e,t):DM(e)?HE.postiveXAxis[t]:HE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function $E(){qE._animate=PE}XE.defaultAttributes=zE,pE(),gM();class qE extends fE{markerAnimate(t){qE._animate&&this._animationConfig&&qE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=vm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}qE.defaultAttributes=VE,pE(),tw();class ZE extends FE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case dE.arcInnerStart:l=s;case dE.arcOuterStart:l=s;break;case dE.arcInnerEnd:l=n;case dE.arcOuterEnd:l=n;break;case dE.center:case dE.arcInnerMiddle:case dE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return WE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}ZE.defaultAttributes=NE,pE(),Jk();class JE extends fE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case dE.center:h=(i+s)/2,c=(n+r)/2;break;case dE.arcInnerStart:h=i,c=n;break;case dE.arcOuterStart:h=s,c=n;break;case dE.arcInnerEnd:h=i,c=r;break;case dE.arcOuterEnd:h=s,c=r;break;case dE.arcInnerMiddle:h=i,c=(n+r)/2;break;case dE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},WE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=vm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function QE(){tP._animate=RE}JE.defaultAttributes=GE,pE(),QT(),tw(),SM(),lM(),cM();class tP extends fE{markerAnimate(t){tP._animate&&this._animationConfig&&tP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=DE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,jE)||FM(Math.abs(s),3*Math.PI/2,jE)?jM(t,s,n):DM(s)?YE.postiveXAxis[n]:YE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=uE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=vm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=vm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=vm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,jE)||FM(d,0,jE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(hP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(hP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===hP.focus||"focus"===o){const s=a.hasState(oP.focus);a.toggleState(oP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover,oP.focus],t),this._setLegendItemState(e,oP.selected,t)})):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover,oP.focus],t),this._setLegendItemState(e,oP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(oP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(oP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(lP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[oP.selected,oP.selectedHover],t),this._setLegendItemState(a,oP.unSelected,t)):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t))}else this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover],t),this._setLegendItemState(e,oP.unSelected,t))}))}this._dispatchLegendEvent(lP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,oP.selected),this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover])):(this._removeLegendItemState(e,[oP.selected,oP.selectedHover]),this._setLegendItemState(e,oP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=nP,spaceRow:h=rP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ei(c);let w;!1===x.visible?(w=vm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,hP.item,t,w)):(w=vm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,hP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?oP.selected:oP.unSelected);const C=vm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=vm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,hP.itemShape,t,w,S.state),s.addState(e?oP.selected:oP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=vm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,hP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,hP.itemLabel,t,w,A.state),D.addState(e?oP.selected:oP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,hP.itemValue,t,w,k.state),r.addState(e?oP.selected:oP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute;return this._itemContext.isHorizontal?new sP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new sP(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=vm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=nP,spaceRow:a=rP}=s,o=this._itemsContainer,{space:l=aP,defaultCurrent:h=1}=n,c=pP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=vm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(oP.selected)?this._setLegendItemState(t,oP.selectedHover,e):this._setLegendItemState(t,oP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===hP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(lP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(oP.unSelectedHover)||t.hasState(oP.selectedHover))&&(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(oP.unSelectedHover)&&!t.hasState(oP.selectedHover)||(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===hP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(lP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(oP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},gP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(oP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var fP;function vP(t){return y(t)?t:[t,t]}function _P(t){return t?"ew-resize":"ns-resize"}mP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:nP,spaceRow:rP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:aP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(fP||(fP={})),dP();class yP extends Tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:vP(d)[0],endValue:vP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=vm.group({x:0,y:0});m.name=fP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=vm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=fP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=vm.group({x:g?v:0,y:g?0:v});m.add(_);const y=vm.group({x:0,y:0});let b;if(y.name=fP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=vm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=fP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=vm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=fP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=vP(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(v.name=fP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=fP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(i.name=fP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=fP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=vm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=fP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":_P(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=vm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=fP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return vm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":_P(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),vm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=vm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=vm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===fP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===fP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===fP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===fP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}yP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},uP(),dP();class bP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function xP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}bP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},uP(),dP(),uM();class SP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=vm.group({x:0,y:0});this._innerView.add(x);const S=new yP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:xP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=vm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}SP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let AP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ei(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};AP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const kP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let MP=class extends Tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(kP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class TP extends Ag{constructor(t){super(t)}}var wP,CP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(wP||(wP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(CP||(CP={}));class EP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},EP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},EP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new TP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new TP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new TP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(wP.OnPlay)},this.pause=()=>{this._dispatchEvent(wP.OnPause)},this.forward=()=>{this._dispatchEvent(wP.OnForward)},this.backward=()=>{this._dispatchEvent(wP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}EP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},EP.defaultAttributes={[CP.Start]:{},[CP.Pause]:{},[CP.Backward]:{},[CP.Forward]:{}};const PP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},BP=[200,10];var RP,LP;!function(t){t.Default="default",t.Reverse="reverse"}(RP||(RP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(LP||(LP={}));const OP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},DP=t=>"top"===t||"bottom"===t;class FP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(DP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:BP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:BP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new yP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return DP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new EP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=DP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:BP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(DP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:DP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:DP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function jP(){dP(),aM(),SM()}FP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},PP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},PP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},PP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},PP),{key:"backward",position:"start"})}},jP();class zP extends FP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:RP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(LP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(OP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===RP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(LP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(LP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(LP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(LP.change),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var HP,NP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};jP();class VP extends FP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(LP.change))},this.play=()=>NP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(LP.play),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(LP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(HP||(HP={}));const GP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},WP=5;const UP={debounce:xt,throttle:St};aM(),gM();let YP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:UP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(HP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(HP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(HP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=GP.trigger,updateTrigger:e=GP.updateTrigger,endTrigger:i=GP.endTrigger,resetTrigger:s=GP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Xe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(HP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(HP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=WP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=vm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},XP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},$P={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Qt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},qP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let ZP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ei(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Nc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>qP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&yg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return KP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return KP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};ZP.defaultAttributes=$P;const JP=pt;function QP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function eB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function iB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function sB(t,e){const i=iB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function nB(t,e){const i=rB(t),s=rB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function rB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function aB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function oB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const lB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var cB,dB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(cB||(cB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dB||(dB={}));const uB="__VCHART",pB=500,gB=500,mB=`${uB}_LABEL_LIMIT`,fB=`${uB}_LABEL_ALIGN`,vB=`${uB}_LABEL_TEXT`,_B=`${uB}_LABEL_VISIBLE`,yB=`${uB}_LABEL_X`,bB=`${uB}_LABEL_Y`,xB=`${uB}_ARC_TRANSFORM_VALUE`,SB=`${uB}_ARC_RATIO`,AB=`${uB}_ARC_START_ANGLE`,kB=`${uB}_ARC_END_ANGLE`,MB=`${uB}_ARC_K`,TB=`${uB}_ARC_MIDDLE_ANGLE`,wB=`${uB}_ARC_QUADRANT`,CB=`${uB}_ARC_RADIAN`,EB=-Math.PI/2,PB=3*Math.PI/2,BB=-90,RB=.6;var LB,OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(LB||(LB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(OB||(OB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(IB||(IB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(DB||(DB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(FB||(FB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(jB||(jB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(zB||(zB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(HB||(HB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(NB||(NB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(VB||(VB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(GB||(GB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WB||(WB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(UB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",UB.AFTER_EVALUATE_DATA="afterEvaluateData",UB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",UB.AFTER_EVALUATE_SCALE="afterEvaluateScale",UB.BEFORE_PARSE_VIEW="beforeParseView",UB.AFTER_PARSE_VIEW="afterParseView",UB.BEFORE_TRANSFORM="beforeTransform",UB.AFTER_TRANSFORM="afterTransform",UB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",UB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",UB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",UB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",UB.BEFORE_STAGE_RESIZE="beforeStageResize",UB.AFTER_STAGE_RESIZE="afterStageResize",UB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",UB.AFTER_VRENDER_DRAW="afterVRenderDraw",UB.BEFORE_MARK_JOIN="beforeMarkJoin",UB.AFTER_MARK_JOIN="afterMarkJoin",UB.BEFORE_MARK_UPDATE="beforeMarkUpdate",UB.AFTER_MARK_UPDATE="afterMarkUpdate",UB.BEFORE_MARK_STATE="beforeMarkState",UB.AFTER_MARK_STATE="afterMarkState",UB.BEFORE_MARK_ENCODE="beforeMarkEncode",UB.AFTER_MARK_ENCODE="afterMarkEncode",UB.BEFORE_DO_LAYOUT="beforeDoLayout",UB.AFTER_DO_LAYOUT="afterDoLayout",UB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",UB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",UB.BEFORE_DO_RENDER="beforeDoRender",UB.AFTER_DO_RENDER="afterDoRender",UB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",UB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",UB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",UB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",UB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",UB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",UB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",UB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",UB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",UB.BEFORE_ELEMENT_STATE="beforeElementState",UB.AFTER_ELEMENT_STATE="afterElementState",UB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",UB.AFTER_ELEMENT_ENCODE="afterElementEncode",UB.ANIMATION_START="animationStart",UB.ANIMATION_END="animationEnd",UB.ELEMENT_ANIMATION_START="elementAnimationStart",UB.ELEMENT_ANIMATION_END="elementAnimationEnd",UB.ALL_ANIMATION_START="allAnimationStart",UB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(YB||(YB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(KB||(KB={}));const XB="__vgrammar_scene_item__",$B=[IB.line,IB.area],qB=[IB.arc3d,IB.rect3d,IB.pyramid3d],ZB="key",JB=[{}],QB=["key"],tR=!0,eR=!0,iR=!1,sR=!0,nR="VGRAMMAR_IMMEDIATE_ANIMATION",rR=0,aR=1e3,oR=0,lR=0,hR=!1,cR=!1,dR="quintInOut",uR={stopWhenStateChange:!1,immediatelyApply:!0},pR="_mo_hide_";function gR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function mR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return gR(t.dependency,e);var i;return[]}function fR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function vR(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function _R(t,e){return yR(t)?t.output():e[t]}const yR=t=>t&&!u(t.grammarType),bR=t=>d(t)?t:e=>e[t];function xR(t){return!!(null==t?void 0:t.scale)}function SR(t){return!!(null==t?void 0:t.field)}function AR(t,e){if(!t)return[];let i=[];return t.scale&&(i=yR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(mR(t,e))}function kR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function MR(t,e,i,s,n){i&&(fR(i)?e.forEach((e=>{const n=vR(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case IB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case IB.group:case IB.rect:case IB.image:return["width","height","y1"].includes(e);case IB.path:case IB.shape:return["path","customPath"].includes(e);case IB.line:return"defined"===e;case IB.area:return["x1","y1","defined"].includes(e);case IB.rule:return["x1","y1"].includes(e);case IB.symbol:return"size"===e;case IB.polygon:return"points"===e;case IB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(xR(l)){const t=_R(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?gb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(SR(l)){const t=gb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=vR(l,s,e.datum,t)}))})))}function TR(t,e,i,s){if(!t)return null;if(fR(t))return vR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(xR(h)){const t=_R(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?gb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(SR(h)){const t=gb(h.field);n[r]=t(e)}else n[r]=vR(h,s,e,i)})),n}class wR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let CR=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};CR._plotMarks={},CR._marks={},CR._components={},CR._graphicComponents={},CR._transforms={},CR._grammars={},CR._glyphs={},CR._animations={},CR._interactions={},CR._graphics={},CR.registerGlyph=(t,e,i,s,n)=>(CR._glyphs[t]=new wR(e,i,s,n),CR._glyphs[t]),CR.registerAnimationType=(t,e)=>{CR._animations[t]=e},CR.getAnimationType=t=>CR._animations[t],CR.registerInteraction=(t,e)=>{CR._interactions[t]=e},CR.registerGraphic=(t,e)=>{CR._graphics[t]=e},CR.getGraphicType=t=>CR._graphics[t],CR.createGraphic=(t,e)=>{const i=CR._graphics[t];return i?i(e):null};const ER=t=>!!IB[t];function PR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=CR.getGraphicType(e)?CR.createGraphic(e,i):CR.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const BR=t=>{t&&(t[XB]=null,t.release(),t.parent&&t.parent.removeChild(t))},RR=["fillOpacity"],LR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const OR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[IB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[IB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[IB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const IR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?OR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(RR.includes(r)?LR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{RR.includes(t)?LR(n,t,e):n[t]=e[t]}));return n},DR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),FR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],jR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(FR);function zR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?jR:FR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>DR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=HR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function HR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let NR=class{constructor(t){this.data=null,this.states=[],this.diffState=OB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));MR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?IR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[XB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?IR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===OB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(BR(this.graphicItem),this.graphicItem[XB]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=bR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(vR(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===OB.unChange&&(this.diffState=OB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,pR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[pR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||this.useStates(this.states),this.mark.markType===IB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new gl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[LB.update],a=e[LB.enter],o=e[LB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===OB.enter?(a&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.update?((n&&a||i)&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.exit&&o&&(i&&MR(this,t,a,s,l),MR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)_b(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[IB.line,IB.area,IB.largeRects,IB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||kR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[LB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=HR(h),e===IB.line||e===IB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>kR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===IB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=zR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=HR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?zR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=TR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=zR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===IB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===IB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(BR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class VR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const GR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class WR extends VR{constructor(t,e){super(t,e),this.type=WR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},WR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}WR.type="element-select",WR.defaultOptions={state:KB.selected,trigger:"click"};class UR extends VR{constructor(t,e){super(t,e),this.type=UR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function YR(t){if(t)return t.type===Lw.Band?t.bandwidth():t.type===Lw.Point?t.step():void 0}UR.type="element-highlight",UR.defaultOptions={highlightState:KB.highlight,blurState:KB.blur,trigger:"pointerover",triggerOff:"pointerout"};class KR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const XR=()=>{U(WR,KR),CR.registerInteraction(WR.type,WR)},$R=()=>{U(UR,KR),CR.registerInteraction(UR.type,UR)},qR=(t,e)=>yR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,ZR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=qR(n,e),i}),{}):t.map((t=>qR(t,e))):t;let JR=-1;class QR extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++JR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(mR(this.spec[e],this.view)),this.spec[e]=t,this.attach(mR(t,this.view)),this.commit(),this}}const tL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=mR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},eL=(t,e)=>{const i=CR.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(gR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>tL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return tL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},iL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=eL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},sL={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class nL extends QR{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!sL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return sL[e.type](t,i,new ya(new va))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?mR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=mR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=mR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=yR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=iL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const rL="window",aL="view",oL={trap:!1},lL="width",hL="height",cL="viewWidth",dL="viewHeight",uL="padding",pL="viewBox",gL="autoFit";function mL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function fL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,mL(t,e,n,s)}class vL{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}return this.nodes.push(t),mL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,fL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class _L{constructor(t){this.list=[],this.ids={},this.idFunc=t||mb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class yL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new _L((t=>t.uid)),this._heap=new vL(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new _L((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const bL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===IB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class xL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Qd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{zl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new iy(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Qb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ix(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function SL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function AL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function kL(t,e,i,s,n){if(n===rL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{AL(t,SL(t),!1)}))}));const e=SL(t);AL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class ML extends QR{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?vR(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},EL=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class PL extends NR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return MR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[XB]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?IR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===OB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=IR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=OR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===IB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return $B.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)_b(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[XB]=null})),this.glyphGraphicItems=null),super.release()}}const BL=t=>t.markType===IB.glyph?new PL(t):new NR(t);function RL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(ZB,i?t.slice().sort(i):t.slice()),{keys:QB,data:s};const n=bR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class LL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?RL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const OL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const IL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class DL extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class FL extends yc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Nd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}xc.mode|=ko.SET_ATTR_IMMEDIATELY;let jL=0;const zL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof yc||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class HL{constructor(t,e,i){this.id=jL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!CR.getAnimationType(e.type))return null;const r=CR.getAnimationType(e.type)(t,n,i);return OL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?IL(t,0,n[i].from,0,s):void 0,e.to[i]=l?IL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),OL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=zL(o);return u(o)||zL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new FL(r.from,r.to,a,t.easing):void 0:new DL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new $c(a,e))}r>0&&t.wait(r)}}function NL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(VL(i,t[i]))})),e}function VL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:rR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:cR,loop:null!==(s=h.loop)&&void 0!==s?s:hR,controlOptions:z({},uR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:aR,delay:null!==(a=h.delay)&&void 0!==a?a:oR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:lR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:dR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:rR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:cR,loop:null!==(d=t.loop)&&void 0!==d?d:hR,controlOptions:z({},uR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:oR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:lR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:dR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function GL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class WL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class UL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=NL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=NL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==OB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=VL(nR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===OB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new HL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===OB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=vR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=GL(t.startTime,e,n),o=GL(t.totalTime,e,n),l=GL(t.oneByOne,e,n),h=GL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=GL(t.delay,e,n),l=GL(t.delayAfter,e,n),h=null!==(i=GL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:GL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===OB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===OB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===nR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===OB.exit&&0===o[OB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class YL extends QR{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new UL(this,{}),this.differ=new LL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===OB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===WB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:JB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===IB.group)return;const e=RL(null!=t?t:JB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(OB.update,t,e,i)}encodeState(t,e,i,s){if(t===OB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(fR(n))this.detach(AR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(AR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(AR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(AR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(AR(i,this.view))):fR(e)?(this.spec.encode[t]=e,this.attach(AR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(AR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=iL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return $B.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==OB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===YB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!fR(n)&&Object.keys(n).forEach((t=>{xR(n[t])&&(e[t]=_R(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];fR(s)||Object.keys(s).forEach((t=>{SR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB];if((null==s?void 0:s.mark)===this){const i=kL(this.view,t,s,0,aL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new UL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=_R(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==IB.group){if(!this.graphicItem){const t=PR(this,IB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||qB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==IB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=bR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>ZB),a=bR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>ZB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===OB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=OB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):BL(this),n.diffState===OB.exit&&(n.diffState=OB.enter,this.animate.getElementAnimators(n,OB.exit).forEach((t=>t.stop("start")))),n.diffState=OB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=OB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:JB;l||this.differ.setCurrentData(RL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=TR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{this.markType===IB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:PR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==IB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=bR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>ZB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=BL(this);e.diffState=OB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=BL(this);i.diffState=OB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==IB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=PR(this,IB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==OB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:OR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=OB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&BR(this.graphicItem),this.detachAll(),super.release()}}let KL=class extends YL{constructor(t,e){super(t,IB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===IB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return OR.rect}evaluateJoin(t){if(!this.elements.length){const t=BL(this);t.updateData(ZB,JB,(()=>""),this.view),this.elements=[t],this.elementMap.set(ZB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return MR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:PR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function XL(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function $L(t,e){return Math.min(t<0?t+e:t-1,e)}function qL(t,e,i){let s=$L(t,i),n=$L(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=$L(Math.max(0,n-1),i)):n=$L(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const ZL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>XL(t,i))),u=l.map((t=>XL(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=qL(e,i,r),{start:h,end:c}=qL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Jt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},JL={[DB.axis]:0,[DB.legend]:1,[DB.slider]:2,[DB.player]:3,[DB.datazoom]:4},QL=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=JL[t.componentType])&&void 0!==s?s:1/0},tO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=yb(r.maxChildWidth,n.width()),o=yb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=CL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dQL(t)-QL(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==IB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=tO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(cL,o),i.updateSignal(dL,l),i.updateSignal(uL,h)}else tO(t,n,a,e);else"grid"===r.display&&ZL(t,n,a);eO(n,e,i)}}))};class iO extends YL{constructor(t,e,i){super(t,IB.glyph,i),this.glyphType=e,this.glyphMeta=CR.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!CR.getGraphicType(IB.glyph))return;const s=CR.createGraphic(IB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(CR.getGraphicType(n[t])){const e=CR.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const sO=Symbol.for("key");class nO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=RL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=RL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=bR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:sO})),r=RL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:sO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==sO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=vR(i.animation.delay,n,o,l),d=vR(i.animation.duration,n,o,l),u=vR(i.animation.oneByOne,n,o,l),p=vR(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Td(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Sd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>kd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Md({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Tc,null!==(l=i.easing)&&void 0!==l?l:wc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new wd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Tc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Td(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class rO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class aO extends rO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===IB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===IB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===IB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===IB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class lO extends YL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=PR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?IB.richtext:IB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}lO.markType=IB.text;const hO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},cO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},dO=Object.assign({},hO);dO.axis=Object.assign({},dO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.circleAxis=Object.assign({},dO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.grid=Object.assign({},dO.grid,{style:{stroke:"#404349"}}),dO.circleGrid=Object.assign({},dO.circleGrid,{style:{stroke:"#404349"}}),dO.rectLabel=Object.assign({},dO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.lineLabel=Object.assign({},dO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.symbolLabel=Object.assign({},dO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.title=Object.assign({},dO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const uO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:cO,components:dO},pO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:cO,components:hO};let gO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};gO._themes=new Map,gO.registerTheme("default",pO),gO.registerTheme("dark",uO);class mO extends YL{constructor(t,e,i,s){super(t,IB.component,i),this._componentDatum={[ZB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:CR.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,ZB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[ZB]+=1}evaluateJoin(t){return this.spec.key=ZB,t?(t[ZB]=this._componentDatum[ZB],this._componentDatum=t):this._componentDatum={[ZB]:this._componentDatum[ZB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class fO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB],n=kL(0,t,s,0,aL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(yR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):ER(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ML(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new nL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=CR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=CR.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case IB.group:n=new KL(this,s);break;case IB.glyph:n=new iO(this,null==i?void 0:i.glyphType,s);break;case IB.component:n=CR.hasComponent(null==i?void 0:i.componentType)?CR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new mO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case IB.text:n=new lO(this,t,s);break;default:n=CR.hasMark(t)?CR.createMark(t,this,s):new YL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(IB.group,t)}glyph(t,e){return this.mark(IB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(IB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.grid,mode:e})}legend(t){return this.mark(IB.component,t,{componentType:DB.legend})}slider(t){return this.mark(IB.component,t,{componentType:DB.slider})}label(t){return this.mark(IB.component,t,{componentType:DB.label})}datazoom(t){return this.mark(IB.component,t,{componentType:DB.datazoom})}player(t){return this.mark(IB.component,t,{componentType:DB.player})}title(t){return this.mark(IB.component,t,{componentType:DB.title})}scrollbar(t){return this.mark(IB.component,t,{componentType:DB.scrollbar})}customized(t,e){const i=CR.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&wL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(BR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++TL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(gO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(lL,t.width),this.updateSignal(hL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=CR.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:lL,value:null!==(s=t[lL])&&void 0!==s?s:0},{id:hL,value:null!==(n=t[hL])&&void 0!==n?n:0},{id:uL,value:CL(null!==(a=null!==(r=t[uL])&&void 0!==r?r:e[uL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:cL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[lL]-i.left-i.right},dependency:[lL,uL]}},{id:dL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[hL]-i.top-i.bottom},dependency:[hL,uL]}},{id:pL,update:{callback:(t,e)=>{const i=CL(e[uL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[cL],i.top+e[dL])},dependency:[cL,dL,uL]}},{id:gL,value:null!==(o=t[gL])&&void 0!==o?o:e[gL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===IB.glyph?{glyphType:t.glyphType}:t.type===IB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=gO.getTheme(t))&&void 0!==e?e:gO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(lL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(hL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(cL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(uL);if(arguments.length){const i=CL(t);return this.updateSignal(e,i),i}return CL(e.output())}autoFit(t){const e=this.getSignalById(gL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(pL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=WB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===IB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||eO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{bL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),bL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=tR,morph:o=eR,morphAll:l=iR,animation:h={},enableExitAnimation:c=sR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:dR,delay:null!==(i=h.delay)&&void 0!==i?i:oR,duration:null!==(s=h.duration)&&void 0!==s?s:aR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:cR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=WB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=WB.reevaluate,this._dataflow.evaluate()),this._layoutState=WB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!wL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return bL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ii(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(lL,t)),e!==this.height()&&(s=!0,this.updateSignal(hL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):ER(t)?(i.markType=t,i.source=e):i.source=t===rL?rL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=gR(l,this),v=EL(((t,e)=>{const s=c===aL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===rL&&(t=kL(0,t,e,0,rL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===aL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,aL,d))return this.addEventListener(d,v,oL),()=>{this.removeEventListener(d,v)}}else if(c===rL)return O_.addEventListener(d,v),this._eventListeners.push({type:d,source:O_,handler:v}),()=>{O_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===O_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=CR.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new xL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new rO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aO((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new yL,this.animate=new oO(this),this._morph=new nO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[aL,rL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:gO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&O_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==IB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&O_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),CR.unregisterRuntimeTransforms(),at.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const vO=()=>{bM(),uM(),CR.registerGraphic(IB.path,Yg)},_O=()=>{bM(),fM(),CR.registerGraphic(IB.rect,Pg)},yO=()=>{bM(),cM(),CR.registerGraphic(IB.rule,wg)},bO=()=>{bM(),SM(),CR.registerGraphic(IB.symbol,kg)},xO=()=>{bM(),kM(),_M(),CR.registerGraphic(IB.text,yp)},SO=()=>{bM(),nM(),CR.registerGraphic(IB.glyph,Rg)},AO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},MO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Ab(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},TO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ab(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},wO=AO(MO),CO=kO(MO);const EO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ab(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},PO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ab(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},BO=AO(EO),RO=kO(EO);const LO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},IO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?OO:LO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},DO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},jO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class zO extends mO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const HO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class NO extends zO{constructor(t,e,i){super(t,DB.axis,e),this.spec.componentType=DB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=TR(n,e,i,s);const h=vR(this.spec.inside,s,e,i),c=vR(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(HO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=vR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case jB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case jB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?jB.circleAxis:jB.lineAxis,this._axisComponentType}}NO.componentType=DB.axis;let VO=class extends mO{constructor(t,e){super(t,DB.label,e),this.spec.componentType=DB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=vR(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=vR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case IB.line:case IB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case IB.rect:case IB.rect3d:case IB.interval:g=p.rectLabel;break;case IB.symbol:case IB.circle:case IB.cell:g=p.symbolLabel;break;case IB.arc:case IB.arc3d:g=p.arcLabel;break;case IB.polygon:case IB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=TR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=TR(i,t,e,d);m.push(z({},f,s))}));else{const t=TR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};VO.componentType=DB.label;const GO=()=>{CR.registerGraphicComponent(DB.label,(t=>new JT(t))),CR.registerComponent(DB.label,VO)};class WO extends zO{constructor(t,e,i){super(t,DB.grid,e),this.spec.componentType=DB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=TR(s,t,e,i);const d=vR(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case zB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case zB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=vR(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(HO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===zB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=vR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case zB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case zB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=zB.circleAxisGrid:this._gridComponentType=zB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case jB.circleAxis:this._gridComponentType=zB.circleAxisGrid;break;case jB.lineAxis:default:this._gridComponentType=zB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?zB.lineAxisGrid:zB.circleAxisGrid:zB.lineAxisGrid}else this._gridComponentType=zB.lineAxisGrid;return this._gridComponentType}}WO.componentType=DB.grid;const UO=(t,e,i)=>e.filter((e=>t.callback(e,i))),YO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function KO(t){return t.reduce(((t,e)=>t+e),0)}const XO={min:$,max:X,average:function(t){return 0===t.length?0:KO(t)/t.length},sum:KO};function $O(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function qO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function ZO(t,e,i,s){return qO(t,e,i,"min",s)}function JO(t,e,i,s){return qO(t,e,i,"max",s)}function QO(t,e,i,s){return qO(t,e,i,"average",s)}function tI(t,e,i,s){return qO(t,e,i,"sum",s)}const eI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$O;if("min"===n?l=ZO:"max"===n?l=JO:"average"===n?l=QO:"sum"===n&&(l=tI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const iI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(pR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(pR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(pR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},sI=()=>{CR.registerTransform("filter",{transform:UO,markPhase:"beforeJoin"},!0)},nI=()=>{CR.registerTransform("map",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{CR.registerTransform("sampling",{transform:eI,markPhase:"afterEncode"},!0)},aI=()=>{CR.registerTransform("markoverlap",{transform:iI,markPhase:"afterEncode"},!0)},oI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},hI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},cI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},dI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const pI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},xI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},SI=(t,e,i)=>({from:{points:xI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e)}}),kI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),MI=(t,e,i)=>({from:{points:kI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),TI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:kI(t,e,i)}}),wI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),CI=(t,e,i)=>({from:{points:wI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),EI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:wI(t,e,i)}}),PI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},LI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},OI={symbol:["_mo_hide_","visible"]},II=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=OI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{_b(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},DI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},jI=()=>{CR.registerAnimationType("clipIn",oI)},zI=()=>{CR.registerAnimationType("clipOut",lI)},HI=()=>{CR.registerAnimationType("fadeIn",hI)},NI=()=>{CR.registerAnimationType("fadeOut",cI)},VI=()=>{CR.registerAnimationType("growCenterIn",dI)},GI=()=>{CR.registerAnimationType("growCenterOut",uI)},WI=()=>{CR.registerAnimationType("growHeightIn",mI)},UI=()=>{CR.registerAnimationType("growHeightOut",fI)},YI=()=>{CR.registerAnimationType("growWidthIn",pI)},KI=()=>{CR.registerAnimationType("growWidthOut",gI)},XI=()=>{CR.registerAnimationType("growPointsIn",SI)},$I=()=>{CR.registerAnimationType("growPointsOut",AI)},qI=()=>{CR.registerAnimationType("growPointsXIn",MI)},ZI=()=>{CR.registerAnimationType("growPointsXOut",TI)},JI=()=>{CR.registerAnimationType("growPointsYIn",CI)},QI=()=>{CR.registerAnimationType("growPointsYOut",EI)},tD=()=>{CR.registerAnimationType("growAngleIn",vI)},eD=()=>{CR.registerAnimationType("growAngleOut",_I)},iD=()=>{CR.registerAnimationType("growRadiusIn",yI)},sD=()=>{CR.registerAnimationType("growRadiusOut",bI)},nD=()=>{CR.registerAnimationType("moveIn",PI)},rD=()=>{CR.registerAnimationType("moveOut",BI)},aD=()=>{CR.registerAnimationType("scaleIn",RI)},oD=()=>{CR.registerAnimationType("scaleOut",LI)},lD=()=>{CR.registerAnimationType("rotateIn",DI)},hD=()=>{CR.registerAnimationType("rotateOut",FI)},cD=()=>{CR.registerAnimationType("update",II)};class dD extends YL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=fR(e)?null:Object.keys(e).reduce(((t,s)=>(xR(e[s])&&(t[s]=_R(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=TR(e,t,i,n);if(u(r.size)){const t=s.x?YR(s.x):void 0,e=s.y?YR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(OR.symbol)}release(){super.release(),this._encoders=null}}dD.markType=IB.cell;const uD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var pD,gD,mD;t.ChartEvent=void 0,(pD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",pD.rendered="rendered",pD.renderFinished="renderFinished",pD.animationFinished="animationFinished",pD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",pD.afterInitData="afterInitData",pD.afterInitEvent="afterInitEvent",pD.afterInitMark="afterInitMark",pD.rawDataUpdate="rawDataUpdate",pD.viewDataFilterOver="viewDataFilterOver",pD.viewDataUpdate="viewDataUpdate",pD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",pD.markDeltaYUpdate="markDeltaYUpdate",pD.viewDataLabelUpdate="viewDataLabelUpdate",pD.scaleDomainUpdate="scaleDomainUpdate",pD.scaleUpdate="scaleUpdate",pD.dataZoomChange="dataZoomChange",pD.drill="drill",pD.layoutStart="layoutStart",pD.layoutEnd="layoutEnd",pD.layoutRectUpdate="layoutRectUpdate",pD.playerPlay="playerPlay",pD.playerPause="playerPause",pD.playerEnd="playerEnd",pD.playerChange="playerChange",pD.playerForward="playerForward",pD.playerBackward="playerBackward",pD.scrollBarChange="scrollBarChange",pD.brushStart="brushStart",pD.brushChange="brushChange",pD.brushEnd="brushEnd",pD.brushClear="brushClear",pD.legendSelectedDataChange="legendSelectedDataChange",pD.legendFilter="legendFilter",pD.legendItemClick="legendItemClick",pD.legendItemHover="legendItemHover",pD.legendItemUnHover="legendItemUnHover",pD.tooltipShow="tooltipShow",pD.tooltipHide="tooltipHide",pD.tooltipRelease="tooltipRelease",pD.afterResize="afterResize",pD.afterRender="afterRender",pD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(gD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",gD.window="window",gD.canvas="canvas",t.Event_Bubble_Level=void 0,(mD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",mD.chart="chart",mD.model="model",mD.mark="mark";const fD=`${uB}_waterfall_default_seriesField`,vD=`${uB}_CORRELATION_X`,_D=`${uB}_CORRELATION_Y`,yD=`${uB}_CORRELATION_SIZE`,bD=`${uB}_MEASURE_CANVAS_ID`,xD=`${uB}_DEFAULT_DATA_INDEX`,SD=`${uB}_DEFAULT_DATA_KEY`,AD=`${uB}_DEFAULT_DATA_SERIES_FIELD`,kD=`${uB}_DEFAULT_SERIES_STYLE_NAME`;var MD;t.AttributeLevel=void 0,(MD=t.AttributeLevel||(t.AttributeLevel={}))[MD.Default=0]="Default",MD[MD.Theme=1]="Theme",MD[MD.Chart=2]="Chart",MD[MD.Base_Series=3]="Base_Series",MD[MD.Series=4]="Series",MD[MD.Mark=5]="Mark",MD[MD.User_Chart=6]="User_Chart",MD[MD.User_Series=7]="User_Series",MD[MD.User_Mark=8]="User_Mark",MD[MD.User_SeriesStyle=9]="User_SeriesStyle",MD[MD.Built_In=99]="Built_In";const TD=`${uB}_STACK_KEY`,wD=`${uB}_STACK_START`,CD=`${uB}_STACK_END`,ED=`${uB}_STACK_START_PERCENT`,PD=`${uB}_STACK_END_PERCENT`,BD=`${uB}_STACK_START_OffsetSilhouette`,RD=`${uB}_STACK_END_OffsetSilhouette`,LD=`${uB}_STACK_TOTAL`,OD=`${uB}_STACK_TOTAL_PERCENT`,ID=`${uB}_STACK_TOTAL_TOP`,DD=`${uB}_SEGMENT_START`,FD=`${uB}_SEGMENT_END`;var jD,zD;t.LayoutZIndex=void 0,(jD=t.LayoutZIndex||(t.LayoutZIndex={}))[jD.Axis_Grid=50]="Axis_Grid",jD[jD.CrossHair_Grid=100]="CrossHair_Grid",jD[jD.Region=450]="Region",jD[jD.Mark=300]="Mark",jD[jD.Node=400]="Node",jD[jD.Axis=100]="Axis",jD[jD.MarkLine=500]="MarkLine",jD[jD.MarkArea=100]="MarkArea",jD[jD.MarkPoint=500]="MarkPoint",jD[jD.DataZoom=500]="DataZoom",jD[jD.ScrollBar=500]="ScrollBar",jD[jD.Player=500]="Player",jD[jD.Legend=500]="Legend",jD[jD.CrossHair=500]="CrossHair",jD[jD.Indicator=500]="Indicator",jD[jD.Title=500]="Title",jD[jD.Label=500]="Label",jD[jD.Brush=500]="Brush",jD[jD.CustomMark=500]="CustomMark",jD[jD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(zD=t.LayoutLevel||(t.LayoutLevel={}))[zD.Indicator=10]="Indicator",zD[zD.Region=20]="Region",zD[zD.Axis=30]="Axis",zD[zD.DataZoom=40]="DataZoom",zD[zD.Player=40]="Player",zD[zD.ScrollBar=40]="ScrollBar",zD[zD.Legend=50]="Legend",zD[zD.Title=70]="Title",zD[zD.CustomMark=70]="CustomMark";const HD=["linear","radial","conical"],ND={x0:0,y0:0,x1:1,y1:1},VD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},GD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},WD={linear:ND,radial:VD,conical:GD},UD={label:{name:"label",type:"text"}},YD=`${uB}_rect_x`,KD=`${uB}_rect_x1`,XD=`${uB}_rect_y`,$D=`${uB}_rect_y1`,qD={data:!0},ZD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},JD=Object.assign(Object.assign({},UD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),QD=Object.assign(Object.assign({},UD),{bar3d:{name:"bar3d",type:"rect3d"}}),tF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},eF=Object.assign(Object.assign({},UD),tF),iF=Object.assign(Object.assign({},UD),{point:{name:"point",type:"symbol"}}),sF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),nF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign({},UD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),aF=Object.assign(Object.assign({},UD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},UD),{rose:{name:"rose",type:"arc"}}),lF=Object.assign(Object.assign({},UD),{area:{name:"area",type:"path"}}),hF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"}}),cF=Object.assign(Object.assign({},hF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),dF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),uF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),pF=Object.assign(Object.assign({},UD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),gF=Object.assign(Object.assign({},UD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),mF=Object.assign(Object.assign({},UD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},UD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),vF=Object.assign(Object.assign({},JD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),_F=Object.assign(Object.assign({},UD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),yF=Object.assign(Object.assign({},UD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),bF=Object.assign(Object.assign({},UD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),xF=Object.assign(Object.assign({},hF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SF=Object.assign(Object.assign({},UD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AF=Object.assign(Object.assign({},UD),{sunburst:{name:"sunburst",type:"arc"}}),kF=Object.assign(Object.assign({},JD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},UD),{circlePacking:{name:"circlePacking",type:"arc"}}),wF=Object.assign(Object.assign({},UD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),CF=Object.assign(Object.assign({},UD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),EF=Object.assign({},sF),PF=Object.assign(Object.assign({},UD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),BF=Object.assign(Object.assign({},UD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var RF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(RF||(RF={}));const LF={[cB.bar]:JD,[cB.bar3d]:QD,[cB.line]:eF,[cB.scatter]:iF,[cB.area]:sF,[cB.radar]:nF,[cB.pie]:rF,[cB.pie3d]:aF,[cB.rose]:oF,[cB.geo]:UD,[cB.map]:lF,[cB.circularProgress]:cF,[cB.link]:dF,[cB.dot]:uF,[cB.wordCloud]:pF,[cB.wordCloud3d]:pF,[cB.funnel]:gF,[cB.funnel3d]:mF,[cB.linearProgress]:fF,[cB.waterfall]:vF,[cB.boxPlot]:_F,[cB.treemap]:yF,[cB.sankey]:bF,[cB.gauge]:xF,[cB.gaugePointer]:SF,[cB.sunburst]:AF,[cB.rangeColumn]:kF,[cB.rangeColumn3d]:MF,[cB.circlePacking]:TF,[cB.heatmap]:wF,[cB.correlation]:CF,[cB.rangeArea]:EF,[cB.liquid]:PF,[cB.venn]:BF};function OF(t){var e,i;const{type:s}=t;return s===cB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const IF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},DF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function FF(t,e){var i;if(!t)return[];const s=WF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?VF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>NF(i)?zF(t,i,e):i)).filter(p)}))):i.map((i=>NF(i)?zF(t,i,e):i)).filter(p):[]}return[]}function jF(t,e){var i,s;return VF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function zF(t,e,i){var s;const n=WF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=DF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new _e(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ce(t,i,s),a=he(n,r,e.l),l=new _e(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const HF=(t,e,i)=>{if(e&&NF(t)){const s=zF(e,t,i);if(s)return s}return t};function NF(t){return t&&"palette"===t.type&&!!t.key}function VF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function GF(t){return y(t)?{dataScheme:t}:t}function WF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=OF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class UF extends aC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!VF(this._range))return void super.range(this._range);const t=jF(this._range,this._domain);super.range(t)}}const YF={linear:EC,band:lC,point:class extends lC{constructor(t){super(!1),this.type=Lw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:aC,threshold:OC,colorOrdinal:UF};function KF(t){const e=YF[t];return e?new e:null}function XF(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function $F(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZF(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function JF(t,e,i,s=0){var n,r;return S(t)?t:ZF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QF(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JF(t[s],e.size,i)}))})),o}function tj(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||ZF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ej(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ij=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},sj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],nj={default:{dataScheme:sj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},rj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",aj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:rj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:rj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:BB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},oj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},lj=Object.assign(Object.assign({},oj),{label:{space:0}}),hj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},cj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",dj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},uj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},pj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},gj={horizontal:Object.assign(Object.assign({},uj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj}),vertical:Object.assign(Object.assign({},uj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj})},mj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},fj={horizontal:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj}),vertical:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj})},vj={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},_j={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function bj(t,e){return t&&e.key in t?t[e.key]:e.default}function xj(t){return t&&"token"===t.type&&!!t.key}const Sj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},Aj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:nj,token:Sj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:aj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:gj,sizeLegend:fj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:oj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:lj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:_j,markArea:vj,markPoint:yj,polarMarkLine:_j,polarMarkArea:vj,polarMarkPoint:yj,geoMarkPoint:yj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:dj,crosshair:hj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},kj={name:"dark",colorScheme:{default:{dataScheme:sj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Mj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Mj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Mj(t[i],e[i])))),Tj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),Tj(t[s],e.slice(1),i))};function wj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof ya||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=wj(n,e)}return s}function Cj(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Ej(t,e,r,i):Pj(t,r,s[r])}}}}function Ej(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Bj({},t[n][e.index],i):i):t[n]=s?Bj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Bj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Bj({},t[n],i):i)}))}function Lj(t,...e){return Bj(Oj(t),...e.map(Oj))}function Oj(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=GF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(LF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Ij(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Ij(t,e,i,s){if(!LF[e])return t;const n={};return Object.values(LF[e]).forEach((({type:e,name:r})=>{n[r]=Bj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Dj=["animationThreshold","colorScheme","name","padding"];function Fj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Dj.includes(r)?n[r]=a:f(a)?NF(a)?n[r]=HF(a,e,s):xj(a)?n[r]=bj(i,a):n[r]=Fj(a,e,i,s):n[r]=a})),n}const jj={[Aj.name]:Aj},zj=Aj.name,Hj=new Map(Object.keys(jj).map((t=>[t,jj[t]]))),Nj=new Map(Object.keys(jj).map((t=>[t,Fj(jj[t])]))),Vj=new Map(Object.keys(jj).map((t=>[t,t===zj]))),Gj=(t,e)=>{if(!t)return;const i=Kj(e);Hj.set(t,i),Nj.set(t,Fj(i)),Vj.set(t,!0)},Wj=(t=zj,e=!1)=>(Vj.has(t)&&!Vj.get(t)&&Gj(t,Hj.get(t)),e?Nj.get(t):Hj.get(t)),Uj=t=>Hj.delete(t)&&Nj.delete(t)&&Vj.delete(t),Yj=t=>!!_(t)&&Hj.has(t),Kj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:zj;return Lj({},Wj(i),t)};class Xj{static registerInstance(t){Xj.instances.set(t.id,t)}static unregisterInstance(t){Xj.instances.delete(t.id)}static getInstance(t){return Xj.instances.get(t)}static instanceExist(t){return Xj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Xj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Xj.instances=new Map;class $j{static registerTheme(t,e){Gj(t,e)}static getTheme(t,e=!1){return Wj(t,e)}static removeTheme(t){return Uj(t)}static themeExist(t){return Yj(t)}static getDefaultTheme(){return $j.themes.get(zj)}static setCurrentTheme(t){$j.themeExist(t)&&($j._currentThemeName=t,Xj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return $j.getTheme($j._currentThemeName,t)}static getCurrentThemeName(){return $j._currentThemeName}}function qj(t,e){return _(t)?$j.themeExist(t)?$j.getTheme(t,e):{}:g(t)?t:{}}function Zj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Zj(t[s],e)}return i}return y(t)?t.map((t=>Zj(t,e))):t}function Jj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}$j.themes=Hj,$j._currentThemeName=zj;function Qj(t,e){for(let i=0;it.key===e))}function ez(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function iz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},oz(t,a,n[o],l,e,r))})),s?sz(n):n}function sz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):sz(t[e].nodes);return t}function nz(t,e){if("values"in t&&t.values.length){const i=eB(t.values,e),s=tB(t.values,PD);t.values.forEach((t=>{t[LD]=i,t[OD]=s,delete t[ID]}));const n=t.values.reduce(((t,e)=>e[CD]>t[CD]?e:t));n[ID]=!0}else for(const i in t.nodes)nz(t.nodes[i],e)}function rz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][CD]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[wD]=s,s+=r[CD],r[CD]=s):(r[wD]=n,n+=r[CD],r[CD]=n),r[TD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[ED]=0===h?0:Math.min(1,l[wD]/h)*r,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r}}for(const s in t.nodes)az(t.nodes[s],e,i)}function oz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[CD]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),oz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const lz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=cz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function dz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>gz(t.style(e,i,s,n)):B(t.style)||(e.style=gz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>gz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=gz(t.state[e]))})),e.state=i}return e}function uz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e,s,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}function pz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),gz(i)}function gz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class mz{static registerChart(t,e){mz._charts[t]=e}static registerSeries(t,e){mz._series[t]=e}static registerComponent(t,e,i){mz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){mz._marks[t]=e}static registerRegion(t,e){mz._regions[t]=e}static registerTransform(t,e){mz.transforms[t]=e}static registerLayout(t,e){mz._layout[t]=e}static registerAnimation(t,e){mz._animations[t]=e}static registerImplement(t,e){mz._implements[t]=e}static registerChartPlugin(t,e){mz._chartPlugin[t]=e}static registerComponentPlugin(t,e){mz._componentPlugin[t]=e}static createChart(t,e,i){if(!mz._charts[t])return null;return new(0,mz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!mz._charts[t])return null;const i=mz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!mz._regions[t])return null;return new(0,mz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!mz._regions[t])return null;return new(0,mz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!mz._series[t])return null;return new(0,mz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!mz._series[t])return null;return new(0,mz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!mz._marks[t])return null;const s=new(0,mz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(mz._components)}static getComponentInKey(t){return mz._components[t].cmp}static getLayout(){return Object.values(mz._layout)}static getLayoutInKey(t){return mz._layout[t]}static getSeries(){return Object.values(mz._series)}static getSeriesInType(t){return mz._series[t]}static getRegionInType(t){return mz._regions[t]}static getAnimationInKey(t){return mz._animations[t]}static getImplementInKey(t){return mz._implements[t]}static getSeriesMarkMap(t){return mz._series[t]?mz._series[t].mark:{}}static getChartPlugins(){return Object.values(mz._chartPlugin)}static getComponentPlugins(){return Object.values(mz._componentPlugin)}static getComponentPluginInType(t){return mz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}mz._charts={},mz._series={},mz._components={},mz._marks={},mz._regions={},mz._animations={},mz._implements={},mz._chartPlugin={},mz._componentPlugin={},mz.transforms={fields:Or,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},mz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},mz._layout={};const fz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},vz=(t,e,i,s)=>{var n;const r=Nw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:_z(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,yz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},bz=(t,e)=>{if(!t)return null;if(!lB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=yz(t,(t=>"angle"===t.getOrient()),e),r=yz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Nw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=nB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=rB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=vz(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Nw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=nB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=rB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=vz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function xz(t){return"bottom"===t||"top"===t}function Sz(t){return"left"===t||"right"===t}function Az(t){return"z"===t}function kz(t,e){return qF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Mz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Tz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?xz(t)?"linear":"band":xz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const wz=t=>t.fieldX[0],Cz=t=>t.fieldY[0],Ez=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Pz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Bz=(t,e)=>t?e?wz:Ez:e?Cz:Pz,Rz=(t,e,i)=>{var s,n;if(!t)return null;if(!lB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=yz(t,(t=>xz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=yz(t,(t=>Sz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Nw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Lz(s,i,t,Bz(e,Nw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Lz(s,i,t,Bz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Lz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Oz(t,a,s)},Oz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=vz(e,t,"cartesian",null!=i?i:xz(t.getOrient())?wz:Cz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Iz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Rz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=bz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Nw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return xz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Oz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Dz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Dz||(Dz={}));const Fz={[Dz.dimensionHover]:class extends Iz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!fz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Dz.dimensionClick]:class extends Iz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let jz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(Fz[t]){const e=new Fz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(Fz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class zz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Hz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Nz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new zz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Hz[a]&&(a=Hz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=St(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=xt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return uD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteraction(e)}}function Vz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Gz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Wz=new Map;let Uz;function Yz(){Uz||(Uz=new va,Gz(Uz,"geojson",da),Gz(Uz,"topojson",pa),Vz(Uz,"simplify",Rr))}function Kz(t,e,i={type:"geojson",centroid:!0}){Wz.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),Yz();const s=new ya(Uz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Wz.set(t,s)}function Xz(t){Wz.has(t)?Wz.delete(t):Jy(`map type of '${t}' does not exists.`)}function $z(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const qz=(t,e)=>0===t.length?[]:1===t.length?$z(t[0],null==e?void 0:e.deep):t.map((t=>$z(t,null==e?void 0:e.deep)));function Zz(t,e,i){Vz(e=e instanceof va?e:t.dataSet,"copyDataView",qz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:tH.copyDataView}),s}function Jz(t,e,i=[],s={}){var n,r,a;if(t instanceof ya)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new ya(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Qy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Qy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Jy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function Qz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var tH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(tH||(tH={}));const eH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new fO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:aH(this._option.mode),autoFit:!1,eventConfig:{gesture:nb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(O_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=O_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function lH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function hH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Bj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function cH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ii(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function dH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme")}),t}function uH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(nH||(nH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(rH||(rH={}));class pH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},pH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}pH.defaultMarkInfo={};class gH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new pH,this._markReverse=new pH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(nH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(nH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[nH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[nH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Dz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const mH={};Object.values(nH).forEach((t=>{mH[t]=!0}));const fH={[nH.STATE_HOVER]:nH.STATE_HOVER_REVERSE,[nH.STATE_SELECTED]:nH.STATE_SELECTED_REVERSE,[nH.STATE_DIMENSION_HOVER]:nH.STATE_DIMENSION_HOVER_REVERSE};function vH(t){return fH[t]}class _H{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=vH(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=vH(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=vH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=vH(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class yH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class bH extends yH{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xH extends bH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=sH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class SH extends yH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class AH extends SH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class kH extends AH{constructor(){super(...arguments),this.id=ob(),this.stateKeyToSignalName=t=>`${uB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===iH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===iH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?iH.none:iH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?iH.exit:"update"===e.diffState?iH.update:iH.appear}}}}class MH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Bj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TH extends yH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=MH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new pH,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new jz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${uB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=mz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class wH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=QF(tj(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=JF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=JF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=JF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class CH extends TH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new wH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EH extends MH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class PH extends CH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=EH,this.modelType="region",this.specKey="region",this.type=PH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new _H,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new gH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in rH)B(t.stateStyle[rH[e]])||this.interaction.registerMark(rH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function BH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function RH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function LH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function OH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),LH(c,!0,u,o),s&&RH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function IH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),LH(c,!1,u,a),s&&RH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function FH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"left"),n.length&&OH(n,e,i,!0,"left"),r.length&&IH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"top"),n.length&&DH(n,e,i,!0,"top"),r.length&&FH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"right"),n.length&&OH(n,e,i,!0,"right"),r.length&&IH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"bottom"),n.length&&DH(n,e,i,!0,"bottom"),r.length&&FH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:s,height:n}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}jH.type="base";const zH=["line","area","trail"];function HH(t){return zH.includes(t)}class NH extends AH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(HH)?s:!t.mark||HH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!mH[t])).map((t=>[t,10])),s=!t.mark||HH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(zw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class VH extends bH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class GH extends VH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${uB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class WH extends bH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=sH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new NH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new jz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new GH(t)}stateKeyToSignalName(t){return`${uB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=nH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=nH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===iH.appear&&this.runAnimationByState(iH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(iH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class UH extends WH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,te)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Bj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=KF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):HD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Hw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},WD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=_e.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)HD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class YH extends UH{constructor(){super(...arguments),this.type=YH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}YH.type="group";const KH=()=>{bM(),aM(),CR.registerGraphic(IB.group,Cu),mz.registerMark(YH.type,YH)},XH={type:"fadeIn"};function $H(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return XH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const qH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},ZH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},JH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},QH=()=>{mz.registerAnimation("scaleInOut",(()=>ZH))},tN=()=>{mz.registerAnimation("fadeInOut",(()=>JH))},eN=(t,e)=>({appear:$H(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Wc,duration:qH.update.duration,easing:qH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),iN=()=>{mz.registerAnimation("line",eN)},sN=()=>{fO.useRegisters([XI,$I,qI,ZI,JI,QI,jI,zI])},nN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Sj.fontFamily,fontSize:Sj.fontSize}))(e,i,s).measure(t)};class rN{static instance(){return rN.instance_||(rN.instance_=new rN),rN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class aN{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class oN extends aN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class lN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>mz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>mz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>mz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return mz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>mz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){mz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}static getFunction(t){return t?rN.instance().getFunction(t):null}static getFunctionList(){return rN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=mz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=mz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Wz.get(e);var e}static hideTooltip(t=[]){Xj.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=xt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=sb(p);v?Rx(th):"node"===p&&PA(th),v&&d&&(this._container=_(d)?O_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=$j.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new oH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Nz(this,this._compiler),this._event=new jz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Xj.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Bj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Zj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;lN.getFunctionList()&&lN.getFunctionList().length&&(t=Jj(t,lN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=mz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return cH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:pB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:gB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof va?t:new va,Gz(this._dataSet,"dataview",ga),Gz(this._dataSet,"array",s),Vz(this._dataSet,"stackSplit",eH),Vz(this._dataSet,"copyDataView",qz);for(const t in mz.transforms)Vz(this._dataSet,t,mz.transforms[t]);for(const t in mz.dataParser)Gz(this._dataSet,t,mz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)),null===(n=this._compiler)||void 0===n||n.releaseGrammar(!1===(null===(r=this._option)||void 0===r?void 0:r.animation)||!1===(null===(a=this._spec)||void 0===a?void 0:a.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily)),t.reCompile&&(null===(l=this._compiler)||void 0===l||l.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(h=this._compiler)||void 0===h||h.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?iH.appear:iH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Xj.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof ya?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Jz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)||(a.changeTheme=!0);const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=dH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Bj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=qj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Lj({},qj(this._currentThemeName,!0),qj(s,!0),qj(n,!0));this._currentTheme=t}else{const t=Lj({},qj(this._currentThemeName),qj(s),qj(n));this._currentTheme=Fj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return qj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield lH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ej(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ej(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rN.instance().getFunction(t)}registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}getFunctionList(){return rN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=mz.getChartPlugins();t.length>0&&(this._chartPlugin=new oN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}lN.InstanceManager=Xj,lN.ThemeManager=$j,lN.globalConfig={uniqueTooltip:!0},lN.Utils=nN,lN.vglobal=O_;mz.registerRegion("region",PH),mz.registerLayout("base",jH),KH(),fO.useRegisters([sI,nI]),fO.useRegisters([aD,oD,HI,NI,nD,rD,lD,hD,cD]),$R(),XR(),Gj(kj.name,kj),at.getInstance(rt.Error);const hN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(cB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=mz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=mz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},cN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=hN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Mj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Bj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Bj(m,f),hasChanged:!0};const i=Bj({},t,f);Tj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class dN{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const uN=t=>{mz.registerChartPlugin(t.type,t)};class pN extends dN{constructor(){super(pN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[pN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[pN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=wj(this._option.globalInstance.getSpec(),["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=wj(this._baseChartSpec,["data",pN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=cN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=wj(i,["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}pN.pluginType="chart",pN.specKey="media",pN.type="MediaQueryPlugin";const gN=/\{([^}]+)\}/,mN=/\{([^}]+)\}/g,fN=/:/;class vN extends dN{constructor(){super(vN.type),this.type="formatterPlugin",this._timeModeFormat={utc:di.getInstance().timeUTCFormat,local:di.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=yi.getInstance().format,this._numericSpecifier=yi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[vN.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),mz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=gN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(mN,((t,i)=>{if(!fN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(fi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}vN.pluginType="chart",vN.specKey="formatter",vN.type="formatterPlugin";const _N=()=>{uN(vN)};function yN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function bN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function xN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function SN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function AN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function kN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const MN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return IC(v)};class TN extends dN{constructor(){super(TN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!zw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&yN(c)&&yN(d)))return;const u=bN(t,c),p=bN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!SN(u,p))return}else if(0===y&&0===b){if(!SN(p,u))return}else if(_||A)if(_&&!A){if(!xN(u,p))return}else if(A&&!_){if(!xN(p,u))return}else{if(m===b)return;if(m>b){if(!AN(u,p))return}else if(!AN(p,u))return}else{if(0===m&&0===y){if(!kN(u,p))return}else if(0===b&&0===g&&!kN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Vz(e.getOption().dataSet,"tickAlign",MN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}TN.pluginType="component",TN.type="AxisSyncPlugin";const wN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,CN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ym||(ym=vm.CreateGraphic("richtext",{})),ym.setAttributes(a),ym.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},EN="vchart-tooltip-container",PN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function BN(t,e){return R(e,`component.${t}`)}function RN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=mz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const LN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ON(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function IN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function DN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function FN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const jN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):["linear","log","symlog"].includes(e)?BN("axisLinear",i):{})&&void 0!==s?s:{},r=xz(t)?BN("axisX",i):Sz(t)?BN("axisY",i):BN("axisZ",i);return Bj({},BN("axis",i),n,r)},zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):"linear"===e?BN("axisLinear",i):{})&&void 0!==s?s:{},r=BN("angle"===t?"axisAngle":"axisRadius",i);return Bj({},BN("axis",i),n,r)},HN=t=>"band"===t||"ordinal"===t||"point"===t;function NN(t,e){return{id:t,label:t,value:e,rawValue:t}}function VN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function GN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const WN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Nw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(zw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=ON(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Nw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(zw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=ON(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&UN(t,"top",r.label),e.visible&&UN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&UN(t,"left",a.label),e.visible&&UN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},UN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=RN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},YN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},KN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=$N(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},XN=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=$N(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},$N=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},qN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},ZN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},JN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},QN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},tV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=WN(3,e,i,s,n,r,a);return o?KN(r,o,d,h):l?XN(a,l,u,c):void 0},eV={fontFamily:Sj.fontFamily,spacing:10,wordBreak:"break-word"};function iV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},nV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=lV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rV(i,s)(t)&&rV(n,r)(t)&&(u(a)||rV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(u.id),d}return"none"}const lV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=nV(c,t);let _=nV(d,t);const y=aV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rV(c,v));if(!y&&(_=nV(d,i),!aV(_)))return;const n=e.type===cB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Nw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(rV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nV(d,o),!aV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(rV(c,n));if(!y&&(_=nV(d,r),!aV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=nV(d,i),!aV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},hV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const cV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class dV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class uV extends dV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:gV(e.title,{seriesId:this.series.id},!0),content:mV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=hV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const pV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},gV=(t,e,i)=>p(t)?d(t)?(...s)=>pV(t(...s),e,i):pV(t,e,i):void 0,mV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>pV(t,e,i))):pV(t,e,i))):void 0;return s},fV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=cV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=cV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},vV=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=_V(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&hV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},_V=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),yV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},bV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=RN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},SV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class AV{}AV.dom=`${uB}_TOOLTIP_HANDLER_DOM`,AV.canvas=`${uB}_TOOLTIP_HANDLER_CANVAS`;const kV=20,MV={key:"其他",value:"..."},TV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=di.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},wV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=SV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==xV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:TV(xV(c,t,i,v),p,g),valueStyle:xV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=kV}=t,x=t.othersLine?Object.assign(Object.assign({},MV),t.othersLine):MV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=CV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=CV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},CV=(t,e,i)=>{const s=TV(xV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=TV(xV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==xV(e.visible,t,i)&&(p(s)||p(n)),a=xV(e.isKeyAdaptive,t,i),o=xV(e.spaceRow,t,i),l=xV(e.shapeType,t,i),h=xV(e.shapeColor,t,i),c=xV(e.shapeFill,t,i),d=xV(e.shapeStroke,t,i),u=xV(e.shapeLineWidth,t,i),g=xV(e.shapeHollow,t,i),m=xV(e.keyStyle,t,i),f=xV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class EV extends dN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=SV(x.position,b,e),M=null!==(n=SV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:pB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:gB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(sb(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=wN(t,e),j=wN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(JN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(QN(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=qN(t,c),N=qN(i,c),V=qN(e,c),G=qN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=qN(t,c):Y(t),S(e)||d(e)?N=qN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(JN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(QN(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,sb(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===JN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===JN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===QN(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===QN(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(JN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(QN(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,St(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},PN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:PN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:PN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ei(d.padding),x=tj(d.padding),S=iV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=iV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=iV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:sV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Bj({},A,iV(b,void 0,{})),{width:s,height:n,text:r}=CN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Bj({},k,iV(x,void 0,{})),{width:e,height:s,text:n}=CN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Bj({},S,iV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=CN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(sb(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=wN(t,s),u=wN(l,c)}return s*=d,n*=d,sb(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(De(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Xe([c,a,o],r.x,r.y)||Xe([c,l,h],r.x,r.y)||Xe([c,a,h],r.x,r.y)||Xe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}EV.specKey="tooltip";const PV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",BV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let RV;const LV=(t=document.body)=>{if(u(RV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),RV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return RV};function OV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Bj({},e,t),s={};return s.width=PV(i),s}(C),R=IV(E),L=IV(P),{bottom:O,left:I,right:D,top:F}=tj(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:PV(T+2*M),minHeight:PV(g+2*M),paddingBottom:PV(O),paddingLeft:PV(I),paddingRight:PV(D),paddingTop:PV(F),borderColor:k,borderWidth:PV(M),borderRadius:PV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?PV(null==r?void 0:r.spaceRow):"0px"},IV(Bj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return DV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=DV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==ib?void 0:ib.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(DV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}DV.type="tooltipModel";const FV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},jV={boxSizing:"border-box"},zV={display:"inline-block",verticalAlign:"top"},HV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},GV={lineHeight:"normal",boxSizing:"border-box"};class WV extends DV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=BV(u),y=t=>new Ag({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class UV extends DV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const YV={overflowWrap:"normal",wordWrap:"normal"};class KV extends DV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Bj({},zV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Bj({},o?NV:HV,Object.assign(Object.assign(Object.assign({height:PV(l)},YV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Bj({},VV,Object.assign(Object.assign(Object.assign({height:PV(s)},YV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Bj({},GV,Object.assign(Object.assign({height:PV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class XV extends DV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new KV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Bj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+BV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+LV(this._option.getContainer())}px`,maxHeight:PV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class $V extends DV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new WV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new UV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Bj({},FV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const qV="99999999999999";class ZV extends DV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:qV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new $V(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new XV(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Bj({},jV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const JV=t=>{mz.registerComponentPlugin(t.type,t)};class QV extends EV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(QV.type),this.type=AV.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(ib&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=OV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!si(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}QV.type=AV.dom;class tG extends EV{constructor(){super(tG.type),this.type=AV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ZP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}tG.type=AV.canvas;const eG=()=>{JV(tG)},iG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},nG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=Qj([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return rG(a,n,o)},rG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=sG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},aG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t};class oG extends VH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const lG=`${uB}_HIERARCHY_DEPTH`,hG=`${uB}_HIERARCHY_ROOT`,cG=`${uB}_HIERARCHY_ROOT_INDEX`;function dG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function uG(t,e,i){t&&(i.needDefaultSeriesField&&(t[AD]=i.defaultSeriesField),t[xD]=e,t[SD]=i.getKey(t,e,i))}function pG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function gG(t,e,i,s=0,n,r){void 0===r&&(r=e),uG(t,e,i),t[lG]=s,t[hG]=n||t[i.categoryField],t[cG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>gG(e,s,i,t[lG]+1,t[hG],r)))}const mG=["appear","enter","update","exit","disappear","normal"];function fG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Bj({},o[e],a);return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function vG(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),SG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function _G(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function yG(t,e){var i,s;return null!==(i=null==t?void 0:t[xD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function bG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function xG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function SG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),SG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),SG(t[i],e)}function AG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class kG extends MH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Ij(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Bj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Bj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Bj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class MG extends TH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${uB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=AG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"invalidTravel",aG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Jz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Zz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Zz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new oG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=rG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Vz(this._dataSet,"dimensionStatistics",nG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ya(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Qj(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Vz(this._dataSet,"dimensionStatistics",nG);const s=new ya(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=Qj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Qj(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ya(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Bj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Bj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:nH.STATE_HOVER_REVERSE,highlightState:nH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:nH.STATE_SELECTED_REVERSE,state:nH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:AD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:kD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,kD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new uV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},qD),ZD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>ZD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ya||Qz(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();AG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:AD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new UF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return FF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:AD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Bj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:SD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==CD&&t!==PD&&t!==wD&&t!==ED||(t=this.getStackValueField()),null!==(e=ez(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=LF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:AD]}}function TG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();zw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function wG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}MG.mark=UD,MG.transformerConstructor=kG;class CG extends MG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);zw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${uB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(CD),this.setFieldX2(wD)):(this.setFieldY(CD),this.setFieldY2(wD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(PD),this.setFieldX2(ED)):(this.setFieldY(PD),this.setFieldY2(ED))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(RD),this.setFieldX2(BD)):(this.setFieldY(RD),this.setFieldY2(BD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(TG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const EG="monotone",PG="linear";class BG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(tF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===EG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(tF.point,{morph:bG(this._spec,tF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new ya(this._option.dataSet,{name:`${uB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[tF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Bj({},this._spec[tF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class RG extends UH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Hw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class LG extends RG{constructor(){super(...arguments),this.type=LG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===cB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}LG.type="line";const OG=()=>{mz.registerMark(LG.type,LG),bM(),cM(),CR.registerGraphic(IB.line,wg),sN()};class IG extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class DG extends IG{constructor(){super(...arguments),this.type=DG.type}}DG.type="symbol";const FG=()=>{mz.registerMark(DG.type,DG),bO()};class jG extends kG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class zG extends aN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function HG(t,e,i,s){switch(t){case r.cartesianBandAxis:return jN(kz(i,["z"]),"band",e);case r.cartesianLinearAxis:return jN(kz(i,["z"]),"linear",e);case r.cartesianLogAxis:return jN(kz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return jN(kz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return jN(kz(i),void 0,e);case r.polarBandAxis:return zN(i.orient,"band",e);case r.polarLinearAxis:return zN(i.orient,"linear",e);case r.polarAxis:return zN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>xz(t.orient)));let d;d=p(c)?Bj({},HN(c.type)?a:o,l):l;const u=n.find((t=>Sz(t.orient)));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Bj({},HN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return NG(i,BN(t,e));default:return BN(t,e)}}const NG=(t,e)=>{var i;const s=Bj({},e,e[Mz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class VG extends MH{getTheme(t,e){return HG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},tj(e)),{[s]:0}))}}class GG extends CH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new zG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=VG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof rc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}GG.transformerConstructor=VG;class WG extends UH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(IB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WG.type="component";const UG=()=>{mz.registerMark(WG.type,WG)},YG=t=>t;class KG extends GG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?zB.circleAxisGrid:zB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fG(null===(o=mz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new VH(this._option,t)]}collectData(t,e){const i=[];return aB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?zw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return aB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(aB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=dz(s=t.domainLine)).startSymbol=dz(s.startSymbol),s.endSymbol=dz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return gz(Bj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:gz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:gz(t.tick.style)),t.tick.state&&(i.tick.state=uz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:gz(t.subTick.style)),t.subTick.state&&(i.subTick.state=uz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=LN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Bj({},d,gz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:gz(h.style)}),h.state&&(i.title.state.shape=uz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:gz(o.style)}),o.state&&(i.title.state.background=uz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=uz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=gz(t.background.style)),t.background.state&&(i.panel.state=uz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return gz(Bj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:gz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:gz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=RN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Gz(this._option.dataSet,"scale",YG),Vz(this._option.dataSet,"ticks",XC);return new ya(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}KG.specKey="axes";const XG=()=>{CR.registerGraphicComponent(jB.lineAxis,((t,e)=>new Bw(t,e))),CR.registerGraphicComponent(jB.circleAxis,(t=>new Iw(t))),CR.registerComponent(DB.axis,NO),CR.registerGraphicComponent(zB.lineAxisGrid,((t,e)=>new QC(t,e))),CR.registerGraphicComponent(zB.circleAxisGrid,((t,e)=>new eE(t,e))),CR.registerComponent(DB.grid,WO),UG(),mz.registerAnimation("axis",(()=>({appear:{custom:Fw},update:{custom:Dw},exit:{custom:Xc}})))},$G=[TN];class qG extends KG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{const e=this.getOrient();xz(e)?t.setXAxisHelper(this.axisHelper()):Sz(e)?t.setYAxisHelper(this.axisHelper()):Az(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Bj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Bj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=xz(this.getOrient()),n=t=>{var e;return(s?!xz(t.getOrient()):xz(t.getOrient()))&&zw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=kz(i,["z"]),Az(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!DN(e))return null;const{axisType:t,componentName:s}=Tz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Sz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!DN(t))return;const{axisType:s,componentName:n}=Tz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];xz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):Az(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load($G.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){xz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!xz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!Az(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Sz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=xz(this.getOrient())?t.fieldX:Az(this.getOrient())?t.fieldZ:t.fieldY,zw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(xz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=xz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return aB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:xz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Az(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();aB(this._regions,(e=>{xz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Sz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Az(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=xz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=xz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Bj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return NN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=IN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=ZG?10:n>=JG?5:n>=QG?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}eW.type=r.cartesianLinearAxis,eW.specKey="axes",U(eW,tW);const iW=()=>{XG(),mz.registerComponent(eW.type,eW)};class sW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=NN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class nW extends qG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Qw(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{XG(),mz.registerComponent(nW.type,nW)};class aW extends eW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{xz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Bj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=di.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}aW.type=r.cartesianTimeAxis,aW.specKey="axes";class oW extends eW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new RC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}oW.type=r.cartesianLogAxis,oW.specKey="axes",U(oW,tW);class lW extends eW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}lW.type=r.cartesianSymlogAxis,lW.specKey="axes",U(lW,tW);class hW extends CG{constructor(){super(...arguments),this.type=cB.line,this.transformerConstructor=jG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),vG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=cB.line,hW.mark=eF,hW.transformerConstructor=jG,U(hW,BG);class cW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{Qz(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ya)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Qj(e,[{key:t,operations:zw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&Qj(e,[{key:i.field,operations:zw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?KF("colorOrdinal"):KF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=zw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=zw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;zw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=zw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=iz(t,!0);for(const e in a)for(const i in a[e].nodes)az(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)rz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&nz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pW extends yH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pB,height:gB},this._viewRect={width:pB,height:gB},this._viewBox={x1:0,y1:0,x2:pB,y2:gB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=tj(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new jz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new uW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=mz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=mz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof UH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof UH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&Qz(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cH(this._spec,this._option,{width:pB,height:gB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=FF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){dH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=FF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{dH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,dH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):dH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];dH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=QF(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(nH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(nH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(nH.STATE_SELECTED)}clearHovered(){this.clearState(nH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Dz.dimensionHover||s===Dz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Nw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const gW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class mW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);Tj(t,r,l.spec),Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=mz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class fW extends mW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Bj(i,uH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class vW extends fW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class _W extends pW{constructor(){super(...arguments),this.transformerConstructor=vW,this.type="line",this.seriesType=cB.line,this._canStack=!0}}_W.type="line",_W.seriesType=cB.line,_W.transformerConstructor=vW;class yW extends RG{constructor(){super(...arguments),this.type=yW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}yW.type="area";const bW=()=>{mz.registerMark(yW.type,yW),bM(),tM(),CR.registerGraphic(IB.area,$g),sN()};class xW extends uV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const SW=()=>{mz.registerAnimation("area",eN),iN(),QH()};class AW extends jG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Bj({},m.style,g.style),l.state=Bj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class kW extends CG{constructor(){super(...arguments),this.type=cB.area,this.transformerConstructor=AW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(kW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===EG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XF(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XF(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),vG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),vG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new xW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}kW.type=cB.area,kW.mark=sF,kW.transformerConstructor=AW,U(kW,BG);class MW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class TW extends pW{constructor(){super(...arguments),this.transformerConstructor=MW,this.type="area",this.seriesType=cB.area,this._canStack=!0}}TW.type="area",TW.seriesType=cB.area,TW.transformerConstructor=MW;function wW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const CW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wW(t,e)}),EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wW(t,e)}),PW={type:"fadeIn"},BW={type:"growCenterIn"};function RW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return PW;case"scaleIn":return BW;default:return CW(t)}}class LW extends UH{constructor(){super(...arguments),this.type=LW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}LW.type="rect";const OW=()=>{mz.registerMark(LW.type,LW),_O(),fO.useRegisters([WI,UI,YI,KI,VI,GI])};function IW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[YD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):XF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):XF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):XF(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},jW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:bG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(jW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Vz(this._option.dataSet,"addVChartProperty",iG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Vz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ya(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new oG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=$D,s=XD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=KD,s=YD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=iz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)IW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=XF(this[n](t),o),d=XF(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[wD],n=t[CD],r=t[ED],h=t[PD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[wD]:i,[CD]:s}),a?{[ED]:o,[PD]:l}:void 0);t.push(Pg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>XF(this._dataToPosY(t),a),y1:t=>XF(this._dataToPosY1(t),a)}:{y:t=>XF(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>XF(this._dataToPosX(t),r),x1:t=>XF(this._dataToPosX1(t),r)}:{x:t=>XF(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=wG(this);this._barMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),vG(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=ij(this._spec.barWidth,a)),l&&(c=Math.max(c,ij(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ij(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ij(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=zw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}jW.type=cB.bar,jW.mark=JD,jW.transformerConstructor=FW;const zW=()=>{rI(),OW(),mz.registerAnimation("bar",((t,e)=>({appear:RW(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t)}))),rW(),iW(),mz.registerSeries(jW.type,jW)};class HW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),hH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class NW extends pW{constructor(){super(...arguments),this.transformerConstructor=HW,this.type="bar",this.seriesType=cB.bar,this._canStack=!0}}NW.type="bar",NW.seriesType=cB.bar,NW.transformerConstructor=HW;class VW extends UH{constructor(){super(...arguments),this.type=VW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}VW.type="rect3d";class GW extends jW{constructor(){super(...arguments),this.type=cB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}GW.type=cB.bar3d,GW.mark=QD;class WW extends HW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class UW extends NW{constructor(){super(...arguments),this.transformerConstructor=WW,this.type="bar3d",this.seriesType=cB.bar3d}}UW.type="bar3d",UW.seriesType=cB.bar3d,UW.transformerConstructor=WW;const YW=[10,20],KW=Lw.Linear,XW="circle",$W=Lw.Ordinal,qW=["circle","square","triangle","diamond","star"],ZW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class JW extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QW extends CG{constructor(){super(...arguments),this.type=cB.scatter,this.transformerConstructor=JW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${uB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${uB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KW,defaultRange:YW},"size")}getShapeAttribute(t,e){return u(e)?XW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:$W,defaultRange:qW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(QW.mark.point,{morph:bG(this._spec,QW.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=wG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),vG("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:XW},nH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},nH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QW.type=cB.scatter,QW.mark=iF,QW.transformerConstructor=JW;const tU=()=>{FG(),mz.registerAnimation("scatter",((t,e)=>Object.assign({appear:ZW(0,e)},ZH))),rW(),iW(),mz.registerSeries(QW.type,QW)};class eU extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class iU extends pW{constructor(){super(...arguments),this.transformerConstructor=eU,this.type="scatter",this.seriesType=cB.scatter,this._canStack=!0}}iU.type="scatter",iU.seriesType=cB.scatter,iU.transformerConstructor=eU;Ln();const sU={},nU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rU(t,e){t&&_(t)||ub("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(sU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ln().projection(s),s.copy=s.copy||function(){const t=i();return nU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),sU[i]||null}const aU={albers:Jn,albersusa:function(){var t,e,i,s,n,r,a=Jn(),o=Zn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Zn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(aU).forEach((t=>{rU(t,aU[t])}));const oU="Feature",lU="FeatureCollection";function hU(t){const e=Y(t);return 1===e.length?e[0]:{type:lU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===lU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===oU?t:{type:oU,geometry:t}))}(e))),[])}}const cU=nU.concat(["pointRadius","fit","extent","size"]);function dU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{cU.includes(s)&&(i=i.concat(mR(t[s],e)))})),i):i}let uU=class extends QR{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(mR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(mR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(mR(this.spec.size,this.view)),this.spec.size=t,this.attach(mR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(mR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(mR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(mR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(mR(t,this.view)),this.commit(),this}configure(t){return this.detach(dU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(dU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=rU((t||"mercator").toLowerCase());return e||ub("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),nU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,vR(this.spec[t],e,rU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(vR(this.spec.pointRadius,e,rU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=hU(vR(this.spec.fit,e,rU));this.spec.extent?this.projection.fitExtent(vR(this.spec.extent,e,rU),t):this.spec.size&&this.projection.fitSize(vR(this.spec.size,e,rU),t)}return this.projection}output(){return this.projection}};const pU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class gU extends MG{constructor(){super(...arguments),this.type=cB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${uB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mU=`${uB}_MAP_LOOK_UP_KEY`,fU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[xD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mU]=e.nameMap[n]:t[mU]=n})),t.features);class vU extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class _U extends UH{constructor(){super(...arguments),this.type=_U.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}_U.type="path";const yU=()=>{mz.registerMark(_U.type,_U),vO()};class bU{constructor(t){this.projection=rU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class xU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class SU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function AU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:xU}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:SU}:null}const kU={debounce:xt,throttle:St};class MU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),AU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,kU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:De({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,kU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){AU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;De({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||AU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=kU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=kU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function TU(t,e){return`${uB}_${e}_${t}`}class wU extends GG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:TU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Bj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new bU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===cB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),aB(this._regions,(t=>{var e;if(t.type===cB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new oe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===cB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}wU.type=r.geoCoordinate,U(wU,MU);const CU=()=>{mz.registerComponent(wU.type,wU)};class EU extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class PU extends gU{constructor(){super(...arguments),this.type=cB.map,this.transformerConstructor=EU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Wz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Vz(this._dataSet,"copyDataView",qz),Vz(this._dataSet,"map",fU),Vz(this._dataSet,"lookup",pU);const i=Wz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ya(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:tH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new oG(this._option,s)}initMark(){this._pathMark=this._createMark(PU.mark.area,{morph:bG(this._spec,PU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:AD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(fG(null===(t=mz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),vG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[xD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[xD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new oe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new oe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return xD}getActiveMarks(){return[this._pathMark]}}PU.type=cB.map,PU.mark=lF,PU.transformerConstructor=EU;const BU=()=>{CR.registerGrammar("projection",uU,"projections"),CU(),yU(),mz.registerSeries(PU.type,PU),mz.registerImplement("registerMap",Kz),mz.registerImplement("unregisterMap",Xz),tN()},RU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[ID]=!0:delete t[ID]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=LU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Kt(_,e)):(t[c]=+y,y=Kt(y,e)),t[d]=Kt(t[c],e),f=Kt(f,e),b=Xt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=LU(a,t,n,r,h,l,i,e),r.push(n)})),r};function LU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Kt(i.positive,e)):(t[h]=+i.negative,i.negative=Kt(i.negative,e)),t[c]=Kt(t[h],e),i.end=Kt(i.end,e)}i.isTotal=e,(u(p)||p===fD)&&(t[fD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Kt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Kt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},DU={type:"fadeIn"},FU={type:"growCenterIn"};function jU(t,e){switch(e){case"fadeIn":return DU;case"scaleIn":return FU;default:return CW(t,!1)}}class zU extends UH{constructor(){super(...arguments),this.type=zU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}zU.type="rule";const HU=()=>{mz.registerMark(zU.type,zU),yO()},NU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ya(e instanceof va?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Vz(e,"dimensionTree",NU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WU extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UU={rect:qU,symbol:XU,arc:JU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=XU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:QU,line:tY,area:tY,rect3d:qU,arc3d:JU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=RN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function KU(t){return d(t)?e=>t(e.data):t}function XU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=KU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:$U(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function $U(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function qU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=KU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:ZU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function ZU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function JU(t){var e;const{labelSpec:i}=t,s=null!==(e=KU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function QU(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=YU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),yp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function tY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class eY extends jW{constructor(){super(...arguments),this.type=cB.waterfall,this.transformerConstructor=WU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=fD)}getSeriesKeys(){return this._seriesField===fD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Vz(this._dataSet,"waterfallFillTotal",IU),Vz(this._dataSet,"waterfall",RU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Zz(this.getViewData(),this._dataSet,{name:`${uB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new oG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:wD,endAs:CD,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=wG(this);this._barMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),vG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(eY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return QU(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?XF(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):XF(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}eY.type=cB.waterfall,eY.mark=vF,eY.transformerConstructor=WU;const iY=()=>{HU(),OW(),mz.registerAnimation("waterfall",((t,e)=>({appear:jU(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t,!1)}))),tN(),rW(),iW(),mz.registerSeries(eY.type,eY)},sY=`${uB}_BOX_PLOT_OUTLIER_VALUE`;var nY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nY||(nY={}));const rY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class aY extends uV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return this.series.getOutliersField();if(t===nY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nY.MIN:return this.series.getMinField();case nY.MAX:return this.series.getMaxField();case nY.MEDIAN:return this.series.getMedianField();case nY.Q1:return this.series.getQ1Field();case nY.Q3:return this.series.getQ3Field();case nY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return e[sY];if(t===nY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nY.MIN:return e[this.series.getMinField()];case nY.MAX:return e[this.series.getMaxField()];case nY.MEDIAN:return e[this.series.getMedianField()];case nY.Q1:return e[this.series.getQ1Field()];case nY.Q3:return e[this.series.getQ3Field()];case nY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(nY.OUTLIER),value:this.getContentValue(nY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(nY.MAX),value:this.getContentValue(nY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q3),value:this.getContentValue(nY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MEDIAN),value:this.getContentValue(nY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q1),value:this.getContentValue(nY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MIN),value:this.getContentValue(nY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.SERIES_FIELD),value:this.getContentValue(nY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class oY extends UH{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}oY.type="boxPlot";const lY=()=>{mz.registerMark(oY.type,oY),CR.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(TO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ab(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ab(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),CR.registerAnimationType("boxplotScaleIn",wO),CR.registerAnimationType("boxplotScaleOut",CO),SO(),_O(),yO(),CR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(PO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),CR.registerAnimationType("barBoxplotScaleIn",BO),CR.registerAnimationType("barBoxplotScaleOut",RO),SO(),_O(),yO()};class hY extends CG{constructor(){super(...arguments),this.type=cB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(hY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(hY.mark.outlier,{progressive:t,key:xD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,nH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},nH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>XF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},nH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>XF(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>XF(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,nH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"foldOutlierData",rY),Vz(this._dataSet,"addVChartProperty",iG);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${uB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._outlierDataView=new oG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=wG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=mz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(vG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(fG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(fG(null===(a=mz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}hY.type=cB.boxPlot,hY.mark=_F;class cY extends UH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}cY.type="text";const dY=()=>{mz.registerMark(cY.type,cY),xO(),bM(),_M(),CR.registerGraphic(IB.richtext,Gg)};function uY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class pY extends uV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const gY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),mY={type:"fadeIn"},fY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vY(t,e){return"fadeIn"===e?mY:gY(t)}class _Y extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class yY extends jW{constructor(){super(...arguments),this.type=cB.rangeColumn,this._barMarkType="rect",this._barName=cB.bar,this.transformerConstructor=_Y}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yY.mark.bar,{morph:bG(this._spec,yY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(yY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(yY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});uY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});uY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=wG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),vG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(fG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}yY.type=cB.rangeColumn,yY.mark=kF,yY.transformerConstructor=_Y;const bY=()=>{OW(),dY(),mz.registerAnimation("rangeColumn",((t,e)=>({appear:vY(t,e),enter:gY(t),exit:fY(t),disappear:fY(t)}))),tN(),rW(),iW(),mz.registerSeries(yY.type,yY)};class xY extends yY{constructor(){super(...arguments),this.type=cB.rangeColumn3d,this._barMarkType="rect3d",this._barName=cB.bar3d}}xY.type=cB.rangeColumn3d,xY.mark=MF;class SY extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class AY extends kW{constructor(){super(...arguments),this.type=cB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(AY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new SY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}AY.type=cB.rangeArea,AY.mark=EF;class kY extends MG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=RB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};zw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};zw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&TG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const MY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:s,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=re(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[s]))),y=r-n;let b=n,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[xB],s=m?i/m:0;let n=s*y;n{g(e,n+i*t,t)}))}else{const t=x/S;b=n,i.forEach((e=>{const i=e[c]===a?a:e[xB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function TY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const wY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:TY(t,!0,iH.appear)}),CY={type:"fadeIn"},EY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:TY(t,!0,iH.enter)}),PY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:TY(t,!0,iH.exit)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:TY(t,!0,iH.exit)});function RY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CY;case"growRadius":return wY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return wY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class LY extends UH{constructor(t,e){super(t,e),this.type=OY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>se({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[TB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class OY extends LY{constructor(){super(...arguments),this.type=OY.type}}OY.type="arc";const IY=()=>{bM(),Jk(),CR.registerGraphic(IB.arc,Jg),fO.useRegisters([iD,sD,tD,eD]),mz.registerMark(OY.type,OY)};class DY extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Bj({},this._theme,i,t);const n=(t,e)=>Bj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}class FY extends kY{constructor(){super(...arguments),this.transformerConstructor=DY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=EB,this._endAngle=PB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[TB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return se(this.computeCenter(t),(i+s)/2,e)}}getCenter(){var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?te(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?te(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?te(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Vz(this._dataSet,"pie",MY),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?te(this._spec.minAngle):0,asStartAngle:AB,asEndAngle:kB,asRatio:SB,asMiddleAngle:TB,asRadian:CB,asQuadrant:wB,asK:MB}},!1);const e=new ya(this._dataSet,{name:`${uB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new oG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},FY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:bG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:SD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return hB(AB)(t)}endAngleScale(t){return hB(kB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$F(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$F(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:hB(_B).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:n,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===n&&t.centerX===s&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[TB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return se(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===iH.appear)return this._startAngle;if(i===iH.disappear)return this._endAngle;const n=[iH.disappear,iH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[xD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[TB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[TB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[TB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[TB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}FY.transformerConstructor=DY,FY.mark=rF;class jY extends FY{constructor(){super(...arguments),this.type=cB.pie}}jY.type=cB.pie;const zY=()=>{IY(),mz.registerAnimation("pie",((t,e)=>({appear:RY(t,e),enter:EY(t),exit:PY(t),disappear:BY(t)}))),mz.registerSeries(jY.type,jY)};class HY extends LY{constructor(){super(...arguments),this.type=HY.type,this._support3d=!0}}HY.type="arc3d";class NY extends DY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class VY extends FY{constructor(){super(...arguments),this.type=cB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=NY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[TB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}VY.type=cB.pie3d,VY.mark=aF,VY.transformerConstructor=NY;const GY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},WY={type:"fadeIn"},UY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),YY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),KY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function XY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return WY;case"growAngle":return GY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return GY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class $Y extends kY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(CD),this.setInnerRadiusField(wD)}setValueFieldToPercent(){this.setRadiusField(PD),this.setInnerRadiusField(ED)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class qY extends kG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const ZY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:BB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:RB,layoutRadius:e.layoutRadius}};class JY extends KG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!FN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=ZY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s;const n=[];return e.forEach(((e,r)=>{if(!FN(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=ZY(e,t);e.center=c,e.startAngle=l,e.endAngle=h,e.outerRadius=d,e.type=a,e.layoutRadius=u;const p={spec:e,specPath:[this.specKey,r],specInfoPath:["component",this.specKey,r],type:o};i.push(p),"radius"===e.orient?n.push(p):s=r})),n.forEach((t=>{t.angleAxisIndex=s})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=EB,this._endAngle=PB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:ON(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){aB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return zw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this.computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return se(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,n=this.getLabelItems(s),r=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),a=Object.assign(Object.assign({},r),{title:{text:this._spec.title.text||this._dataFieldText},items:n,orient:"angle"});this._spec.grid.visible&&(a.grid=Object.assign({type:"line",smoothLink:!0,items:n[0]},r)),this._update(a)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=qt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAngleAxis())||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(p(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutRadius(){const t=this.getRefLayoutRect();if(S(this._spec.layoutRadius))return this._spec.layoutRadius;if(d(this._spec.layoutRadius))return this._spec.layoutRadius(t,this.getCenter());const{width:e,height:i}=t;return"auto"===this._spec.layoutRadius&&e>0&&i>0?ae(t,this.getCenter(),this._startAngle,this._endAngle):Math.min(e/2,i/2)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this.computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this.computeLayoutRadius()*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=RB,e=0;const i=this.getChart().getSpec();return aB(this.getRegions(),(s=>{const n=s;if(r=n.type,[cB.rose,cB.radar,cB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Bj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Bj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}JY.type=r.polarAxis,JY.specKey="axes";class QY extends JY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}QY.type=r.polarLinearAxis,QY.specKey="axes",U(QY,tW);const tK=()=>{XG(),mz.registerComponent(QY.type,QY)};class eK extends JY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}eK.type=r.polarBandAxis,eK.specKey="axes",U(eK,sW);const iK=()=>{XG(),mz.registerComponent(eK.type,eK)};class sK extends $Y{constructor(){super(...arguments),this.type=cB.rose,this.transformerConstructor=qY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(sK.mark.rose,{morph:bG(this._spec,sK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XF(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),vG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}sK.type=cB.rose,sK.mark=oF,sK.transformerConstructor=qY;const nK=()=>{mz.registerSeries(sK.type,sK),IY(),mz.registerAnimation("rose",((t,e)=>({appear:XY(t,e),enter:UY(t),exit:YY(t),disappear:KY(t)}))),iK(),tK()};class rK extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,JP(this._fromAngle,this._toAngle)&&JP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class aK extends Wc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=re(s.angle),a=re(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=re(o.angle),c=re(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new $t(m,f,v,_);return y.defined=e.defined,y}}const oK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function lK(t,e,i){return"fadeIn"===e?oK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function hK(t,e,i){return"fadeIn"===e?oK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const cK=(t,e)=>({custom:Yc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class dK extends $Y{constructor(){super(...arguments),this.type=cB.radar,this.transformerConstructor=jG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(dK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?te(this._spec.startAngle):EB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),vG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=mz.getAnimationInKey(e);t.setAnimationConfig(fG(null==i?void 0:i(n,r),vG(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}dK.type=cB.radar,dK.mark=nF,dK.transformerConstructor=jG,U(dK,BG);const uK=()=>{mz.registerSeries(dK.type,dK),aI(),bW(),OG(),FG(),mz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:lK(t,e,"in"),enter:lK(t,e,"in"),exit:lK(t,e,"out"),disappear:"clipIn"===e?void 0:lK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:aK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:hK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:hK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:rK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarGroup",((t,e)=>({appear:cK(t,"in"),disappear:cK(t,"out")}))),Jk(),iK(),tK()};class pK extends uV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>di.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const gK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},mK={fill:"#bbb",fillOpacity:.2};class fK extends CG{constructor(){super(...arguments),this.type=cB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Vz(this._option.dataSet,"objFlat",gK),Vz(this._option.dataSet,"copyDataView",qz),Gz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:tH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Bj(mK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(fK.mark.group),this._containerMark=this._createMark(fK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(fK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(fK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(fK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(fK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(fK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(fK.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new UF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:AD}}initTooltip(){this._tooltipHelper=new pK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}fK.type=cB.dot,fK.mark=uF;class vK extends uV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>di.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const _K=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class yK extends CG{constructor(){super(...arguments),this.type=cB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Vz(this._option.dataSet,"linkDotInfo",_K),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:tH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(yK.mark.group),this._containerMark=this._createMark(yK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(yK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(yK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new vK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}yK.type=cB.link,yK.mark=dF;class bK extends kY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?wD:DD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?te(n):EB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):PB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[wD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(bK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+te(s),n=te(i)/2;return Jg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Pg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const AK=()=>{mz.registerAnimation("circularProgress",((t,e)=>({appear:SK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class kK extends kG{constructor(){super(...arguments),this._supportStack=!0}}class MK extends bK{constructor(){super(...arguments),this.type=cB.circularProgress,this.transformerConstructor=kK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(MK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(MK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?wD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}MK.type=cB.circularProgress,MK.mark=cF,MK.transformerConstructor=kK;function TK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const wK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TK(t)}),CK={type:"fadeIn"};function EK(t,e){return!1===e?{}:"fadeIn"===e?CK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TK(t)}))(t)}class PK extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class BK extends CG{constructor(){super(...arguments),this.type=cB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(BK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return XF(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(BK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(BK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=XF(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Pg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=XF(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Pg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new PK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}BK.type=cB.linearProgress,BK.mark=fF;const RK=()=>{OW(),mz.registerAnimation("linearProgress",((t,e)=>({appear:EK(t,e),enter:{type:"grow"},disappear:wK(t)}))),tN(),mz.registerSeries(BK.type,BK)},LK=[0],OK=[20,40],IK=[200,500],DK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},FK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],jK=`${uB}_WORD_CLOUD_WEIGHT`,zK=`${uB}_WORD_CLOUD_TEXT`;class HK extends MG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=OK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:IK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:LK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?zK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:DK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:LK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!FK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(HK.mark.word,{key:SD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(fG(mz.getAnimationInKey("wordCloud")(n,s),vG("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new UF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new EC,o=this._fontWeightRange;if(r){const[e,i]=vb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:jK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:zK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:sb(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:SD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:SD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}HK.mark=pF;function NK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||qH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function GK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function WK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const UK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function YK(t){return d(t)?t:function(){return t}}class KK{constructor(t){var e,i,s;switch(this.options=z({},KK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,VK[s]?VK[s]():VK.circle()),this.getText=null!==(e=YK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=YK(this.options.fontWeight),this.getTextFontSize=YK(this.options.fontSize),this.getTextFontStyle=YK(this.options.fontStyle),this.getTextFontFamily=YK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>UK(10,50);break;case"random-light":this.getTextColor=()=>UK(50,90);break;default:this.getTextColor=YK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return te(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return te(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class $K extends KK{constructor(t){var e;super(z({},$K.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=$K.defaultOptions.minFontSize&&(this.options.minFontSize=$K.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=XK[this.options.spiral])&&void 0!==e?e:XK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=YK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=WK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(O_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(JK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}QK(p,this._size)&&(p=tX(p,this._size))}else if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||ZK(p,i))&&(!i||!qK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function qK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function ZK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,QK=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function tX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=WK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}iX.defaultOptions={enlarge:!1};const nX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},rX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?aX(t.fontFamily):"sans-serif",d=t.fontStyle?aX(t.fontStyle):"normal",u=t.fontWeight?aX(t.fontWeight):"normal",p=t.rotate?aX(t.rotate):0,g=aX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?aX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||nX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?aX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=lX(hX(t,l),C);w=i=>e(t(i))}let E=$K;"fast"===t.layoutType?E=iX:"grid"===t.layoutType&&(E=eX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},aX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],oX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),lX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=oX(t[0]),s=oX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(oX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},hX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function cX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{CR.registerTransform("wordcloud",{transform:rX,markPhase:"beforeJoin"},!0),dY(),mz.registerAnimation("wordCloud",((t,e)=>({appear:NK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),mz.registerSeries(dX.type,dX)};(class extends HK{constructor(){super(...arguments),this.type=cB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(HK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),vG("word",this._spec,this._markAttributeContext)))}}).type=cB.wordCloud3d;const pX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},gX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},mX=`${uB}_FUNNEL_TRANSFORM_RATIO`,fX=`${uB}_FUNNEL_REACH_RATIO`,vX=`${uB}_FUNNEL_HEIGHT_RATIO`,_X=`${uB}_FUNNEL_VALUE_RATIO`,yX=`${uB}_FUNNEL_LAST_VALUE_RATIO`,bX=`${uB}_FUNNEL_NEXT_VALUE_RATIO`,xX=`${uB}_FUNNEL_LAST_VALUE`,SX=`${uB}_FUNNEL_CURRENT_VALUE`,AX=`${uB}_FUNNEL_NEXT_VALUE`,kX=`${uB}_FUNNEL_TRANSFORM_LEVEL`,MX=20;class TX extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[fX])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class wX extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class CX extends wX{constructor(){super(...arguments),this.type=CX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}CX.type="polygon";const EX=()=>{mz.registerMark(CX.type,CX),bM(),gM(),CR.registerGraphic(IB.polygon,em),fO.useRegisters([XI,$I])};class PX extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class BX extends MG{constructor(){super(...arguments),this.type=cB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=PX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"funnel",pX),Vz(this._dataSet,"funnelTransform",gX);const t=new ya(this._dataSet,{name:`${uB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new oG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:SX,asTransformRatio:mX,asReachRatio:fX,asHeightRatio:vX,asValueRatio:_X,asNextValueRatio:bX,asLastValueRatio:yX,asLastValue:xX,asNextValue:AX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:kX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},BX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:bG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},BX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(BX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(BX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new TX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*hB(fX).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),vG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(fG(mz.getAnimationInKey("fadeInOut")(),vG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(fG(mz.getAnimationInKey("funnel")({},o),vG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(fG(null===(a=mz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),vG("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[yX])/2:this._getSecondaryAxisLength(t[_X])/2,n=this._getSecondaryAxisLength(t[_X])/2):(s=this._getSecondaryAxisLength(t[_X])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[bX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[kX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[SD]===t[SD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?MX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{EX(),dY(),HU(),mz.registerSeries(BX.type,BX),mz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},JH))),mz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Kc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Kc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),tN()};class LX extends wX{constructor(){super(...arguments),this.type=LX.type}}LX.type="pyramid3d";class OX extends PX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class IX extends BX{constructor(){super(...arguments),this.type=cB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=OX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},IX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},IX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(IX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(IX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}IX.type=cB.funnel3d,IX.mark=mF,IX.transformerConstructor=OX;const DX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},FX=t=>{const e=t.mark.elements.filter((t=>t.diffState===OB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},jX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},zX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=jX(r,s,n);return DX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=jX(r,s,n);return DX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),HX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},NX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=HX(r);return DX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FX(i),a=HX(r);return DX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),VX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},GX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):GX(t.children,e,i)))})),e};function WX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=KX(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,wt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},XX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=XX(t.children,e,t,n))})),s},$X=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=$X(t.children,e,t,n)),n=e(t,s,i,n)})),n},qX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:WX,slice:UX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?UX:WX)(t,e,i,s,n)}};class ZX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},ZX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?gb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?YX(this.options.aspectRatio):null!==(e=qX[this.options.splitType])&&void 0!==e?e:qX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=KX(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}ZX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const JX=(t,e)=>{const i=new ZX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return GX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},QX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class t${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];WX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QX);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},t$.defaultOpionts,t):Object.assign({},t$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+yb(this.options.center[0],t.width),s=t.y0+yb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>yb(t,n))):yb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>yb(t,n))):yb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=yb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=KX(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=se({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}t$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const e$=4294967296;function i$(t,e){let i,s;if(r$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function r$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function h$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function c$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function d$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function u$(t){return{_:t,next:null,prev:null}}function p$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];h$(n,s,r);let a,o,l,h,c,d,u,p=u$(s),g=u$(n),m=u$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=KX(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%e$)/e$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:v$.defaultOpionts.nodeSort;XX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)XX([o],g$(h)),$X([o],m$(this._getPadding,.5,a)),XX([o],f$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);XX([o],g$(v$.defaultOpionts.setRadius)),$X([o],m$(fb,1,a)),c&&$X([o],m$(this._getPadding,o.radius/t,a)),XX([o],f$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}v$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const _$=(t,e={})=>{if(!t)return[];const i=[];return GX(t,i,e),i},y$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new t$(i).layout(t,{width:s,height:n})};class b$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var x$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(x$||(x$={}));const S$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===x$.DrillDown){return Y(lz(t,n,s,"children"))}if(i.type===x$.DrillUp){const e=hz(t,n,s,"children");if(e)return Y(e)}return t};class A${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Vz(t,"drillFilter",S$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:x$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:x$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:x$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:x$.DrillUp},model:this}),r}}class k$ extends kY{constructor(){super(...arguments),this.type=cB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"sunburstLayout",y$),Vz(this._dataSet,"flatten",_$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(k$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new b$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}k$.type=cB.sunburst,k$.mark=AF,U(k$,A$);const M$=()=>{mz.registerSeries(k$.type,k$),IY(),dY(),tN(),mz.registerAnimation("sunburst",((t,e)=>({appear:VX(0,e),enter:zX(t),exit:NX(t),disappear:NX(t)})))},T$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new v$(i).layout(t,{width:s,height:n})};class w$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const C$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class E$ extends CG{constructor(){super(...arguments),this.type=cB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"circlePackingLayout",T$),Vz(this._dataSet,"flatten",_$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(E$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(E$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},nH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new w$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}E$.type=cB.circlePacking,E$.mark=TF,U(E$,A$);const P$=()=>{mz.registerSeries(E$.type,E$),IY(),dY(),QH(),mz.registerAnimation("circlePacking",((t,e)=>({appear:C$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},B$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=B$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R$(t){return t.depth}function L$(t,e){return e-1-t.endDepth}const O$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),I$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},D$={left:R$,right:L$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R$,end:L$},F$=yt(0,1);class j${constructor(t){this._ascendingSourceBreadth=(t,e)=>O$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>O$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},j$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):D$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};kb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),kb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];B$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[I$(s[t.source]),I$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*F$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(O$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(O$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new j$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},H$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&H$(t,e.children,i)}))},N$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},V$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new j$(e),r=[];return r.push(n.layout(s,i)),r},G$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},W$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class U$ extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const Y$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),K$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:Y$(t),X$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class $$ extends UH{constructor(){super(...arguments),this.type=$$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}$$.type="linkPath";const q$=()=>{CR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(IO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),CR.registerAnimationType("linkPathGrowIn",DO),CR.registerAnimationType("linkPathGrowOut",FO),CR.registerAnimationType("linkPathUpdate",jO),SO(),vO(),mz.registerMark($$.type,$$)};class Z$ extends CG{constructor(){super(...arguments),this.type=cB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Jt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(nH.STATE_SANKEY_EMPHASIS),e.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS)):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(nH.STATE_SANKEY_EMPHASIS),s.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Vz(this._dataSet,"sankeyLayout",V$),Vz(this._dataSet,"sankeyFormat",N$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:tH.sankeyLayout});const{dataSet:a}=this._option;Vz(a,"sankeyNodes",G$),Vz(a,"flatten",_$);const o=new ya(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._nodesSeriesData=new oG(this._option,o),Vz(a,"sankeyLinks",W$);const l=new ya(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._linksSeriesData=new oG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Z$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(Z$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(Z$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},nH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),vG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),vG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(fG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([nH.STATE_SANKEY_EMPHASIS_REVERSE,nH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new U$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new UF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return H$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}Z$.type=cB.sankey,Z$.mark=bF;const J$=()=>{CR.registerTransform("sankey",{transform:z$,markPhase:"beforeJoin"},!0),OW(),q$(),dY(),mz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:K$(t,e)},JH))),mz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:X$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),tN(),mz.registerSeries(Z$.type,Z$)},Q$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=_$(n);return i=nG([{latestData:r}],e),i};class tq extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const eq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class iq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class sq extends CG{constructor(){super(...arguments),this.type=cB.treemap,this.transformerConstructor=iq,this._viewBox=new Jt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new oe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:SD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[hG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Vz(this._dataSet,"hierarchyDimensionStatistics",Q$),Vz(this._dataSet,"flatten",_$);const i=new ya(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(sq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(sq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new tq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}sq.type=cB.treemap,sq.mark=yF,sq.transformerConstructor=iq,U(sq,A$),U(sq,MU);const nq=()=>{OW(),dY(),mz.registerAnimation("treemap",((t,e)=>({appear:eq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),tN(),CR.registerTransform("treemap",{transform:JX,markPhase:"beforeJoin"},!0),mz.registerSeries(sq.type,sq)},rq={type:"fadeIn"};function aq(t,e){return"fadeIn"===e?rq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class oq extends kG{constructor(){super(...arguments),this._supportStack=!1}}class lq extends bK{constructor(){super(...arguments),this.type=cB.gaugePointer,this.transformerConstructor=oq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(lq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},lq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(lq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}lq.type=cB.gaugePointer,lq.mark=SF,lq.transformerConstructor=oq;const hq=()=>{mz.registerSeries(lq.type,lq),yU(),OW(),mz.registerAnimation("gaugePointer",((t,e)=>{const i=aq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),iK(),tK()};class cq extends kG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class dq extends bK{constructor(){super(...arguments),this.type=cB.gauge,this.transformerConstructor=cq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=te(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Vz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[FD]=t[this._angleField[0]],t[DD]=e>0?i[e-1][FD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(dq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(dq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return p(t[DD])?this.angleAxisHelper.dataToPosition([t[DD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[FD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}dq.type=cB.gauge,dq.mark=xF,dq.transformerConstructor=cq;class uq extends IG{constructor(){super(...arguments),this.type=uq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}uq.type="cell";const pq=()=>{mz.registerMark(uq.type,uq),bM(),SM(),CR.registerGraphic(IB.cell,kg),CR.registerMark(IB.cell,dD)};function gq(t){return!1===t?{}:{type:"fadeIn"}}class mq extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class fq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class vq extends CG{constructor(){super(...arguments),this.type=cB.heatmap,this.transformerConstructor=fq}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(vq.mark.cell,{morph:bG(this._spec,vq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(vq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ei(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=wG(this);this._cellMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),vG("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new mq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}vq.type=cB.heatmap,vq.mark=wF,vq.transformerConstructor=fq;const _q=()=>{dY(),pq(),mz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},JH),{appear:gq(e)}))),rW(),iW(),mz.registerSeries(vq.type,vq)},yq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=te(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=te(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=yb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=yb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+yb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+yb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=gb(e.field),C=t.map(w),[E,P]=vb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:gb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?vb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=bq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),xq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},xq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[xD]:null==n?void 0:n[xD],[AD]:null==n?void 0:n[AD]}};class Aq extends UH{constructor(){super(...arguments),this.type=Aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Aq.type="ripple";const kq=()=>{mz.registerMark(Aq.type,Aq),CR.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),SO(),bO()},Mq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Tq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class wq extends kY{constructor(){super(...arguments),this.type=cB.correlation,this.transformerConstructor=Tq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Vz(this._dataSet,"correlation",yq);const s=new va;Gz(s,"dataview",ga),Vz(s,"correlationCenter",Sq);const n=new ya(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new oG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(wq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:xD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(wq.mark.ripplePoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(wq.mark.centerPoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[vD],y:t=>t[_D],size:t=>t[yD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),vG("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}wq.type=cB.correlation,wq.mark=CF,wq.transformerConstructor=Tq;const Cq=()=>{FG(),kq(),mz.registerSeries(wq.type,wq),mz.registerAnimation("correlation",((t,e)=>Object.assign({appear:Mq(0,e)},ZH)))};class Eq extends UH{constructor(){super(...arguments),this.type=Eq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Eq.type="liquid";const Pq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Bq extends uV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Rq extends MG{constructor(){super(...arguments),this.type=cB.liquid,this.transformerConstructor=jG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=kg({x:s,y:n,size:r,symbolType:Pq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=tj(this._spec.outlineMargin),this._paddingSpec=tj(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Rq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Rq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Rq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Rq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Bq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(fG(null===(i=mz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),vG("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(fG(null===(s=mz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),vG("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Rq.type=cB.liquid,Rq.mark=PF,Rq.transformerConstructor=jG;const Lq=t=>Y(t).join(",");class Oq extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Lq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Lq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Iq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Dq extends MG{constructor(){super(...arguments),this.type=cB.venn,this.transformerConstructor=Iq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:SD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(Dq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Dq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},nH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},nH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Lq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},nH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Lq(t.sets)},nH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Oq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Lq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Lq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Lq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Lq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=mz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}}Dq.type=cB.venn,Dq.mark=BF,Dq.transformerConstructor=Iq;class Fq extends mW{_isValidSeries(t){return t===cB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class jq extends pW{constructor(){super(...arguments),this.transformerConstructor=Fq,this.type="map",this.seriesType=cB.map}}jq.type="map",jq.seriesType=cB.map,jq.transformerConstructor=Fq;class zq extends mW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Hq extends zq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=IN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Bj({},s,l)),n&&Object.assign(o,Bj({},n,o))}}class Nq extends zq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Vq extends zq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class Gq extends pW{constructor(){super(...arguments),this.transformerConstructor=Vq}}Gq.transformerConstructor=Vq;class Wq extends Gq{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="pie",this.seriesType=cB.pie}}Wq.type="pie",Wq.seriesType=cB.pie,Wq.transformerConstructor=Vq;class Uq extends Vq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Yq extends Gq{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="pie3d",this.seriesType=cB.pie3d}}Yq.type="pie3d",Yq.seriesType=cB.pie3d,Yq.transformerConstructor=Uq;class Kq extends Nq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:RB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:RB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Xq extends pW{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="rose",this.seriesType=cB.rose,this._canStack=!0}}Xq.type="rose",Xq.seriesType=cB.rose,Xq.transformerConstructor=Kq;class $q extends Nq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Bj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class qq extends pW{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="radar",this.seriesType=cB.radar,this._canStack=!0}}qq.type="radar",qq.seriesType=cB.radar,qq.transformerConstructor=$q;class Zq extends mW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Bj(e,uH(this.type,t))})),this._transformAxisSpec(t)}}class Jq extends pW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="common",this._canStack=!0}}Jq.type="common",Jq.transformerConstructor=Zq;class Qq extends fW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class tZ extends pW{constructor(){super(...arguments),this.transformerConstructor=Qq,this._canStack=!0}}tZ.transformerConstructor=Qq;class eZ extends Qq{transformSpec(t){super.transformSpec(t),hH(t)}}class iZ extends tZ{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="histogram",this.seriesType=cB.bar}}iZ.type="histogram",iZ.seriesType=cB.bar,iZ.transformerConstructor=eZ;class sZ extends tZ{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="histogram3d",this.seriesType=cB.bar3d}}sZ.type="histogram3d",sZ.seriesType=cB.bar3d,sZ.transformerConstructor=eZ;class nZ extends Hq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class rZ extends pW{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="circularProgress",this.seriesType=cB.circularProgress,this._canStack=!0}}rZ.type="circularProgress",rZ.seriesType=cB.circularProgress,rZ.transformerConstructor=nZ;class aZ extends Hq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:cB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===cB.gauge||t.type===cB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===cB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class oZ extends pW{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="gauge",this.seriesType=cB.gaugePointer}}oZ.type="gauge",oZ.seriesType=cB.gaugePointer,oZ.transformerConstructor=aZ;class lZ extends mW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class hZ extends pW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}hZ.transformerConstructor=lZ;class cZ extends lZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class dZ extends hZ{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}dZ.type="wordCloud",dZ.seriesType=cB.wordCloud,dZ.transformerConstructor=cZ;class uZ extends lZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class pZ extends hZ{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="wordCloud3d",this.seriesType=cB.wordCloud3d}}pZ.type="wordCloud3d",pZ.seriesType=cB.wordCloud3d,pZ.transformerConstructor=uZ;class gZ extends mW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mZ extends pW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="funnel",this.seriesType=cB.funnel}}mZ.type="funnel",mZ.seriesType=cB.funnel,mZ.transformerConstructor=gZ;class fZ extends pW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="funnel3d",this.seriesType=cB.funnel3d}}fZ.type="funnel3d",fZ.seriesType=cB.funnel3d,fZ.transformerConstructor=gZ;class vZ extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=IN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=IN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class _Z extends pW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="linearProgress",this.seriesType=cB.linearProgress,this._canStack=!0}}_Z.type="linearProgress",_Z.seriesType=cB.linearProgress,_Z.transformerConstructor=vZ;class yZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),hH(t)}}class bZ extends pW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="rangeColumn",this.seriesType=cB.rangeColumn}}bZ.type="rangeColumn",bZ.seriesType=cB.rangeColumn,bZ.transformerConstructor=yZ;class xZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class SZ extends pW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="rangeColumn3d",this.seriesType=cB.rangeColumn3d}}SZ.type="rangeColumn3d",SZ.seriesType=cB.rangeColumn3d,SZ.transformerConstructor=xZ;class AZ extends mW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:BB,i=p(t.endAngle)?t.endAngle:e+ee(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=cB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class kZ extends pW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="sunburst",this.seriesType=cB.sunburst}}kZ.type="sunburst",kZ.seriesType=cB.sunburst,kZ.transformerConstructor=AZ;class MZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=cB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class TZ extends pW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="circlePacking",this.seriesType=cB.circlePacking}}TZ.type="circlePacking",TZ.seriesType=cB.circlePacking,TZ.transformerConstructor=MZ;class wZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CZ extends pW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="treemap",this.seriesType=cB.treemap}}CZ.type="treemap",CZ.seriesType=cB.treemap,CZ.transformerConstructor=wZ;class EZ extends HW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),hH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class PZ extends NW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="waterfall",this.seriesType=cB.waterfall}}PZ.type="waterfall",PZ.seriesType=cB.waterfall,PZ.transformerConstructor=EZ;class BZ extends fW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),hH(t)}}class RZ extends pW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="boxPlot",this.seriesType=cB.boxPlot}}RZ.type="boxPlot",RZ.seriesType=cB.boxPlot,RZ.transformerConstructor=BZ;class LZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends pW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="sankey",this.seriesType=cB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}OZ.type="sankey",OZ.seriesType=cB.sankey,OZ.transformerConstructor=LZ;class IZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),hH(t)}}class DZ extends pW{constructor(){super(...arguments),this.transformerConstructor=IZ,this.type="rangeArea",this.seriesType=cB.rangeArea}}DZ.type="rangeArea",DZ.seriesType=cB.rangeArea,DZ.transformerConstructor=IZ;class FZ extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class jZ extends pW{constructor(){super(...arguments),this.transformerConstructor=FZ,this.type="heatmap",this.seriesType=cB.heatmap}}jZ.type="heatmap",jZ.seriesType=cB.heatmap,jZ.transformerConstructor=FZ;class zZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=cB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HZ extends pW{constructor(){super(...arguments),this.transformerConstructor=zZ,this.type="correlation",this.seriesType=cB.correlation}}HZ.type="correlation",HZ.seriesType=cB.correlation,HZ.transformerConstructor=zZ;function NZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=gz(t.style)),B(t.textStyle)||Bj(s.textStyle,gz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&gz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&gz(s.background.style),s}const VZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},GZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:AD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class WZ extends GG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=qF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VH(this._option,e),this._initSelectedData(),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(aB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Bj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}WZ.specKey="legends";class UZ extends WZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Vz(this._option.dataSet,"discreteLegendFilter",GZ),Vz(this._option.dataSet,"discreteLegendDataMake",VZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return aB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=ez(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=NZ(s)),B(n.focusIconStyle)||gz(n.focusIconStyle),n.shape&&(n.shape=dz(n.shape)),n.label&&(n.label=dz(n.label)),n.value&&(n.value=dz(n.value)),n.background&&(n.background=dz(n.background)),ZF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),ZF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),ZF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||gz(r.railStyle),B(r.sliderStyle)||gz(r.sliderStyle)):(B(r.textStyle)||gz(r.textStyle),r.handler&&dz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Bj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return mP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(lP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(lP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(lP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=RN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=RN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}UZ.specKey="legends",UZ.type=r.discreteLegend;const YZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},KZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?cz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function XZ(t){return"color"===t||"size"===t}const $Z={color:bP,size:SP},qZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],ZZ=[2,10];class JZ extends WZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return XZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{XZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Vz(this._option.dataSet,"continuousLegendFilter",KZ),Vz(this._option.dataSet,"continuousLegendDataMake",YZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=ez(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=ez(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?qZ:ZZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Bj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=NZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=gz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=gz(r.style)),B(a.style)||(w.trackStyle=gz(a.style)),w.startText=dz(o),w.endText=dz(l),w.handlerText=dz(h),B(c)||(w.sizeBackground=gz(c)),d.visible&&!B(d.style)&&(Bj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return $Z[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}JZ.specKey="legends",JZ.type=r.continuousLegend;class QZ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Rz(n,a,!0))&&void 0!==e?e:[],...null!==(i=bz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Nw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=hV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=hV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(_V(s).every((t=>{var e;return!hV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=hV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=fV(t,i,s),m=vV(t,i,s),f=Bj({},I(e[t]),m),v=g.title,_=bV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=gV(f.title,Object.assign(Object.assign({},v),_)):f.title=gV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=yV(y);f.content=mV(f.content,(e=>bV(e,f,u.shape,t)))}else f.content=mV(y,(t=>bV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=wV(a,t,e),l=!!p(o)&&!1!==SV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class tJ extends QZ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class eJ extends QZ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class iJ extends QZ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const sJ=t=>p(t)&&!y(t),nJ=t=>p(t)&&y(t);class rJ extends VG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Bj({},this._theme,s.style),s.offset=Bj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=hV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}class aJ extends GG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=rJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&sJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&nJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&lN.globalConfig.uniqueTooltip&&l&&lN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?AV.canvas:AV.dom,n=mz.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new eJ(this),dimension:new tJ(this),group:new iJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(nb(i)||rb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=oV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(nJ(t)){if(sJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>fz(t,e[i])))))return!1}else{if(nJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&si(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}aJ.type=r.tooltip,aJ.transformerConstructor=rJ,aJ.specKey="tooltip";var oJ,lJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(oJ||(oJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(lJ||(lJ={}));const hJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class cJ extends GG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{hJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){xz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Sz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=lB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=WN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=KN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=XN(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}dJ.specKey="crosshair",dJ.type=r.cartesianCrosshair;class uJ extends cJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:qt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=lB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Bj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=ON(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=ON(s.getSpec())),c.angle=a.angle,c.axis=s,Bj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=RN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=RN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:se(o,s,i),end:se(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},se(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ne(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=se(t,r,p),f=se(t,r,g),v=Re([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(qt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},se(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}uJ.specKey="crosshair",uJ.type=r.polarCrosshair;const pJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},gJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class mJ extends GG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Lt(s/n)>=.5:Lt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=kz(t),this._isHorizontal="horizontal"===Mz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(zw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};aB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=zw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else aB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Gz(s,"dataview",ga),Vz(s,"dataFilterComputeDomain",gJ);const n=new ya(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(zw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&zw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,zw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new lC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Vz(this._option.dataSet,"dataFilterWithNewDomain",pJ),aB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>zw(this._stateScale.type)},level:tH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Nw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Nw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(mJ,MU);class fJ extends VG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Bj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class vJ extends mJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=fJ,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new EC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!zw(t.type)||e[0]!==e[1])&&(!Nw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new lE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:gz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:gz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:gz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:gz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:gz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:gz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:gz(g.style)},selectedBackgroundStyle:gz(this._spec.selectedBackground.style),dragMaskStyle:gz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Bj(gz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Bj(gz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=RN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}vJ.type=r.dataZoom,vJ.transformerConstructor=fJ,vJ.specKey="dataZoom";class _J extends mJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=JP(this._start,e)&&JP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=gz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=gz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}_J.type=r.scrollBar,_J.specKey="scrollBar";const yJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class bJ extends GG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==bJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Vz(this._option.dataSet,"indicatorFilter",yJ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Bj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},pz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?ij(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ij(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},pz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new MP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}bJ.type=r.indicator,bJ.specKey="indicator";const xJ=["sum","average","min","max","variance","standardDeviation","median"];function SJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function AJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&SJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=ZF(t.x)?wJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function kJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&SJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=ZF(t.y)?wJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function MJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&SJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function TJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&SJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function wJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function CJ(t){return xJ.includes(t)}function EJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=AJ(t,m,n,d,h,a),i=kJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=AJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=kJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function PJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=MJ(t,l,n,r),i=TJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=MJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=TJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function BJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=ZF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=ZF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&SJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&SJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function RJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&SJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&SJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function LJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=wJ(e,r)),e+=s,ZF(i)&&(i=wJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=wJ(e,s)),ZF(i)&&(i=wJ(i,n)),{x:e,y:i}}))}function OJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function IJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},gz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},FJ(gz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=FJ(gz(n),i)),t}return{visible:!1}}function DJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function FJ(t,e){return d(t)?t(e):t}function jJ(t,e){return d(t)?t(e):t}function zJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function HJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function NJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function VJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function GJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>UJ(i,t,e))):s.x=UJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>UJ(i,t,e))):s.y=UJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>UJ(i,t,e))):s.angle=UJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>UJ(i,t,e))):s.radius=UJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=UJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const WJ={min:(t,e)=>QP(t[0].latestData,e.field),max:(t,e)=>tB(t[0].latestData,e.field),sum:function(t,e){return eB(t[0].latestData,e.field)},average:function(t,e){return iB(t[0].latestData,e.field)},variance:function(t,e){return sB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(sB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function UJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return WJ[i](e,{field:s})}return t}class YJ extends GG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&CJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&CJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&CJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&CJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&CJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new va;return e.registerParser("array",s),new ya(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=lB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=JF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=JF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function KJ(t,e){return function(t,e,i){const{predict:s}=Sb(t,(t=>t[e]),(t=>t[i])),n=QP(t,e),r=tB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function XJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class $J extends YJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=HJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:FJ(gz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:IJ(y,this._markerData),state:{line:DJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:DJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:DJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:DJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:DJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:gz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:gz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=HJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerRegression",KJ),Vz(this._option.dataSet,"markerFilter",XJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ya(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}$J.specKey="markLine";class qJ extends $J{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=HJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=EJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=BJ(i,r,d,e.coordinatesOffset):c&&(y=LJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(ZF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=HJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}qJ.type=r.markLine,qJ.coordinateType="cartesian";class ZJ extends $J{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=HJ(this._spec);return e||i?new ZE(t):new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=HJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=PJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>se(m,t.radius,t.angle)))}}else u&&(p=RJ(i,r,a),g={points:p.map((t=>se(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=HJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}ZJ.type=r.polarMarkLine,ZJ.coordinateType="polar";class JJ extends GG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=qF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new AP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}JJ.type=r.title,JJ.specKey=r.title;class QJ extends YJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=NJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:FJ(gz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:IJ(u,this._markerData),state:{area:DJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:DJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:DJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=NJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerFilter",XJ);const c=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}QJ.specKey="markArea";class tQ extends QJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=NJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=EJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=EJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=BJ(i,r,d,e.coordinatesOffset):c&&(u=LJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=NJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}tQ.type=r.markArea,tQ.coordinateType="cartesian";class eQ extends QJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=NJ(this._spec);return i||e||s?new JE(t):new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=NJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=PJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=RJ(i,r,c),u={points:d.map((t=>se(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=NJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}eQ.type=r.polarMarkArea,eQ.coordinateType="polar";const iQ=t=>gz(Object.assign({},t)),sQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},gz(t.style))}),nQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=iQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=iQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},gz(Object.assign({},y)));var y;const b=sQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=sQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=sQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=sQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},rQ=t=>"left"===t||"right"===t,aQ=t=>"top"===t||"bottom"===t;class oQ extends GG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},nQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},nQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new zP(t):this._playerComponent=new VP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=rQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=rQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=rQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=aQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):rQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):aQ(this._orient)?this._maxSize():t.height}_computeDx(t){return rQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return aQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}oQ.specKey="player",oQ.type=r.player;class lQ extends GG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}lQ.type=r.label;class hQ extends cY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}hQ.type="text",hQ.constructorType="label";const cQ=()=>{mz.registerMark(hQ.constructorType,hQ),xO()};class dQ extends VG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class uQ extends lQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=dQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),aB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Bj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=UU[t])&&void 0!==i?i:UU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:YU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}uQ.type=r.label,uQ.specKey="label",uQ.transformerConstructor=dQ;class pQ extends lQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[LD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Bj({textStyle:{pickable:!0===this._spec.interactive},position:gQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[ID]))},a))}})).encode((e=>YU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function gQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}pQ.type=r.totalLabel,pQ.specKey="totalLabel";class mQ extends YJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=VJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:jJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:jJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:FJ(B.style,this._markerData)},state:{line:DJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:DJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:DJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:DJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:DJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:DJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:DJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:DJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:DJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:DJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=gz(FJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=FJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=IJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=FJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:gz(z.style)}):{visible:!1};return new tP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=OJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:zJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:zJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=VJ(t);if(!(p(t.coordinate)||e||i||s))return;Vz(this._option.dataSet,"markerAggregation",GJ),Vz(this._option.dataSet,"markerFilter",XJ);const{options:n}=this._computeOptions(),r=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}mQ.specKey="markPoint";class fQ extends mQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=EJ(i,s,s,s,o)[0][0]:r?l=BJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=LJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=VJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}fQ.type=r.markPoint,fQ.coordinateType="cartesian";class vQ extends mQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=PJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:se({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}vQ.type=r.polarMarkPoint,vQ.coordinateType="polar";class _Q extends mQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}_Q.type=r.geoMarkPoint,_Q.coordinateType="geo";const yQ="inBrush",bQ="outOfBrush";class xQ extends GG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),yQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),bQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new YP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:gz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(HP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,bQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(HP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(HP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},gz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(yQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(yQ),i.addState(bQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(yQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(yQ),i.addState(bQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ze(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ze(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(yQ),i.removeState(bQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}xQ.type=r.brush,xQ.specKey="brush";class SQ extends GG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${uB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Jt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Jt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}SQ.type=r.customMark,SQ.specKey="customMark";function AQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function kQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function MQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:kQ(t.rect),anchorCandidates:BQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>AQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tAQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function TQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Ue(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=EQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ci(r,s,i);if(!EQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],wQ(CQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=wQ(CQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=PQ(t.rect,a,0),t}));return MQ(h)}function wQ(t){return t>180?t-360:t}function CQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function EQ(t,e){for(let i=0;i{const{x:r,y:a}=PQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class RQ extends GG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ya(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:tH.copyDataView},!1),this._data=new VH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new tP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=tj(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Cu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Pg(gz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=kg(gz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=yp(gz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=yp(gz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=PQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:gz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):MQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}RQ.type=r.mapLabel,RQ.specKey="mapLabel";class LQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>OQ(t))),a=n.filter((t=>!OQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>OQ(t))),h=o.filter((t=>!OQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function OQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}LQ.type="grid";lN.useRegisters([()=>{rI(),aI(),OG(),FG(),iN(),QH(),rW(),iW(),mz.registerSeries(hW.type,hW),mz.registerChart(_W.type,_W)},()=>{rI(),aI(),OG(),bW(),FG(),SW(),rW(),iW(),mz.registerSeries(kW.type,kW),mz.registerChart(TW.type,TW)},()=>{zW(),mz.registerChart(NW.type,NW)},()=>{tU(),mz.registerChart(iU.type,iU)},()=>{zY(),mz.registerChart(Wq.type,Wq)},()=>{nK(),mz.registerChart(Xq.type,Xq)},()=>{uK(),mz.registerChart(qq.type,qq)},()=>{zW(),mz.registerChart(iZ.type,iZ)},()=>{BU(),mz.registerChart(jq.type,jq)},()=>{hq(),mz.registerSeries(dq.type,dq),IY(),AK(),tK(),mz.registerChart(oZ.type,oZ)},()=>{uX(),mz.registerChart(dZ.type,dZ)},()=>{RX(),mz.registerChart(mZ.type,mZ)},()=>{iY(),mz.registerChart(PZ.type,PZ)},()=>{lY(),FG(),QH(),rW(),iW(),mz.registerSeries(hY.type,hY),mz.registerChart(RZ.type,RZ)},()=>{mz.registerSeries(MK.type,MK),IY(),AK(),tN(),iK(),tK(),mz.registerChart(rZ.type,rZ)},()=>{RK(),mz.registerChart(_Z.type,_Z)},()=>{bY(),mz.registerChart(bZ.type,bZ)},()=>{bW(),rW(),iW(),mz.registerSeries(AY.type,AY),mz.registerChart(DZ.type,DZ)},()=>{M$(),mz.registerChart(kZ.type,kZ)},()=>{P$(),mz.registerChart(TZ.type,TZ)},()=>{nq(),mz.registerChart(CZ.type,CZ)},()=>{J$(),mz.registerChart(OZ.type,OZ)},()=>{_q(),mz.registerChart(jZ.type,jZ)},()=>{Cq(),mz.registerChart(HZ.type,HZ)},()=>{mz.registerChart(Jq.type,Jq)},iW,rW,()=>{XG(),mz.registerComponent(aW.type,aW)},()=>{XG(),mz.registerComponent(oW.type,oW)},()=>{XG(),mz.registerComponent(lW.type,lW)},iK,tK,()=>{mz.registerComponent(UZ.type,UZ)},()=>{mz.registerComponent(JZ.type,JZ)},()=>{mz.registerComponent(aJ.type,aJ)},()=>{mz.registerComponent(dJ.type,dJ)},()=>{mz.registerComponent(uJ.type,uJ)},()=>{mz.registerComponent(vJ.type,vJ)},()=>{mz.registerComponent(_J.type,_J)},()=>{mz.registerComponent(bJ.type,bJ)},CU,()=>{mz.registerComponent(qJ.type,qJ),KE()},()=>{mz.registerComponent(tQ.type,tQ),$E()},()=>{mz.registerComponent(fQ.type,fQ),QE()},()=>{mz.registerComponent(ZJ.type,ZJ),ZE._animate=EE,KE()},()=>{mz.registerComponent(eQ.type,eQ),JE._animate=BE,$E()},()=>{mz.registerComponent(vQ.type,vQ),QE()},()=>{mz.registerComponent(_Q.type,_Q),QE()},()=>{mz.registerComponent(JJ.type,JJ)},()=>{mz.registerComponent(oQ.type,oQ)},()=>{GO(),cQ(),UG(),mz.registerComponent(uQ.type,uQ,!0)},()=>{GO(),cQ(),UG(),mz.registerComponent(pQ.type,pQ,!0)},()=>{mz.registerComponent(xQ.type,xQ)},()=>{mz.registerComponent(SQ.type,SQ)},()=>{mz.registerComponent(RQ.type,RQ)},()=>{th.load(pT)},()=>{mz.registerLayout(LQ.type,LQ)},eG,_N,$R,XR]),lN.useRegisters([()=>{gA(th)}]),t.ARC_END_ANGLE=kB,t.ARC_K=MB,t.ARC_MIDDLE_ANGLE=TB,t.ARC_QUADRANT=wB,t.ARC_RADIAN=CB,t.ARC_RATIO=SB,t.ARC_START_ANGLE=AB,t.ARC_TRANSFORM_VALUE=xB,t.AxisSyncPlugin=TN,t.BASE_EVENTS=uD,t.CORRELATION_SIZE=yD,t.CORRELATION_X=vD,t.CORRELATION_Y=_D,t.CanvasTooltipHandler=tG,t.DEFAULT_CHART_HEIGHT=gB,t.DEFAULT_CHART_WIDTH=pB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=GD,t.DEFAULT_DATA_INDEX=xD,t.DEFAULT_DATA_KEY=SD,t.DEFAULT_DATA_SERIES_FIELD=AD,t.DEFAULT_GRADIENT_CONFIG=WD,t.DEFAULT_LABEL_ALIGN=fB,t.DEFAULT_LABEL_LIMIT=mB,t.DEFAULT_LABEL_TEXT=vB,t.DEFAULT_LABEL_VISIBLE=_B,t.DEFAULT_LABEL_X=yB,t.DEFAULT_LABEL_Y=bB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=ND,t.DEFAULT_MEASURE_CANVAS_ID=bD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=VD,t.DEFAULT_SERIES_STYLE_NAME=kD,t.DomTooltipHandler=QV,t.Factory=mz,t.FormatterPlugin=vN,t.GradientType=HD,t.MediaQuery=pN,t.POLAR_DEFAULT_RADIUS=RB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=PB,t.POLAR_START_ANGLE=BB,t.POLAR_START_RADIAN=EB,t.PREFIX=uB,t.SEGMENT_FIELD_END=FD,t.SEGMENT_FIELD_START=DD,t.STACK_FIELD_END=CD,t.STACK_FIELD_END_OffsetSilhouette=RD,t.STACK_FIELD_END_PERCENT=PD,t.STACK_FIELD_KEY=TD,t.STACK_FIELD_START=wD,t.STACK_FIELD_START_OffsetSilhouette=BD,t.STACK_FIELD_START_PERCENT=ED,t.STACK_FIELD_TOTAL=LD,t.STACK_FIELD_TOTAL_PERCENT=OD,t.STACK_FIELD_TOTAL_TOP=ID,t.ThemeManager=$j,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=lN,t.WaterfallDefaultSeriesField=fD,t.builtinThemes=jj,t.computeActualDataScheme=jF,t.darkTheme=kj,t.dataScheme=sj,t.default=lN,t.defaultThemeName=zj,t.getActualColor=HF,t.getColorSchemeBySeries=WF,t.getDataScheme=FF,t.getMergedTheme=Kj,t.getTheme=Wj,t.hasThemeMerged=Vj,t.isColorKey=NF,t.isProgressiveDataColorScheme=VF,t.isTokenKey=xj,t.lightTheme=Aj,t.queryColorFromColorScheme=zF,t.queryToken=bj,t.registerCanvasTooltipHandler=eG,t.registerChartPlugin=uN,t.registerDomTooltipHandler=()=>{JV(QV)},t.registerFormatPlugin=_N,t.registerMediaQuery=()=>{uN(pN)},t.registerTheme=Gj,t.removeTheme=Uj,t.themeExist=Yj,t.themes=Hj,t.token=Sj,t.transformColorSchemeToStandardStruct=GF,t.version="1.11.11",t.vglobal=O_,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(Mt.source,"g");function wt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Lt=Math.abs,Ot=Math.atan2,It=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Vt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ut(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Yt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Kt(t,e){return Ut(t+e,10**Math.max(Yt(t),Yt(e)))}function Xt(t,e){return Ut(t-e,10**Math.max(Yt(t),Yt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class qt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Zt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Jt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Jt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Qt extends Jt{}function te(t){return t*(Math.PI/180)}function ee(t){return 180*t/Math.PI}const ie=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function se(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ne(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function re(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ae(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=re(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new oe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new oe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new oe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=ee(r.rotateDeg),r}}class le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function he(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function ce(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const de=/^#([0-9a-f]{3,8})$/,ue={transparent:4294967040},pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return S(t)?new ye(t>>16,t>>8&255,255&t,1):y(t)?new ye(t[0],t[1],t[2]):new ye(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ve(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class _e{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new _e(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof _e?t:new _e(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(ue[t]))return function(t){return S(t)?new ye(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ye(t[0],t[1],t[2],t[3]):new ye(255,255,255,1)}(ue[t]);if(p(pe[t]))return me(pe[t]);const e=`${t}`.trim().toLowerCase(),i=de.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ye((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=he(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ye(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=_e.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ye(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=ce(this.color.r,this.color.g,this.color.b),r=he(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ye(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=de.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new ye((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?me(s):8===n?new ye(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=pe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _e(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ve(t.color.r),this.color.g=ve(t.color.g),this.color.b=ve(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ye{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${ge(this.r)+ge(this.g)+ge(this.b)+(1===this.opacity?"":ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ye(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ce});function Se(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ae,ke,Me,Te,we,Ce,Ee,Pe;function Be(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Le(t,e,i){return null===t?e:null===e?t:(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,i&&(Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>=Ce||ke<=we||Me>=Pe||Te<=Ee?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ae,we),y1:Math.max(Me,Ee),x2:Math.min(ke,Ce),y2:Math.min(Te,Pe)})}var Oe;function Ie(t,e,i){return!(t&&e&&(i?(Ae=t.x1,ke=t.x2,Me=t.y1,Te=t.y2,we=e.x1,Ce=e.x2,Ee=e.y1,Pe=e.y2,Ae>ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee]),Ae>Ce||kePe||Tee.x2||t.x2e.y2||t.y2ke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),t.x>=Ae&&t.x<=ke&&t.y>=Me&&t.y<=Te):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Fe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function je(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function ze(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function He(t,e){const i=e?t.angle:te(t.angle),s=ze(t);return[je({x:t.x1,y:t.y1},i,s),je({x:t.x2,y:t.y1},i,s),je({x:t.x2,y:t.y2},i,s),je({x:t.x1,y:t.y2},i,s)]}let Ne,Ve,Ge,We;function Ue(t){return Ne=1/0,Ve=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ne>t.x&&(Ne=t.x),Get.y&&(Ve=t.y),Wee&&r>s||rn?o:0}function qe(t,e){return Math.abs(t-e)0&&Ke(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Je=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";const ti=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ei(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ii(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function si(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const ni=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ri=6371008.8,ai={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ri,kilometers:6371.0088,kilometres:6371.0088,meters:ri,metres:ri,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ri/1852,radians:1,yards:6967335.223679999};function oi(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function li(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function hi(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===De(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ci(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=te(t[0]),r=te(t[1]),a=te(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ai[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:ee(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:ee(l)}}class di{static getInstance(){return di.instance||(di.instance=new di),di.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let pi;function gi(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class mi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vi(t){let e;if(e=fi.exec(t))return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const _i=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class yi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}newFormat(t){const e=vi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):bi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=bi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?_i[8+pi/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=vi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=ui(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=_i[8+n/3];return function(t){return s(r*t)+a}}}const bi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gi(100*t,e),r:gi,s:function(t,e){const i=ui(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(pi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+ui(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function xi(){return new Si}function Si(){this.reset()}Si.prototype={constructor:Si,reset:function(){this.s=this.t=0},add:function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},valueOf:function(){return this.s}};var Ai=new Si;function ki(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Mi=1e-6,Ti=Math.PI,wi=Ti/2,Ci=Ti/4,Ei=2*Ti,Pi=180/Ti,Bi=Ti/180,Ri=Math.abs,Li=Math.atan,Oi=Math.atan2,Ii=Math.cos,Di=Math.exp,Fi=Math.log,ji=Math.pow,zi=Math.sin,Hi=Math.sign||function(t){return t>0?1:t<0?-1:0},Ni=Math.sqrt,Vi=Math.tan;function Gi(t){return t>1?0:t<-1?Ti:Math.acos(t)}function Wi(t){return t>1?wi:t<-1?-wi:Math.asin(t)}function Ui(){}function Yi(t,e){t&&Xi.hasOwnProperty(t.type)&&Xi[t.type](t,e)}var Ki={Feature:function(t,e){Yi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sTi?t+Math.round(-t/Ei)*Ei:t,e]}function os(t,e,i){return(t%=Ei)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Ti?e-Ei:e<-Ti?e+Ei:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Ii(t),s=zi(t),n=Ii(e),r=zi(e);function a(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*i+o*s;return[Oi(l*n-c*r,o*i-h*s),Wi(c*n+l*r)]}return a.invert=function(t,e){var a=Ii(e),o=Ii(t)*a,l=zi(t)*a,h=zi(e),c=h*n-l*r;return[Oi(l*n+h*r,o*i+c*s),Wi(c*i-o*s)]},a}function ds(t,e){(e=Qi(e))[0]-=t,ns(e);var i=Gi(-e[1]);return((-e[2]<0?-i:i)+Ei-Mi)%Ei}function us(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ui,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return Ri(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function fs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Ss(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function As(t,e,i,s){return function(n){var r,a,o,l=e(n),h=us(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=Ss(a);var t=function(t,e){var i=bs(e),s=e[1],n=zi(s),r=[zi(i),-Ii(i),0],a=0,o=0;ys.reset(),1===n?s=wi+Mi:-1===n&&(s=-wi-Mi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Ti,w=m*x;if(ys.add(Oi(w*k*zi(M),f*S+w*Ii(M))),a+=T?A+k*Ei:A,T^p>=i^y>=i){var C=es(Qi(u),Qi(_));ns(C);var E=es(r,C);ns(E);var P=(T^A>=0?-1:1)*Wi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Mi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ks))}return u}}function ks(t){return t.length>1}function Ms(t,e){return((t=t.x)[0]<0?t[1]-wi-Mi:wi-t[1])-((e=e.x)[0]<0?e[1]-wi-Mi:wi-e[1])}1===(vs=xs).length&&(_s=vs,vs=function(t,e){return xs(_s(t),e)});var Ts=As((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Ti:-Ti,l=Ri(r-i);Ri(l-Ti)0?wi:-wi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ti&&(Ri(i-n)Mi?Li((zi(e)*(r=Ii(s))*zi(i)-zi(s)*(n=Ii(e))*zi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*wi,s.point(-Ti,n),s.point(0,n),s.point(Ti,n),s.point(Ti,0),s.point(Ti,-n),s.point(0,-n),s.point(-Ti,-n),s.point(-Ti,0),s.point(-Ti,n);else if(Ri(t[0]-e[0])>Mi){var r=t[0]0,n=Ri(e)>Mi;function r(t,i){return Ii(t)*Ii(i)>e}function a(t,i,s){var n=[1,0,0],r=es(Qi(t),Qi(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=es(n,r),u=ss(n,h);is(u,ss(r,c));var p=d,g=ts(u,p),m=ts(p,p),f=g*g-m*(ts(u,u)-1);if(!(f<0)){var v=Ni(f),_=ss(p,(-g-v)/m);if(is(_,u),_=Ji(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ri(_[0]-b)Ti^(b<=_[0]&&_[0]<=x)){var T=ss(p,(-g+v)/m);return is(T,u),[_,Ji(T)]}}}function o(e,i){var n=s?t:Ti-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return As(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Ti:-Ti),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ps(e,p)||ps(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Ii(e),o=zi(e),l=s*i;null==n?(n=e+s*Ei,r=e-l/2):(n=ds(a,n),r=ds(a,r),(s>0?nr)&&(n+=s*Ei));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ri(s[0]-t)0?0:3:Ri(s[0]-i)0?2:1:Ri(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=us(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=Ss(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ms(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Es,Math.min(Cs,g)),m=Math.max(Es,Math.min(Cs,m))],b=[r=Math.max(Es,Math.min(Cs,r)),a=Math.max(Es,Math.min(Cs,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Bs(t){return t}var Rs,Ls,Os,Is,Ds=xi(),Fs=xi(),js={point:Ui,lineStart:Ui,lineEnd:Ui,polygonStart:function(){js.lineStart=zs,js.lineEnd=Vs},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=Ui,Ds.add(Ri(Fs)),Fs.reset()},result:function(){var t=Ds/2;return Ds.reset(),t}};function zs(){js.point=Hs}function Hs(t,e){js.point=Ns,Rs=Os=t,Ls=Is=e}function Ns(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Vs(){Ns(Rs,Ls)}var Gs=js,Ws=1/0,Us=Ws,Ys=-Ws,Ks=Ys;var Xs,$s,qs,Zs,Js={point:function(t,e){tYs&&(Ys=t);eKs&&(Ks=e)},lineStart:Ui,lineEnd:Ui,polygonStart:Ui,polygonEnd:Ui,result:function(){var t=[[Ws,Us],[Ys,Ks]];return Ys=Ks=-(Us=Ws=1/0),t}},Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln=0,hn={point:cn,lineStart:dn,lineEnd:gn,polygonStart:function(){hn.lineStart=mn,hn.lineEnd=fn},polygonEnd:function(){hn.point=cn,hn.lineStart=dn,hn.lineEnd=gn},result:function(){var t=ln?[an/ln,on/ln]:rn?[sn/rn,nn/rn]:en?[Qs/en,tn/en]:[NaN,NaN];return Qs=tn=en=sn=nn=rn=an=on=ln=0,t}};function cn(t,e){Qs+=t,tn+=e,++en}function dn(){hn.point=un}function un(t,e){hn.point=pn,cn(qs=t,Zs=e)}function pn(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,cn(qs=t,Zs=e)}function gn(){hn.point=cn}function mn(){hn.point=vn}function fn(){_n(Xs,$s)}function vn(t,e){hn.point=_n,cn(Xs=qs=t,$s=Zs=e)}function _n(t,e){var i=t-qs,s=e-Zs,n=Ni(i*i+s*s);sn+=n*(qs+t)/2,nn+=n*(Zs+e)/2,rn+=n,an+=(n=Zs*t-qs*e)*(qs+t),on+=n*(Zs+e),ln+=3*n,cn(qs=t,Zs=e)}var yn=hn;function bn(t){this._context=t}bn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ei)}},result:Ui};var xn,Sn,An,kn,Mn,Tn=xi(),wn={point:Ui,lineStart:function(){wn.point=Cn},lineEnd:function(){xn&&En(Sn,An),wn.point=Ui},polygonStart:function(){xn=!0},polygonEnd:function(){xn=null},result:function(){var t=+Tn;return Tn.reset(),t}};function Cn(t,e){wn.point=En,Sn=kn=t,An=Mn=e}function En(t,e){kn-=t,Mn-=e,Tn.add(Ni(kn*kn+Mn*Mn)),kn=t,Mn=e}var Pn=wn;function Bn(){this._string=[]}function Rn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ln(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Zi(t,i(s))),s.result()}return r.area=function(t){return Zi(t,i(Gs)),Gs.result()},r.measure=function(t){return Zi(t,i(Pn)),Pn.result()},r.bounds=function(t){return Zi(t,i(Js)),Js.result()},r.centroid=function(t){return Zi(t,i(yn)),yn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Bs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Bn):new bn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function On(t){return function(e){var i=new In;for(var s in t)i[s]=t[s];return i.stream=e,i}}function In(){}function Dn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Zi(i,t.stream(Js)),e(Js.result()),null!=s&&t.clipExtent(s),t}function Fn(t,e,i){return Dn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function jn(t,e,i){return Fn(t,[[0,0],e],i)}function zn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Hn(t,e,i){return Dn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Bn.prototype={_radius:4.5,_circle:Rn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Rn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},In.prototype={constructor:In,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Nn=16,Vn=Ii(30*Bi);function Gn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Ni(b*b+x*x+S*S),k=Wi(S/=A),M=Ri(Ri(S)-1)e||Ri((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Bi:0,E()):[f*Pi,v*Pi,_*Pi]},w.angle=function(t){return arguments.length?(y=t%360*Bi,E()):y*Pi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Gn(o,T=t*t),P()):Ni(T)},w.fitExtent=function(t,e){return Fn(w,t,e)},w.fitSize=function(t,e){return jn(w,t,e)},w.fitWidth=function(t,e){return zn(w,t,e)},w.fitHeight=function(t,e){return Hn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function $n(t){var e=0,i=Ti/3,s=Xn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Bi,i=t[1]*Bi):[e*Pi,i*Pi]},n}function qn(t,e){var i=zi(t),s=(i+zi(e))/2;if(Ri(s)2?t[2]*Bi:0),e.invert=function(e){return(e=t.invert(e[0]*Bi,e[1]*Bi))[0]*=Pi,e[1]*=Pi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===sr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function rr(t){return Vi((wi+t)/2)}function ar(t,e){var i=Ii(t),s=t===e?zi(t):Fi(i/Ii(e))/Fi(rr(e)/rr(t)),n=i*ji(rr(t),s)/s;if(!s)return sr;function r(t,e){n>0?e<-wi+Mi&&(e=-wi+Mi):e>wi-Mi&&(e=wi-Mi);var i=n/ji(rr(e),s);return[i*zi(s*t),n-i*Ii(s*t)]}return r.invert=function(t,e){var i=n-e,r=Hi(s)*Ni(t*t+i*i),a=Oi(t,Ri(i))*Hi(i);return i*s<0&&(a-=Ti*Hi(t)*Hi(i)),[a/s,2*Li(ji(n/r,1/s))-wi]},r}function or(t,e){return[t,e]}function lr(t,e){var i=Ii(t),s=t===e?zi(t):(i-Ii(e))/(e-t),n=i/s+t;if(Ri(s)Mi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},vr.invert=tr(Wi),_r.invert=tr((function(t){return 2*Li(t)})),yr.invert=function(t,e){return[-e,2*Li(Di(t))-wi]};var Sr={exports:{}},Ar=function(t,e){this.p1=t,this.p2=e};Ar.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ar.prototype.run=function(){return this.p2[0]-this.p1[0]},Ar.prototype.slope=function(){return this.rise()/this.run()},Ar.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ar.prototype.isVertical=function(){return!isFinite(this.slope())},Ar.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ar.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ar.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ar.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Ar.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var kr=Ar,Mr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new kr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Mr(t.slice(0,s),e),o=Mr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Tr=Mr;!function(t){var e=Tr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Cr(Br,e),{tolerance:s}=i;return wr(t,s)};var Lr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Lr||(Lr={}));const Or=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+zr(e,6):zr(e,4))+"-"+zr(t.getUTCMonth()+1,2)+"-"+zr(t.getUTCDate(),2)+(r?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"."+zr(r,3)+"Z":n?"T"+zr(i,2)+":"+zr(s,2)+":"+zr(n,2)+"Z":s||i?"T"+zr(i,2)+":"+zr(s,2)+"Z":"")}function Nr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Dr;if(h)return h=!1,Ir;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.DSV;const i=Cr(Wr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Nr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Vr(t)},Kr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Gr(t)};function Xr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return $r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return $r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zr(t);default:throw new Error("unknown GeoJSON type")}}function $r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=qr(t.properties),e.geometry=Zr(t.geometry),e}function qr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=qr(s):e[i]=s})),e):e}function Zr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Zr(t)})),e):(e.coordinates=Jr(t.coordinates),e)}function Jr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Jr(t)}))}function Qr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ta(t){for(var e,i,s=Qr(t),n=0,r=1;r0}function ea(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Xr(t));var r=[];switch(t.type){case"GeometryCollection":return ia(t,(function(t){na(t,s)})),t;case"FeatureCollection":return ea(t,(function(t){ea(na(t,s),(function(t){r.push(t)}))})),li(r)}return na(t,s)}function na(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ia(t,(function(t){na(t,e)})),t;case"LineString":return ra(Qr(t),e),t;case"Polygon":return aa(Qr(t),e),t;case"MultiLineString":return Qr(t).forEach((function(t){ra(t,e)})),t;case"MultiPolygon":return Qr(t).forEach((function(t){aa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ra(t,e){ta(t)===e&&t.reverse()}function aa(t,e){ta(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=oa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},da=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Lr.GEO;const i=Cr(ha,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ca(t))})):e.push(ca(t))})),e})(t);let o=t.features;return a&&(o=sa(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=la.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=la.bounds(t);t.bbox=e}})),t.features=o,t},ua={},pa=(t,e,i)=>{i.type=Lr.GEO;const s=Cr(ha,ua,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return xr(a,t)}))}:xr(a,o));var a,o;return da(r,s,i)},ga=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ma=0;function fa(){return ma>1e8&&(ma=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ma++}class va{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:fa("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const _a="_data-view-diff-rank";class ya{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:fa("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[_a]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[_a]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[_a]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Or),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ba{static GenAutoIncrementId(){return ba.auto_increment_id++}}ba.auto_increment_id=0;class xa{constructor(t){this.id=ba.GenAutoIncrementId(),this.registry=t}}const Sa="named",Aa="inject",ka="multi_inject",Ma="inversify:tagged",Ta="inversify:paramtypes";class wa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Sa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ca=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ea(e,0,s,t)}}function Ba(t){return e=>(i,s,n)=>Pa(new wa(t,e))(i,s,n)}const Ra=Ba(Aa),La=Ba(ka);function Oa(){return function(t){return Ca.defineMetadata(Ta,null,t),t}}function Ia(t){return Pa(new wa(Sa,t))}const Da="Singleton",Fa="Transient",ja="ConstantValue",za="DynamicValue",Ha="Factory",Na="Function",Va="Instance",Ga="Invalid";class Wa{constructor(t,e){this.id=ba.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ga,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wa(this.serviceIdentifier,this.scope);return t.activated=t.scope===Da&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ua{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ca.getMetadata(Ta,t),userGeneratedMetadata:Ca.getMetadata(Ma,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ya=(Ka=Sa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ka&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const qa=Symbol("ContributionProvider");class Za{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ja(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).inSingletonScope().whenTargetNamed(e)}class Qa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class to extends Qa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const eo=Symbol.for("EnvContribution"),io=Symbol.for("VGlobal");var so=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},no=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ro=function(t,e){return function(i,s){e(i,s,t)}};let ao=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ba.GenAutoIncrementId(),this.hooks={onSetEnv:new to(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ao=so([Oa(),ro(0,Ra(qa)),ro(0,Ia(eo)),no("design:paramtypes",[Object])],ao);const oo=Bt-1e-8;class lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>oo)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const co=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,uo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},po={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let go,mo,fo,vo,_o,yo;var bo,xo,So,Ao,ko,Mo,To,wo,Co;function Eo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Po(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=te(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Lo(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Go extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Wo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Uo(t,e,i){const s=null!=e?e:Lt(i[i.length-1].x-i[0].x)>Lt(i[i.length-1].y-i[0].y)?To.ROW:To.COLUMN;return"monotoneY"===t?new Go(t,s):new Vo(t,s)}class Yo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ko(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new Yo(n,s),t),n}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("basis",i,t);return function(t,e){Wo(t,e)}(new $o(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneX",i,t);return function(t,e){Wo(t,e)}(new el(n,s),t),n}function nl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ko(t,e);const n=Uo("monotoneY",i,t);return function(t,e){Wo(t,e)}(new il(n,s),t),n}let rl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function al(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Lt(t[t.length-1].x-t[0].x)>Lt(t[t.length-1].y-t[0].y)?To.ROW:To.COLUMN);return function(t,e){Wo(t,e)}(new rl(r,e,n),t),r}class ol extends Yo{lineEnd(){this.context.closePath()}}function ll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Uo("linear",i,t);return function(t,e){Wo(t,e)}(new ol(n,s),t),n}function hl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function cl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Ko(i,n);const o=Uo(t,r,i);return Wo(new e(o,s,a),i),o}}const dl=cl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ul=cl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:hl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function pl(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}class gl extends ho{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([po.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([po.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([po.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([po.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([po.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([po.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([po.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([po.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([po.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[po.M]=t=>`M${t[1]} ${t[2]}`,t[po.L]=t=>`L${t[1]} ${t[2]}`,t[po.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[po.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[po.A]=t=>{const e=[];Bo(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[po.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tyo){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Lo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===To.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.y-e.p1.y)}if(this.direction===To.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Lt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const ml=["l",0,0,0,0,0,0,0];function fl(t,e,i){const s=ml[0]=t[0];if("a"===s||"A"===s)ml[1]=e*t[1],ml[2]=i*t[2],ml[3]=t[3],ml[4]=t[4],ml[5]=t[5],ml[6]=e*t[6],ml[7]=i*t[7];else if("h"===s||"H"===s)ml[1]=e*t[1];else if("v"===s||"V"===s)ml[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Rl=Object.assign(Object.assign({},kl),{points:[],cornerRadius:0,closePath:!0}),Ll=Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ol=Object.assign(Object.assign({},kl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},kl),xl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dl=Object.assign(Object.assign(Object.assign({},kl),xl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kl),{fill:!0,cornerRadius:0}),jl=Object.assign(Object.assign({},Fl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const zl=new class{},Hl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Nl=!0,Vl=!1,Gl=/\w|\(|\)|-/,Wl=/[.?!,;:/,。?!、;:]/,Ul=/\S/;function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=zl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Kl(t,a)),a}function Kl(t,e){let i=e;for(;Gl.test(t[i-1])&&Gl.test(t[i])||Wl.test(t[i]);)if(i--,i<=0)return e;return i}function Xl(t,e){const i=zl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var $l=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Il.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Kl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Kl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=$l([Oa()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Oa()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Fa,this.options=e,this.id=ba.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ua}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,Sa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wa(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new $a(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Aa],multiInject:s[ka]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case ja:case Na:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Da&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,zl.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-xh&&txh||t<-xh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Rt)<0&&(t+=Rt),t}function fh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Ah=[-1,-1,-1],kh=[-1,-1];function Mh(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Th(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Ah);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Ah);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ah[0]=-l,Ah[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=Ah[0]+t&&a<=Ah[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=Ah[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=fh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Bh[0]=S,Bh[1]=A,Ph(Bh,Boolean(a[6])),S=Bh[0],A=Bh[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case po.M:u=f,p=v,c=u,d=p;break;case po.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=fh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case po.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=fh(c,d,o,l,s,n),i){if(yh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ch(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case po.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=fh(o,p,o,l,s,n),h+=fh(u,l,u,p,s,n);break;case po.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=fh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new to(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=zl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Oh([Oa(),Ih("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=zl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Lh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:xl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Qe(Object.assign({defaultFontParams:{fontFamily:xl.fontFamily,fontSize:xl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Oa(),Nh(0,Ra(qa)),Nh(0,Ia(Jl)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new oe;let Uh=class{constructor(){this.matrix=new oe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Oa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:Ml,area:Tl,circle:wl,line:Pl,path:Bl,symbol:Ol,text:Il,rect:Ll,polygon:Rl,richtext:Dl,richtextIcon:jl,image:Fl,group:Cl,glyph:El},Kh=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const $h={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Kh.forEach((t=>{this._defaultTheme[t]=Object.create($h[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Kh.forEach((s=>{const n=Object.create($h[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Kh.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ba.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class uc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{static Avaliable(){return!!zl.global.getRequestAnimationFrame()}avaliable(){return gc.Avaliable()}tick(t,e){zl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var mc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(mc||(mc={}));class fc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-fc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*fc.bounceIn(2*t):.5*fc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}fc.quadIn=fc.getPowIn(2),fc.quadOut=fc.getPowOut(2),fc.quadInOut=fc.getPowInOut(2),fc.cubicIn=fc.getPowIn(3),fc.cubicOut=fc.getPowOut(3),fc.cubicInOut=fc.getPowInOut(3),fc.quartIn=fc.getPowIn(4),fc.quartOut=fc.getPowOut(4),fc.quartInOut=fc.getPowInOut(4),fc.quintIn=fc.getPowIn(5),fc.quintOut=fc.getPowOut(5),fc.quintInOut=fc.getPowInOut(5),fc.backIn=fc.getBackIn(1.7),fc.backOut=fc.getBackOut(1.7),fc.backInOut=fc.getBackInOut(1.7),fc.elasticIn=fc.getElasticIn(1,.3),fc.elasticOut=fc.getElasticOut(1,.3),fc.elasticInOut=fc.getElasticInOut(1,.3*1.5);class vc{constructor(){this.id=ba.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ao.END?this.removeAnimate(e):e.status===Ao.RUNNING||e.status===Ao.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ao.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const _c=new vc;class yc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class bc extends yc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let xc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ba.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new Sc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&ko.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:So.ANIMATE_PLAY})}runCb(t){const e=new bc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===Ao.RUNNING&&(this.status=Ao.PAUSED)}resume(){this.status===Ao.PAUSED&&(this.status=Ao.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Sc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ao.RUNNING&&(this.status=Ao.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ao.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};xc.mode=ko.NORMAL,xc.interpolateMap=new Map;class Sc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Ac(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?fc[i]:i,n=this._addStep(e,null,s);return n.type=Mo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?fc[i]:i,r=this._addStep(e,null,n);return r.type=Mo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=Mo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Mo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Ac(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Ac{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Mc="cubicOut",Tc=1e3,wc="quadInOut";var Cc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Cc||(Cc={}));const Ec=[!1,!1,!1,!1],Pc=[0,0,0,0],Bc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Pc[0]=t[0],Pc[2]=t[0],Pc[1]=t[1],Pc[3]=t[1],Pc):t:t:0,Rc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Lc=[1,2,3,0,1,2,3,0];function Oc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Rc[0].x=i,Rc[1].y=i,Rc[2].x=-i,Rc[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(It(t)*i,jt(t)*i),s.add(It(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:zc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}zc.TimeOut=1e3/60;const Hc=new zc,Nc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Vc extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Yt(this.fromNumber),Yt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Gc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Gc||(Gc={}));class Wc extends yc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Ic(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Uc extends yc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:So.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:So.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Yc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=zl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Kc extends Uc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=zl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Xc extends yc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class $c extends yc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?fc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function qc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Zc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{pt(e,s)&&pt(i,n)||t.push(e,i,s,n,s,n)};function sd(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function nd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function od(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),cd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},dd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Jt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return cd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return cd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);dd(n[0],s,i),dd(n[1],e-s,i)}};var ud;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ud||(ud={}));class pd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ud.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ud.Color1){const e=pd.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=_e.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];pd.store1[t]=e,pd.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=pd.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=_e.parseColorString(t);return n&&(pd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],pd.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===ud.Color1){if(pd.store1[t])return;pd.store1[t]=i,pd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(pd.store255[t])return;pd.store255[t]=i,pd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function gd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function md(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>fd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):fd(t,e,i,s,n)}function fd(t,e,i,s,n){if(!t||!e)return t&&gd(t)||e&&gd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=pd.Get(t,ud.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=pd.Get(e,ud.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:gd(a)})))});return o?md(r,l,i,s,n):md(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:yd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),gd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}pd.store255={},pd.store1={};const vd=[0,0,0,0],_d=[0,0,0,0];function yd(t,e,i){return pd.Get(t,ud.Color255,vd),pd.Get(e,ud.Color255,_d),`rgba(${Math.round(vd[0]+(_d[0]-vd[0])*i)},${Math.round(vd[1]+(_d[1]-vd[1])*i)},${Math.round(vd[2]+(_d[2]-vd[2])*i)},${vd[3]+(_d[3]-vd[3])*i})`}const bd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=md(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},xd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?sd(t):[],n=sd(e);i&&s&&(i.fromTransform&&nd(s,i.fromTransform.clone().getInverse()),nd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Ad=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],kd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Ad.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?pd.Get(t[n],ud.Color255):t[n],to:"string"==typeof r?pd.Get(r,ud.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class Md extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;xd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&bd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Td=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Sd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=kd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new Md({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Tc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wc)),c};class wd extends yc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;xd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&bd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Cd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Fc.includes(t))(i)||(e[i]=t[i])})),e},Ed=(t,e,i)=>{const s=Cd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=zl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Pd=(t,e,i)=>{const s=[],n=i?null:Cd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Cd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ad(t.attribute),n=od(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(zl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=od(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=od(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(zl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ld(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ld(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(zl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:hd(i)}];const s=[];return dd(i,e,s),s})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return dd(r,e,h),h})(t,e).forEach((t=>{s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=sd(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(zl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(zl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Ed(t,s,e),s};class Rd{static GetImage(t,e){var i;const s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Rd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Rd.cache.get(t);s?"fail"===s.loadState?zl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Rd.cache.set(t,s),s.dataPromise=zl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Rd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Rd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=zl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=zl.global.loadBlob(t):"json"===e&&(i.dataPromise=zl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Rd.isLoading&&Rd.toLoadAueue.length){Rd.isLoading=!0;const t=Rd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Rd.cache.set(i,n),n.dataPromise=zl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()})).catch((t=>{console.error(t),Rd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Rd.loading()}))}}),0)}static loadImage(t,e){const i=Ld(t,Rd.toLoadAueue);if(-1!==i)return Rd.toLoadAueue[i].marks.push(e),void Rd.loading();Rd.toLoadAueue.push({url:t,marks:[e]}),Rd.loading()}static improveImageLoading(t){const e=Ld(t,Rd.toLoadAueue);if(-1!==e){const t=Rd.toLoadAueue.splice(e,1);Rd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ld(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Qt,this._updateTag=bo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Hd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Hd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Hd.x=n,Hd.y=r;return Hd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new oe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&bo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===xo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Dd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(zl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Mc),c&&this.setAttributes(c,!1,{type:So.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:So.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bo.UPDATE_SHAPE_AND_BOUNDS)===bo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=bo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=bo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&bo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,scaleX:i=vl.scaleX,scaleY:s=vl.scaleY,angle:n=vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=It(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),zl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Od.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:So.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=md(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=md(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Jh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:zl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new gl).fromString(t):this.pathProxy=new gl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",zl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Vd.mixin(hc);class Gd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Wd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Yd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Kd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Wd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Gd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Xd(t,e){return $d(t)}function $d(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let eu=0;function iu(){return eu++}var su;function nu(t){const e=[];let i=0,s="";for(let n=0;nru.set(t,!0)));const au=new Map;function ou(t){if(ru.has(t))return!0;if(au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>au.set(t,!0)));const lu=iu(),hu=iu(),cu=iu(),du=iu(),uu=iu(),pu=iu(),gu=iu(),mu=iu(),fu=iu(),vu=iu();iu();const _u=iu();iu();const yu=iu(),bu=iu(),xu=iu(),Su=Symbol.for("GraphicService"),Au=Symbol.for("GraphicCreator"),ku={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Mu=Object.keys(ku);var Tu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tu||(Tu={}));let wu=class t extends Vd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=pu,this._childUpdateTag=bo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&bo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;zl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),zl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=vl.x,y:e=vl.y,dx:i=vl.dx,dy:s=vl.dy,scaleX:n=vl.scaleX,scaleY:r=vl.scaleY,angle:a=vl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Jh(this).group;this._AABBBounds.clear();const i=zl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Bc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bo.CLEAR_BOUNDS,this._childUpdateTag&=bo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bo.UPDATE_BOUNDS||(this._childUpdateTag|=bo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),zl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),zl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,zl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{zl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),zl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&bo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=zl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cu(t){return new wu(t)}wu.NOWORK_ANIMATE_ATTR=Nd;class Eu extends wu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{zl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Pu=Symbol.for("TransformUtil"),Bu=Symbol.for("GraphicUtil"),Ru=Symbol.for("LayerService"),Lu=Symbol.for("StaticLayerHandlerContribution"),Ou=Symbol.for("DynamicLayerHandlerContribution"),Iu=Symbol.for("VirtualLayerHandlerContribution");var Du,Fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zu=Du=class{static GenerateLayerId(){return`${Du.idprefix}_${Du.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=zl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(Lu):"dynamic"===t?th.get(Ou):th.get(Iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Eu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Du.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};zu.idprefix="visactor_layer",zu.prefix_count=0,zu=Du=Fu([Oa(),ju("design:paramtypes",[])],zu);var Hu=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Dh).to(jh),t(Bu).to(Vh).inSingletonScope(),t(Pu).to(Uh).inSingletonScope(),t(Ru).to(zu).inSingletonScope()}));function Nu(t,e){return!(!t&&!e)}function Vu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Gu(t,e,i){return i&&t*e>0}function Wu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Uu(t,e){return t*e>0}function Yu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Ku(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $u(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Lt(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*It(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*It(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*It(f),P=n*jt(f),B=r*It(_),R=r*jt(_);let L,O,I,D;if((T>Ct||M>Ct)&&(L=n*It(v),O=n*jt(v),I=r*It(b),D=r*jt(b),hCt){const t=Ft(x,w),r=Ft(S,w),o=Xu(I,D,E,P,n,t,Number(c)),l=Xu(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,n,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*It(Ot(l.y01,l.x01)),s+l.cy+r*jt(Ot(l.y01,l.x01))):e.moveTo(i+L,s+n*jt(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*It(v),s+n*jt(v));if(!(r>Ct)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>Ct){const t=Ft(k,C),n=Ft(A,C),o=Xu(B,R,L,O,r,-n,Number(c)),l=Xu(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Ot(o.y01,o.x01),Ot(o.y11,o.x11),!c),e.arc(i,s,r,Ot(o.cy+o.y11,o.cx+o.x11),Ot(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ot(l.y11,l.x11),Ot(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*It(Ot(l.y01,l.x01)),s+l.cy+t*jt(Ot(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*It(b),s+r*jt(b))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class qu{static GetCanvas(){try{return qu.canvas||(qu.canvas=zl.global.createCanvas({})),qu.canvas}catch(t){return null}}static GetCtx(){if(!qu.ctx){const t=qu.GetCanvas();qu.ctx=t.getContext("2d")}return qu.ctx}}class Zu extends le{static getInstance(){return Zu._instance||(Zu._instance=new Zu),Zu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=qu.GetCanvas(),s=qu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Zu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ju{static GetSize(t){for(let e=0;e=t)return Ju.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ju.GenKey(t,e,i,s,n),l=Ju.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ju.GenKey(t,e,i,s,n);Ju.cache[l]?Ju.cache[l].push({width:a,height:o,pattern:r}):Ju.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ju.cache={},Ju.ImageSize=[20,40,80,160,320,640,1280,2560];const Qu=Symbol.for("ArcRenderContribution"),tp=Symbol.for("AreaRenderContribution"),ep=Symbol.for("CircleRenderContribution"),ip=Symbol.for("GroupRenderContribution"),sp=Symbol.for("ImageRenderContribution"),np=Symbol.for("PathRenderContribution"),rp=Symbol.for("PolygonRenderContribution"),ap=Symbol.for("RectRenderContribution"),op=Symbol.for("SymbolRenderContribution"),lp=Symbol.for("TextRenderContribution"),hp=Symbol.for("InteractiveSubRenderContribution"),cp=["radius","startAngle","endAngle",...Dd];class dp extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=du}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Jh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateCircleAABBBounds(i,Jh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,cp)}needUpdateTag(t){return super.needUpdateTag(t,cp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new gl;return o.arc(0,0,n,r,a),o}clone(){return new dp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function up(t){return new dp(t)}function pp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function gp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function mp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}dp.NOWORK_ANIMATE_ATTR=Nd;class fp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=xu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Jh(this).text;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Jh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Nc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=zl.graphicUtil.textMeasure,k=new fp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===su.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=gp(x,o),M=mp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Jh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Nc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=zl.graphicUtil.textMeasure,y=new fp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Jh(this).text,a=zl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Nc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=gp(x,o),e=this.cache.verticalList.length*b,i=mp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>nu(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===su.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const k=gp(x,o),M=this.cache.verticalList.length*b,T=mp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yp(t){return new _p(t)}_p.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Nd),_p.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_p.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class bp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function xp(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Sp=new class extends bp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return xp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return xp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Ap=new class extends bp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function kp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Mp=new class extends bp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return kp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return kp(t,e/2+n,i,s,r)}};function Tp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var wp=new class extends bp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Tp(t,e/2+n,i,s)}};class Cp extends bp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Ep=new Cp;var Pp=new class extends Cp{constructor(){super(...arguments),this.type="triangle"}};const Bp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Rp=Math.sin(Bt/10)*Bp,Lp=-Math.cos(Bt/10)*Bp;function Op(t,e,i,s){const n=Rp*e,r=Lp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Ip=new class extends bp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};const Dp=zt(3);function Fp(t,e,i,s){const n=e,r=n/Dp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var jp=new class extends bp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Fp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Fp(t,e/2+n,i,s)}};function zp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Hp=new class extends bp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return zp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return zp(t,e/2+n,i,s)}};function Np(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Vp=new class extends bp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};const Gp=-.5,Wp=zt(3)/2,Up=1/zt(12);function Yp(t,e,i,s){const n=e/2,r=e*Up,a=n,o=e*Up+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Gp*n-Wp*r+i,Wp*n+Gp*r+s),t.lineTo(Gp*a-Wp*o+i,Wp*a+Gp*o+s),t.lineTo(Gp*l-Wp*h+i,Wp*l+Gp*h+s),t.lineTo(Gp*n+Wp*r+i,Gp*r-Wp*n+s),t.lineTo(Gp*a+Wp*o+i,Gp*o-Wp*a+s),t.lineTo(Gp*l+Wp*h+i,Gp*h-Wp*l+s),t.closePath(),!1}var Kp=new class extends bp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Yp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Yp(t,e/2+n,i,s)}};var Xp=new class extends bp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends bp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var qp=new class extends bp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Zp=zt(3);function Jp(t,e,i,s){const n=e*Zp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Qp=new class extends Cp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Jp(t,e/2/Zp,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/2/Zp+n,i,s)}};function tg(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var eg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return tg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return tg(t,e/4+n,i,s)}};function ig(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var sg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return ig(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ig(t,e/4+n,i,s)}};function ng(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var rg=new class extends bp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return ng(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ng(t,e/4+n,i,s)}};function ag(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var og=new class extends bp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ag(t,e/4,i,s)}drawOffset(t,e,i,s,n){return ag(t,e/4+n,i,s)}};function lg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var hg=new class extends bp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return lg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return lg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function cg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var dg=new class extends bp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return cg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return cg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function ug(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var pg=new class extends bp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return ug(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ug(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function gg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function mg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var fg=new class extends bp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?mg(t,e,i,s):gg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?mg(t,e+2*n,i,s):gg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const vg=new Qt;class _g{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Lo(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Lo(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;vg.x1=s.bounds.x1*t,vg.y1=s.bounds.y1*t,vg.x2=s.bounds.x2*t,vg.y2=s.bounds.y2*t,e.union(vg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const yg={};[Sp,Ap,Mp,wp,Qp,Pp,Ip,jp,Hp,Vp,Kp,Xp,$p,Ep,qp,eg,sg,rg,og,fg,hg,dg,pg].forEach((t=>{yg[t.type]=t}));const bg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},xg=new Qt,Sg=["symbolType","size",...Dd];let Ag=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Jh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=yg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=bg[i]||i,!0===((n=i).startsWith("{const e=(new gl).fromString(t.d),i={};Mu.forEach((e=>{t[e]&&(i[ku[e]]=t[e])})),r.push({path:e,attribute:i}),xg.union(e.bounds)}));const a=xg.width(),o=xg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new _g(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new gl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new _g(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Jh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateSymbolAABBBounds(i,Jh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new gl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new gl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.userSymbolMap={},Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Nd);const Mg=["segments","points","curveType","curveTension",...Dd];let Tg=class t extends Vd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=mu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}doUpdateAABBBounds(){const t=Jh(this).line;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateLineAABBBounds(e,Jh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.attribute,e=new gl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const Cg=["width","x1","y1","height","cornerRadius",...Dd];class Eg extends Vd{constructor(t){super(t),this.type="rect",this.numberType=_u}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Jh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRectAABBBounds(e,Jh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ad(t),r=new gl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Nd;class Bg extends Vd{constructor(t){super(t),this.type="glyph",this.numberType=uu,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=zl.graphicService.updateGlyphAABBBounds(this.attribute,Jh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Bg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Nd;class Lg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Hl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Og{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Nc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Vl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Nl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Ig=["width","height","image",...Dd];class Dg extends Vd{constructor(t){super(t),this.type="image",this.numberType=gu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Jh(this).image;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateImageAABBBounds(e,Jh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Fl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ig)}needUpdateTag(t){return super.needUpdateTag(t,Ig)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Nd);class jg extends Dg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Bc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Bc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Fl.width,height:e=Fl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class zg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Hl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Ul.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof jg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Xl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof jg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Hl[this.direction]}store(t){if(t instanceof jg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new zg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof jg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character),new Og(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...Dd];class Vg extends Vd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Jh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateRichTextAABBBounds(e,Jh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Lg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Hg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;const o=e.AABBBounds.clone();o.translate(e._marginArray[3],e._marginArray[0]),o.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i+e._marginArray[3],n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Nd);const Wg=["path","customPath",...Dd];class Ug extends Vd{constructor(t){super(t),this.type="path",this.numberType=fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Jh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof gl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof gl?this.cache:t.path)}doUpdateAABBBounds(){const t=Jh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePathAABBBounds(e,Jh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new gl).fromString(t.path):t.customPath&&(this.cache=new gl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Jh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}toCustomPath(){return(new gl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Nd);const Kg=["segments","points","curveType","curveTension",...Dd];class Xg extends Vd{constructor(t){super(t),this.type="area",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Jh(this).area;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updateAreaAABBBounds(e,Jh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){const t=new gl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Nd);const qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Dd];class Zg extends Vd{constructor(t){super(t),this.type="arc",this.numberType=lu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Jh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Jh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ie(e),i=e+r,s&&Lt(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Jh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Lt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Vt(Number(l)/o*jt(g)),n=Vt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Jh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=zl.graphicService.updateArcAABBBounds(i,Jh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Bc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}getDefaultAttribute(t){return Jh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Lt(i-e),a=i>e;if(n=Rt-Ct)o.moveTo(0+n*It(e),0+n*jt(e)),o.arc(0,0,n,e,i,!a),s>Ct&&(o.moveTo(0+s*It(i),0+s*jt(i)),o.arc(0,0,s,i,e,a));else{const t=n*It(e),r=n*jt(e),l=s*It(i),h=s*jt(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Nd);const Qg=["points","cornerRadius",...Dd];class tm extends Vd{constructor(t){super(t),this.type="polygon",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Jh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=zl.graphicService.updatePolygonAABBBounds(e,Jh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Bc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Dc(i,s,e))}getDefaultAttribute(t){return Jh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){const t=this.attribute.points,e=new gl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new tm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tm.NOWORK_ANIMATE_ATTR}}function em(t){return new tm(t)}tm.NOWORK_ANIMATE_ATTR=Nd;class im extends wu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function sm(t){return new im(t)}class nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class rm extends nm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;tu(i,s+(r+o)/2,!0,a)}return i}}class am{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return am.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};function um(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function pm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function gm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),um(t,t,[n+o,r+l,a+h]),um(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),um(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=lm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}um(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),um(i,i,[-s[0],-s[1],0]),gm(t,t,i)}}let fm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new to(["graphic"]),onSetStage:new to(["graphic","stage"]),onRemove:new to(["graphic"]),onRelease:new to(["graphic"]),onAddIncremental:new to(["graphic","group","stage"]),onClearIncremental:new to(["graphic","group","stage"]),beforeUpdateAABBBounds:new to(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new to(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Qt,this.tempAABBBounds2=new Qt,this._rectBoundsContribitions=[new nm],this._symbolBoundsContribitions=[new rm],this._imageBoundsContribitions=[new nm],this._circleBoundsContribitions=[new nm],this._arcBoundsContribitions=[new nm],this._pathBoundsContribitions=[new nm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new lo(t);return Lo(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=mp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=gp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){tu(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Zt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Rt-Ct?i.set(-a,-a,a,a):Oc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=Ct?i.set(0,0,0,0):Math.abs(l-h)>Rt-Ct?i.set(-n,-n,n,n):(Oc(h,l,n,i),Oc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){tu(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;tu(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Zt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};fm=hm([Oa(),dm(0,Ra(Au)),cm("design:paramtypes",[Object])],fm);const vm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let _m,ym;function bm(t){return _m||(_m=vm.CreateGraphic("text",{})),_m.initAttributes(t),_m.AABBBounds}const xm={x:0,y:0,z:0,lastModelMatrix:null};class Sm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Co.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Gu(o,l,n),p=Uu(o,c),g=Nu(n,r),m=Vu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;xm.x=n,xm.y=r,xm.z=a,xm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=lm.allocate(),n=lm.allocate();mm(n,t,e),gm(s,d||s,n),xm.x=0,xm.y=0,xm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),lm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,xm.z=a,i.setTransformForCurrent()}else if(p)xm.x=0,xm.y=0,xm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);xm.x+=s.x,xm.y+=s.y,this.transformWithoutTranslate(i,xm.x,xm.y,xm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),xm.x=0,xm.y=0,xm.z=0;return xm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Gu(d,u,h),y=Uu(d,g),b=Nu(h),x=Vu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Lo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&lm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Am=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class km{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(km.IsGradientStr(t))try{const e=Am(t)[0];if(e){if("linear"===e.type)return km.ParseLinear(e);if("radial"===e.type)return km.ParseRadial(e);if("conic"===e.type)return km.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Mm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};class Pm{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Lh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Lh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Bm=new Pm;let Rm=class{constructor(t){this.subRenderContribitions=t,this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Rm=wm([Oa(),Em(0,Ra(qa)),Em(0,Ia(hp)),Cm("design:paramtypes",[Object])],Rm);class Lm{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Lh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Lh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Om=new Lm;const Im=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),$u(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),$u(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Dm=Om,Fm=Bm;const jm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},zm=Om,Hm=Bm;const Nm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Vm=Et/2;function Gm(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Lt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Lt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Lt(t[0]),i=Lt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Lt(o[0]),o[1]=Lt(o[1]),o[2]=Lt(o[2]),o[3]=Lt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-Vm,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,Vm,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Vm,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+Vm,!1)}return!a&&t.closePath(),t}var Wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Um{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=Mm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Gm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=Mm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Gm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Ym=class{constructor(){this.time=Co.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ym=Wm([Oa()],Ym);let Km=class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Gm(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Km=Wm([Oa()],Km);const Xm=new Um,$m=Om,qm=Bm;const Zm=new class extends Um{constructor(){super(...arguments),this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Jm=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Bc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Gm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Qm=new class{constructor(){this.time=Co.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=Mm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},tf=Om,ef=Bm;var sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rf=function(t,e){return function(i,s){e(i,s,t)}};let af=class extends Sm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=lu,this.builtinContributions=[Im,Fm,Dm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Lt(d-c),p=d>c;let g=!1;if(nCt||C>Ct)&&(D=n*It(x),F=n*jt(x),j=r*It(A),z=r*jt(A),uCt){const t=Ft(k,P),r=Ft(M,P),a=Xu(j,z,R,L,n,t,Number(p)),o=Xu(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>Ct)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>Ct){const t=Ft(w,B),n=Ft(T,B),a=Xu(O,I,D,F,r,-n,Number(p)),o=Xu(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Ot(a.y01,a.x01),Ot(a.y11,a.x11),!p);const t=Ot(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*It(A),s+r*jt(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Lt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Ec[s]=t,i&&(i=!(null!==(e=Ec[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ec[e]=!!t[e],i&&(i=!!Ec[e]);else Ec[0]=!1,Ec[1]=!1,Ec[2]=!1,Ec[3]=!1;return{isFullStroke:i,stroke:Ec}})(d);if((v||C)&&(e.beginPath(),$u(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),$u(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Lt(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),md(o.color,l.color,h,!1)}(0,0,h,n);a||Gu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};af=sf([Oa(),rf(0,Ra(qa)),rf(0,Ia(Qu)),nf("design:paramtypes",[Object])],af);var of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(i,s){e(i,s,t)}};let cf=class extends Sm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=du,this.builtinContributions=[jm,Hm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function df(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=jo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function uf(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),df(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=To.ROW:"y"===s?m=To.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gf=class extends Sm{constructor(){super(...arguments),this.numberType=mu}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),uf(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=pl(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function mf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function ff(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),df(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),df(t,l,1,s),o=!1):o=!0}t.closePath()}gf=pf([Oa()],gf);const vf=new class extends Lm{constructor(){super(...arguments),this.time=Co.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:jc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:jc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},_f=Bm;var yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xf=function(t,e){return function(i,s){e(i,s,t)}};function Sf(t,e,i){var s,n;switch(e){case"linear":default:return Ko(t,i);case"basis":return qo(t,i);case"monotoneX":return sl(t,i);case"monotoneY":return nl(t,i);case"step":return al(t,.5,i);case"stepBefore":return al(t,0,i);case"stepAfter":return al(t,1,i);case"catmullRom":return dl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ul(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ll(t,i)}}let Af=class extends Sm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=cu,this.builtinContributions=[vf,_f],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Sf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Sf(e,C,{curveTension:b}),n=Sf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=To.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Lt(E.x-P.x),L=Lt(E.y-P.y);B=null==E.x1?To.ROW:null==E.y1?To.COLUMN:Number.isFinite(R+L)?R>L?To.ROW:To.COLUMN:To.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),mf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),mf(t,e,i,s),e.length=0,i.length=0)}n=o})),mf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?To.ROW:To.COLUMN,Number.isFinite(u)||(h=To.COLUMN),Number.isFinite(p)||(h=To.ROW);const g=i*(h===To.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Sm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Mf,kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Lo(t.pathShape.commandList,e,i,s,1,1,g);else{Lo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(np)),wf("design:paramtypes",[Object])],Ef);var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rf=function(t,e){return function(i,s){e(i,s,t)}};let Lf=class extends Sm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=_u,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Wu(g,m,k,M,c),w=Yu(g,v,k,M),C=Nu(c,d),E=Vu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Gm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(ap)),Bf("design:paramtypes",[Object])],Lf);var Of=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Df=function(t,e){return function(i,s){e(i,s,t)}};let Ff=class extends Sm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bu,this.builtinContributions=[Qm,ef,tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Ff=Of([Oa(),Df(0,Ra(qa)),Df(0,Ia(op)),If("design:paramtypes",[Object])],Ff);const jf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Qt)}allocate(t,e,i,s){if(!this.pools.length)return(new Qt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Qt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const zf=new class extends Pm{constructor(){super(...arguments),this.time=Co.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=jf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=bm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Gm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&jf.free(C),w()}};var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Sm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xu,this.builtinContributions=[zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Nc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=om.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),om.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=gp(l,f),_=mp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=mp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Wf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Sm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=vu,this.builtinContributions=[Xf,Kf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Wf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Wf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Uf(d,u),b=Uf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Yf(h,_,y,d,u),A=Yf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Uf(k,M),w=Yf(h,Uf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Jf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(rp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,s){e(i,s,t)}};let iv=class{constructor(t){this.groupRenderContribitions=t,this.numberType=pu}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Wu(u,f,p,g,h),k=Yu(u,v,p,g),M=Nu(h,c),T=Vu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Gm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Nm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===Co.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===Co.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=lm.allocate(),i=lm.allocate();mm(i,t,l),gm(e,h||e,i),n.modelMatrix=e,lm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&lm.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};iv=Qf([Oa(),ev(0,Ra(qa)),ev(0,Ia(ip)),tv("design:paramtypes",[Object])],iv);var sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,s){e(i,s,t)}};const av=["","repeat-x","repeat-y","repeat"];let ov=class extends Sm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=gu,this.builtinContributions=[Zm,Jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Gm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,av[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Rd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};ov=sv([Oa(),rv(0,Ra(qa)),rv(0,Ia(sp)),nv("design:paramtypes",[Object])],ov);const lv=Symbol.for("IncrementalDrawContribution"),hv=Symbol.for("ArcRender"),cv=Symbol.for("AreaRender"),dv=Symbol.for("CircleRender"),uv=Symbol.for("GraphicRender"),pv=Symbol.for("GroupRender"),gv=Symbol.for("LineRender"),mv=Symbol.for("PathRender"),fv=Symbol.for("PolygonRender"),vv=Symbol.for("RectRender"),_v=Symbol.for("SymbolRender"),yv=Symbol.for("TextRender"),bv=Symbol.for("RichTextRender"),xv=Symbol.for("GlyphRender"),Sv=Symbol.for("ImageRender"),Av=Symbol.for("DrawContribution");var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tv=Symbol.for("DrawItemInterceptor"),wv=new Qt,Cv=new Qt;class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){wv.copy(s.dirtyBounds),Cv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,om.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(wv),s.backupDirtyBounds.copy(Cv)),!0}}class Pv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Bv=class{constructor(){this.order=1,this.interceptors=[new Ev,new Lv,new Rv,new Pv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===hu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&lm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};const Fv=Symbol.for("RenderService");let jv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};jv=Ov([Oa(),Dv(0,Ra(Av)),Iv("design:paramtypes",[Object])],jv);var zv=new xa((t=>{t(Fv).to(jv)}));const Hv=Symbol.for("PickerService"),Nv=Symbol.for("GlobalPickerService");var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Gv=Symbol.for("PickItemInterceptor");let Wv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=om.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Wv=Vv([Oa()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Uv=Vv([Oa()],Uv);let Yv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===hu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Yv=Vv([Oa()],Yv);var Kv=new xa(((t,e,i)=>{i(Hv)||(t(Nv).toSelf(),t(Hv).toService(Nv)),t(Yv).toSelf().inSingletonScope(),t(Gv).toService(Yv),t(Wv).toSelf().inSingletonScope(),t(Gv).toService(Wv),t(Uv).toSelf().inSingletonScope(),t(Gv).toService(Uv),Ja(t,Gv)})),Xv=new xa((t=>{t(Su).to(fm).inSingletonScope(),t(Au).toConstantValue(vm)}));const $v=Symbol.for("AutoEnablePlugins"),qv=Symbol.for("PluginService");var Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qv=function(t,e){return function(i,s){e(i,s,t)}};let t_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound($v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};t_=Zv([Oa(),Qv(0,Ra(qa)),Qv(0,Ia($v)),Jv("design:paramtypes",[Object])],t_);var e_=new xa((t=>{t(qv).to(t_),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,$v)})),i_=new xa((t=>{Ja(t,eo)})),s_=new xa((t=>{t(Jl).to(Ql).inSingletonScope(),Ja(t,Jl)})),n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let a_=class{constructor(){this.type="static",this.offscreen=!1,this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};a_=n_([Oa(),r_("design:paramtypes",[])],a_);var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let h_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=zl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};h_=o_([Oa(),l_("design:paramtypes",[])],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let u_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=zl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=sh({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};u_=c_([Oa(),d_("design:paramtypes",[])],u_);var p_=new xa((t=>{t(a_).toSelf(),t(u_).toSelf(),t(h_).toSelf(),t(Lu).toService(a_),t(Ou).toService(u_),t(Iu).toService(h_)}));var g_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function m_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return g_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function v_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var __=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},b_=function(t,e){return function(i,s){e(i,s,t)}};let x_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Jt,this.backupDirtyBounds=new Jt,this.global=zl.global,this.layerService=zl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,om.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=v_(e,i,kl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ie(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=jf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=om.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):m_(t,kl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),jf.free(n),om.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(lv);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let A_=class extends gf{constructor(){super(...arguments),this.numberType=mu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Gu(u,p,c),_=Uu(u,g),y=Nu(c),b=Vu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};A_=S_([Oa()],A_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let M_=class extends Af{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Gu(u,d,c),m=Nu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};M_=k_([Oa()],M_);var T_,w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},C_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},E_=function(t,e){return function(i,s){e(i,s,t)}},P_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(T_||(T_={}));let B_=class extends x_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=T_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new to([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return P_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return P_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return P_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){if(2!==t.count)yield f_(t,kl.zIndex,((i,s)=>{if(this.status===T_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return P_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return P_(this,void 0,void 0,(function*(){this.rendering&&(this.status=T_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=T_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return P_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>P_(this,void 0,void 0,(function*(){yield f_(t,kl.zIndex,(t=>P_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};B_=w_([Oa(),E_(0,La(uv)),E_(1,Ra(A_)),E_(2,Ra(M_)),E_(3,Ra(qa)),E_(3,Ia(Tv)),C_("design:paramtypes",[Array,Object,Object,Object])],B_);var R_=new xa((t=>{t(Pm).toSelf().inSingletonScope(),t(Lm).toSelf().inSingletonScope(),t(Av).to(x_),t(lv).to(B_),t(pv).to(iv).inSingletonScope(),t(uv).toService(pv),Ja(t,ip),t(Rm).toSelf().inSingletonScope(),Ja(t,hp),Ja(t,uv),t(Bv).toSelf().inSingletonScope(),t(Tv).toService(Bv),Ja(t,Tv)}));function L_(){L_.__loaded||(L_.__loaded=!0,th.load(Hu),th.load(Xv),th.load(zv),th.load(Kv),th.load(e_),function(t){t.load(i_),t.load(s_),t.load(p_)}(th),function(t){t.load(R_)}(th))}L_.__loaded=!1,L_();const O_=th.get(io);zl.global=O_;const I_=th.get(Bu);zl.graphicUtil=I_;const D_=th.get(Pu);zl.transformUtil=D_;const F_=th.get(Su);zl.graphicService=F_;const j_=th.get(Ru);zl.layerService=j_;class z_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),zl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class H_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class N_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,zl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),zl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){zl.graphicService.hooks.onAddIncremental.taps=zl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onClearIncremental.taps=zl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,zl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class V_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.unTap(this.key),zl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?zl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:zl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=ni(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Jh(t).text)}getTransformOfText(t){const e=Jh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=ti(h,c);o=t.x,l=t.y}const p=zl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));zl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===zl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:kl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&zl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===zl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const G_=new Qt;class W_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(G_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(G_,t.parent&&t.parent.globalTransMatrix)))})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),zl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onRemove.taps=zl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const U_=new Qt;class Y_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ba.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Qt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Jh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,zl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),zl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&U_.copy(s)})),zl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(U_.equals(i)||this.tryLayout(t,!1))})),zl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){zl.graphicService.hooks.onAttributeUpdate.taps=zl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.beforeUpdateAABBBounds.taps=zl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.afterUpdateAABBBounds.taps=zl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),zl.graphicService.hooks.onSetStage.taps=zl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const K_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===mc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=mc.INITIAL,zl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),zl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:gc},{mode:"timeout",cons:pc},{mode:"manual",cons:uc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==mc.INITIAL&&(this.status=mc.PAUSE,!0)}resume(){return this.status!==mc.INITIAL&&(this.status=mc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===mc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===mc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=mc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=mc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};K_.addTimeline(_c),K_.setFPS(60);class X_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=pd.Get(e,ud.Color1),this.ambient=i;const s=zt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Ft(Dt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?pd.Get(e,ud.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function $_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function q_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Z_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=lm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=lm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&zl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ey="white";class iy extends wu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ey}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=zl.global,!this.global.env&&Q_()&&this.global.setEnv("browser"),this.window=th.get(Dh),this.renderService=th.get(Fv),this.pluginService=th.get(qv),this.layerService=th.get(Ru),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ey,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||K_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new vc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new X_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Z_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new H_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new z_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new N_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Jt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new W_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Y_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new V_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new ty))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=th.get(Hv));const i=this.pickerService.pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry=new oe(1,0,0,1,0,0),ay={x:0,y:0};let oy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this.path=new gl,this._clearMatrix=new oe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ay),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,ay.x,ay.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ay);const i=Mm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,ay.x,ay.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ry,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};oy=sy([Oa(),ny("design:paramtypes",[Object,Number])],oy);var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cy={WIDTH:500,HEIGHT:500,DPR:1};let dy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=cy.WIDTH,height:n=cy.HEIGHT,dpr:r=cy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};dy.env="browser",dy=ly([Oa(),hy("design:paramtypes",[Object])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let py=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Qt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};py=uy([Oa()],py);var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fy=class{constructor(){this._uid=ba.GenAutoIncrementId(),this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};fy=gy([Oa(),my("design:paramtypes",[])],fy);var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yy=function(t,e){return function(i,s){e(i,s,t)}};let by=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=zl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Qt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new oe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=lm.allocate();if(pm(i,e),a){if(i){const t=lm.allocate();r.modelMatrix=gm(t,a,i),lm.free(i)}}else pm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&lm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),om.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function xy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&xy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&xy(t,a,i,s,n))}function Sy(t,e){const i=t.length-1,s=[t[0]];return xy(t,0,i,e,s),s.push(t[i]),s}by=vy([Oa(),yy(0,Ra(qa)),yy(0,Ia(Gv)),_y("design:paramtypes",[Object])],by);let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(af).toSelf().inSingletonScope(),t(hv).to(af).inSingletonScope(),t(uv).toService(hv),t(Qu).toService(Rm),Ja(t,Qu))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(Lf).toSelf().inSingletonScope(),t(vv).to(Lf).inSingletonScope(),t(uv).toService(vv),t(Km).toSelf(),t(Ym).toSelf(),t(ap).toService(Km),t(ap).toService(Ym),t(ap).toService(Rm),Ja(t,ap))}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(gf).toSelf().inSingletonScope(),t(A_).toSelf().inSingletonScope(),t(gv).to(gf).inSingletonScope(),t(uv).toService(gv))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(Af).toSelf().inSingletonScope(),t(cv).to(Af).inSingletonScope(),t(uv).toService(cv),t(tp).toService(Rm),Ja(t,tp),t(M_).toSelf().inSingletonScope())}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(Ff).toSelf().inSingletonScope(),t(_v).to(Ff).inSingletonScope(),t(uv).toService(_v),t(op).toService(Rm),Ja(t,op))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(cf).toSelf().inSingletonScope(),t(dv).to(cf).inSingletonScope(),t(uv).toService(dv),t(ep).toService(Rm),Ja(t,ep))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(yv).to(Gf).inSingletonScope(),t(uv).toService(yv),t(lp).toService(Rm),Ja(t,lp))}));let Fy=!1;const jy=new xa((t=>{Fy||(Fy=!0,t(Ef).toSelf().inSingletonScope(),t(mv).to(Ef).inSingletonScope(),t(uv).toService(mv),t(np).toService(Rm),Ja(t,np))}));let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(fv).to(Jf).inSingletonScope(),t(uv).toService(fv),t(rp).toService(Rm),Ja(t,rp))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vy=class{constructor(){this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Vy=Ny([Oa()],Vy);let Gy=!1;const Wy=new xa((t=>{Gy||(Gy=!0,t(xv).to(Vy).inSingletonScope(),t(uv).toService(xv))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=class extends Sm{constructor(){super(),this.numberType=yu,this.builtinContributions=[zf],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Gu(o,l,!0),d=Gu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Gm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};Ky=Uy([Oa(),Yy("design:paramtypes",[])],Ky);let Xy=!1;const $y=new xa((t=>{Xy||(Xy=!0,t(bv).to(Ky).inSingletonScope(),t(uv).toService(bv))}));let qy=!1;const Zy=new xa((t=>{qy||(qy=!0,t(Sv).to(ov).inSingletonScope(),t(uv).toService(Sv),t(sp).toService(Rm),Ja(t,sp))}));const Jy=(t,e)=>(d(tb.warnHandler)&&tb.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Qy=(t,e,i)=>{if(!d(tb.errorHandler))throw new Error(t);tb.errorHandler.call(null,t,e)},tb={silent:!1,warnHandler:!1,errorHandler:!1},eb=Q_(),ib=eb&&globalThis?globalThis.document:void 0;function sb(t){return("desktop-browser"===t||"mobile-browser"===t)&&eb}function nb(t){return rb(t)||"mobile-browser"===t}function rb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let ab=0;function ob(){return ab>=9999999&&(ab=0),ab++}function lb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function hb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const cb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),db=t=>e=>R(e,t),ub=t=>{at.getInstance().error(t)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ub("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ub("Access path missing closing bracket: "+t),a&&ub("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return cb((i&&i.get||db)(s),[n],e||n)},gb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>pb(t,e,i)));return t=>s.map((e=>e(t)))}return pb(t,e,i)};gb("id");const mb=cb((function(t){return t}),[],"identity"),fb=cb((function(){return 0}),[],"zero");cb((function(){return 1}),[],"one"),cb((function(){return!0}),[],"true"),cb((function(){return!1}),[],"false"),cb((function(){return{}}),[],"emptyObject");const vb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>_b(t,r,n)))))},yb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function bb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function xb(t,e,i,s,n){let r=0,a=0;return bb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Sb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;bb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xb(t,e,i,n,h)}}function Ab(t){return"horizontal"===t}function kb(t){return"vertical"===t}const Mb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Tb extends wu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,Mb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Mb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const tx=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},ex=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ix extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||tx(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=ex(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=ex(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=tx(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ac.now()-i>this.config.press.time&&ex(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rx=[0,0,0];let ax=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},_l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},xl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new oe(1,0,0,1,0,0),this._clearMatrix=new oe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new oe(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return om.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(om.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ju.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(q_(rx,[t,e,i],this.modelMatrix),t=rx[0],e=rx[1],i=rx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=zl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:xl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:xl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(q_(rx,[e,i,s],this.modelMatrix),e=rx[0],i=rx[1],s=rx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Tm(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit}=e;r.lineWidth=Mm(this,a,this.dpr),r.strokeStyle=Tm(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=pp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=pp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>om.free(t))),this.stack.length=0}};ax.env="browser",ax=sx([Oa(),nx("design:paramtypes",[Object,Number])],ax);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hx=class extends dy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=zl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ax(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function cx(t,e){return new xa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}hx.env="browser",hx=ox([Oa(),lx("design:paramtypes",[Object])],hx);const dx=cx(hx,ax);var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let mx=class extends by{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Lh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vx=class{constructor(){this.type="group",this.numberType=pu}contains(t,e,i){return!1}};vx=fx([Oa()],vx);const _x=new xa(((t,e,i,s)=>{_x.__vloaded||(_x.__vloaded=!0,t(Zb).to(vx).inSingletonScope(),t(Jb).toService(Zb),Ja(t,Jb))}));_x.__vloaded=!1;var yx=_x;const bx=new xa(((t,e,i,s)=>{i(mx)||t(mx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(mx):t(Hv).toService(mx)}));var xx,Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=xx=class extends fy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${xx.idprefix}_${xx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=zl.global,this.viewBox=new Qt,this.modelMatrix=new oe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:xx.GenerateCanvasId(),canvasControled:!0};this.canvas=new hx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new hx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};kx.env="browser",kx.idprefix="visactor_window",kx.prefix_count=0,kx=xx=Sx([Oa(),Ax("design:paramtypes",[])],kx);const Mx=new xa((t=>{t(kx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(kx))).whenTargetNamed(kx.env)}));var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends py{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Qt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ba.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Tx([Oa(),wx("design:paramtypes",[])],Px);const Bx=new xa((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(eo).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(dx),t.load(Mx),e&&function(t){t.load(yx),t.load(bx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ox=class extends ax{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};Ox.env="feishu",Ox=Lx([Oa()],Ox);var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fx=class extends dy{constructor(t){super(t)}init(){this._context=new Ox(this,this._dpr)}release(){}};Fx.env="feishu",Fx=Ix([Oa(),Dx("design:paramtypes",[Object])],Fx);const jx=cx(Fx,Ox);var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};class Vx{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Gx=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new Vx}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fx(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Fx({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Gx.env="feishu",Gx=zx([Oa(),Nx(0,Ra(io)),Hx("design:paramtypes",[Object])],Gx);const Wx=new xa((t=>{t(Gx).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Gx))).whenTargetNamed(Gx.env)}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends by{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new oy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xx=Ux([Oa(),Kx(0,Ra(qa)),Kx(0,Ia(wb)),Kx(1,Ra(qa)),Kx(1,Ia(Gv)),Yx("design:paramtypes",[Object,Object])],Xx);const $x=new xa((t=>{$x.__vloaded||($x.__vloaded=!0,Ja(t,wb))}));$x.__vloaded=!1;var qx=$x,Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([Oa(),Qx(0,Ra(hv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new xa(((t,e,i,s)=>{eS||(eS=!0,t(Cb).to(tS).inSingletonScope(),t(wb).toService(Cb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};aS=sS([Oa(),rS(0,Ra(cv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new xa(((t,e,i,s)=>{oS||(oS=!0,t(Eb).to(aS).inSingletonScope(),t(wb).toService(Eb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([Oa(),dS(0,Ra(dv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new xa(((t,e,i,s)=>{pS||(pS=!0,t(Pb).to(uS).inSingletonScope(),t(wb).toService(Pb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};_S=mS([Oa(),vS(0,Ra(xv)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(jb).to(_S).inSingletonScope(),t(_S).toService(jb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};SS=xS([Oa()],SS);let AS=!1;const kS=new xa(((t,e,i,s)=>{AS||(AS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([Oa(),wS(0,Ra(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new xa(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(wb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OS=BS([Oa(),LS(0,Ra(fv)),RS("design:paramtypes",[Object])],OS);let IS=!1;const DS=new xa(((t,e,i,s)=>{IS||(IS=!0,t(Fb).to(OS).inSingletonScope(),t(wb).toService(Fb))}));var FS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zS=function(t,e){return function(i,s){e(i,s,t)}};let HS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};HS=FS([Oa(),zS(0,Ra(mv)),jS("design:paramtypes",[Object])],HS);let NS=!1;const VS=new xa(((t,e,i,s)=>{NS||(NS=!0,t(Lb).to(HS).inSingletonScope(),t(wb).toService(Lb))}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},US=function(t,e){return function(i,s){e(i,s,t)}};const YS=new Qt;let KS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;YS.setValue(i.x1,i.y1,i.x2,i.y2),YS.expand(-r/2),h=!YS.containsPoint(e)}}return s.highPerformanceRestore(),h}};KS=GS([Oa(),US(0,Ra(vv)),WS("design:paramtypes",[Object])],KS);let XS=!1;const $S=new xa(((t,e,i,s)=>{XS||(XS=!0,t(Ob).to(KS).inSingletonScope(),t(wb).toService(Ob))}));let qS=!1;const ZS=new xa(((t,e,i,s)=>{qS||(qS=!0,t(Bb).to(SS).inSingletonScope(),t(SS).toService(Bb))}));var JS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};eA=JS([Oa(),tA(0,Ra(_v)),QS("design:paramtypes",[Object])],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Ib).to(eA).inSingletonScope(),t(wb).toService(Ib))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class{constructor(){this.type="text",this.numberType=xu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};rA=nA([Oa()],rA);let aA=!1;const oA=new xa(((t,e,i,s)=>{aA||(aA=!0,t(Db).to(rA).inSingletonScope(),t(wb).toService(Db))})),lA=new xa(((t,e,i,s)=>{i(Xx)||t(Xx).toSelf().inSingletonScope(),i(Hv)?s(Hv).toService(Xx):t(Hv).toService(Xx)}));class hA{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uA=class extends py{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new hA(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};uA=cA([Oa(),dA("design:paramtypes",[])],uA);const pA=new xa((t=>{pA.isFeishuBound||(pA.isFeishuBound=!0,t(uA).toSelf().inSingletonScope(),t(eo).toService(uA))}));function gA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];gA.__loaded||(gA.__loaded=!0,t.load(pA),t.load(jx),t.load(Wx),e&&function(t){t.load(qx),t.load(lA),t.load(iS),t.load(lS),t.load(gS),t.load(bS),t.load(kS),t.load(PS),t.load(DS),t.load(VS),t.load($S),t.load(ZS),t.load(sA),t.load(oA)}(t))}pA.isFeishuBound=!1,gA.__loaded=!1;var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends ax{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new oe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vA.env="node",vA=mA([Oa(),fA("design:paramtypes",[Object,Number])],vA);var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bA=class extends dy{constructor(t){super(t)}init(){this._context=new vA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bA.env="node",bA=_A([Oa(),yA("design:paramtypes",[Object])],bA);const xA=cx(bA,vA);var SA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,s){e(i,s,t)}};let MA=class extends fy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ba.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new bA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};MA.env="node",MA=SA([Oa(),kA(0,Ra(io)),AA("design:paramtypes",[Object])],MA);const TA=new xa((t=>{t(MA).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(MA))).whenTargetNamed(MA.env)}));var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CA=class extends py{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Hc.call(t)}}getCancelAnimationFrame(){return t=>{Hc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};CA=wA([Oa()],CA);const EA=new xa((t=>{EA.isNodeBound||(EA.isNodeBound=!0,t(CA).toSelf().inSingletonScope(),t(eo).toService(CA))}));function PA(t){PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(xA),t.load(TA))}EA.isNodeBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=lu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([Oa(),LA(0,Ra(hv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new xa(((t,e,i,s)=>{IA||(IA=!0,t(zb).to(OA).inSingletonScope(),t(Jb).toService(zb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Qt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=_u}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([Oa(),zA(0,Ra(vv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new xa(((t,e,i,s)=>{VA||(VA=!0,t(Ub).to(NA).inSingletonScope(),t(Jb).toService(Ub))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends Sm{};UA=WA([Oa()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Jh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([Oa(),XA(0,Ra(gv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new xa(((t,e,i,s)=>{qA||(qA=!0,t(Gb).to($A).inSingletonScope(),t(Jb).toService(Gb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([Oa(),tk(0,Ra(cv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new xa(((t,e,i,s)=>{ik||(ik=!0,t(Hb).to(ek).inSingletonScope(),t(Jb).toService(Hb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Jh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&lm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([Oa(),ak(0,Ra(_v)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new xa(((t,e,i,s)=>{lk||(lk=!0,t(Yb).to(ok).inSingletonScope(),t(Jb).toService(Yb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([Oa(),uk(0,Ra(dv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new xa(((t,e,i,s)=>{gk||(gk=!0,t(Nb).to(pk).inSingletonScope(),t(Jb).toService(Nb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Jh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=mp(a,u,n),v=gp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&lm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([Oa(),_k(0,Ra(yv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new xa(((t,e,i,s)=>{bk||(bk=!0,t(Kb).to(yk).inSingletonScope(),t(Jb).toService(Kb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=Mm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&lm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([Oa(),kk(0,Ra(mv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new xa(((t,e,i,s)=>{Tk||(Tk=!0,t(Wb).to(Mk).inSingletonScope(),t(Jb).toService(Wb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Jh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=Mm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([Oa(),Pk(0,Ra(fv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new xa(((t,e,i,s)=>{Rk||(Rk=!0,t(Xb).to(Bk).inSingletonScope(),t(Jb).toService(Xb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([Oa(),Dk(0,Ra(xv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new xa(((t,e,i,s)=>{jk||(jk=!0,t(qb).to(Fk).inSingletonScope(),t(Jb).toService(qb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([Oa(),Vk(0,Ra(bv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t($b).to(Gk).inSingletonScope(),t(Jb).toService($b))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=gu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([Oa()],Kk);let Xk=!1;const $k=new xa(((t,e,i,s)=>{Xk||(Xk=!0,t(Vb).to(Kk).inSingletonScope(),t(Jb).toService(Vb))})),qk=Q_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,vm.RegisterGraphicCreator("arc",Jg),th.load(ky),th.load(qk?DA:iS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,vm.RegisterGraphicCreator("area",$g),th.load(Py),th.load(qk?sk:lS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,vm.RegisterGraphicCreator("circle",up),th.load(Oy),th.load(qk?mk:gS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,vm.RegisterGraphicCreator("glyph",Rg),th.load(Wy),th.load(qk?zk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,vm.RegisterGraphicCreator("group",Cu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,vm.RegisterGraphicCreator("image",Fg),th.load(Zy),th.load(qk?$k:kS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,vm.RegisterGraphicCreator("line",wg),th.load(Cy),th.load(qk?ZA:PS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,vm.RegisterGraphicCreator("path",Yg),th.load(jy),th.load(qk?wk:VS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,vm.RegisterGraphicCreator("polygon",em),th.load(Hy),th.load(qk?Lk:DS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,vm.RegisterGraphicCreator("rect",Pg),th.load(Ty),th.load(qk?GA:$S))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,vm.RegisterGraphicCreator("richtext",Gg),th.load($y),th.load(qk?Uk:ZS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,vm.RegisterGraphicCreator("shadowRoot",sm))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,vm.RegisterGraphicCreator("symbol",kg),th.load(Ry),th.load(qk?hk:sA))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,vm.RegisterGraphicCreator("text",yp),th.load(Dy),th.load(qk?xk:oA))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:xt,throttle:St};MM();let LM=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===O_.env?(O_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===O_.env?(O_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),O_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ei(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ei(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new _e(t).toHex(),o=new _e(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=_e.getColorBrightness(new _e(e));return _e.getColorBrightness(new _e(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:bm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=bm({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?vm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),vm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new gl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:Gke&&([Ae,ke]=[ke,Ae]),Me>Te&&([Me,Te]=[Te,Me]),we>Ce&&([we,Ce]=[Ce,we]),Ee>Pe&&([Ee,Pe]=[Pe,Ee])),Ae>we&&keEe&&TeAe&&CeMe&&PeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([Oa()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([Oa()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([Oa()],uT);const pT=new xa(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(hp).toService(hT)),i(dT)||(t(dT).toSelf(),t($v).toService(dT)),i(uT)||(t(uT).toSelf(),t($v).toService(uT))}));class gT extends Tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=se(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=qt.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Vc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Tb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===So.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===So.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Ie(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=vm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new gl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==So.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===So.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,xo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=ti(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,l+c)||gt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new gl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Tb{getStartAngle(){return re(this._startAngle)}getEndAngle(){return re(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=vm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=vm.line;Y(i)[0].cornerRadius&&(t=vm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=vm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=vm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function lw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function hw(t,e,i,s){const n=bm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}const mw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},fw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,vw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class _w extends Tb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=mw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=vm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=vm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=vm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=vm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=vm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=vm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=vm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Lt(s[0])>Lt(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function yw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function bw(t,e){return Ie(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=He(t,i),r=He(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=ze(t),l=ze(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:te(t.angle);let m=i?t.angle+Pt:te(90-t.angle);const f=i?e.angle:te(e.angle);let v=i?e.angle+Pt:te(90-e.angle);m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Fe(n,i)+Fe(n,s))/2>Fe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Sw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Sw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function Aw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Mw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Cw(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ew(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),yw(e)}function ww(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Cw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function Ew(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Pw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Bw(){aM(),cM(),_M(),kM()}var Rw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Cw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Ew(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=te(e)})),Tw(i,t),!Mw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(kw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),yw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:xw[n]||xw.parity;if(s.length>=3&&Aw(s,r)){do{s=a(s,r)}while(s.length>=3&&Aw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&Sw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=vm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ei(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Lw.defaultAttributes=aw,U(Lw,Pw);class Ow{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return se(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Iw,Dw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=vm.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=vm.circle(t)}h.name=sw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},rw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Dw(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Fw.defaultAttributes=aw,U(Fw,Ow);class jw extends yc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=Tt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=Tt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:At(i,s)})),r=Tt.lastIndex;return r{Hw[t]=!0}));const Uw=t=>-Math.log(-t),Yw=t=>-Math.exp(-t),Kw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Xw=t=>10===t?Kw:t===Math.E?Math.exp:e=>Math.pow(t,e),$w=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Zw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Jw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Qw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eC(t,e,i,s){return 1===i&&(i=0),tC(t,i,s)*(e/(1-i))}function iC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class aC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=iC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const oC=Symbol("implicit");class lC extends aC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Iw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=oC}clone(){const t=(new lC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==oC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class cC extends lC{constructor(t){super(),this.type=Iw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=eC(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:hC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return hC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new cC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:dC}=xe;function uC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=_e.parseColorString(e)){const e=dC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?dC(t,e):e instanceof _e?dC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class pC extends aC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ww,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ww;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Ww,this._piecewise=Qw,this._interpolate=uC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?sC:Qw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Ww),this.rescale(i)):this._clamp!==Ww}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const gC=Math.sqrt(50),mC=Math.sqrt(10),fC=Math.sqrt(2),vC=[1,2,5,10],_C=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=SC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?bC(0,-(e-1)/s,s):bC((e-1)/s,0,s)},yC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return _C(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _C(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=bC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=bC(t,e,l);return n&&r.reverse(),r})),SC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vC[0];return i>=gC?s=vC[3]:i>=mC?s=vC[2]:i>=fC&&(s=vC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AC(t,e,i){const s=(e-t)/Math.max(0,i);return SC(s)}function kC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=AC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function TC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const wC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),EC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wC(t,e,n):wC(t,e,rC(n)),h=wC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),PC=ft(((t,e,i,s,n)=>kC(s(t),s(e),i).map((t=>rC(n(t))))));class BC extends pC{constructor(){super(...arguments),this.type=Iw.Linear}clone(){return(new BC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return yC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=xC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return kC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=TC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=MC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=MC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=MC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function RC(t){return e=>-t(-e)}function LC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class OC extends pC{constructor(){super($w(10),Xw(10)),this.type=Iw.Log,this._limit=LC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new OC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=$w(this._base),s=Xw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RC(i),this._pows=RC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Uw,this.untransformer=Yw):(this._logs=i,this._pows=s,this._limit=LC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Ww}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class IC extends BC{constructor(){super(qw(1),Zw(1)),this.type=Iw.Symlog,this._const=1}clone(){return(new IC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=qw(t),this.untransformer=Zw(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return CC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class DC{constructor(){this.type=Iw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new DC).domain(this._domain).range(this._range).unknown(this._unknown)}}const FC=t=>t.map(((t,e)=>({index:e,value:t}))),jC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Qt(t).expand(i/2),n=new Qt(e).expand(i/2);return s.intersects(n)};function zC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function HC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=te(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=NC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=NC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=NC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=NC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Qt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},GC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=se({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Qt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},WC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},UC=(t,e,i,s)=>VC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),YC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},KC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!YC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?KC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&jC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qC=(t,e)=>{if(Nw(t.type))return((t,e)=>{if(!Nw(t.type))return FC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return FC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=VC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&HC(n,i);)n=WC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return FC(h)})(t,e);if(Gw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?FC([s[s.length-1]]):FC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=UC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=XC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=UC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return FC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=GC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=$C(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return FC(c)})(t,e)}return FC(t.domain())};function ZC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=qt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function JC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=qt.distancePP(s,l),c=qt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=ZC(e,t,!1,!!n),o=ZC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class QC extends Tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=vm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=ZC(t,o,!1,!!a)}const u=vm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=gw(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=vm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(tE,Pw);var eE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(iE,Ow);const sE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",nE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},rE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var aE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(aE||(aE={}));var oE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=aE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=aE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=aE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===O_.env&&(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===aE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===aE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=aE.endHandler):h+=l:this._activeTag===aE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===aE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===O_.env&&(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=oE(i,["formatMethod"]),{formatMethod:a}=s,o=oE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Jt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},rE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},rE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},rE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},rE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Sy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var cE,dE,uE,pE;function gE(){aM(),tT()}function mE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function fE(t,e){const{dx:i,dy:s}=mE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}hE.defaultAttributes=nE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(cE||(cE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(dE||(dE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(uE||(uE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(pE||(pE={}));class vE extends Tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=mw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=vm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=vm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=vm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function _E(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function yE(t,e,i,s){t&&(_E(t.startSymbol,e,i,s),t.lines.forEach((t=>_E(t,e,i,s))),_E(t.line,e,i,s),_E(t.endSymbol,e,i,s))}function bE(t,e,i,s){t&&(_E(t.getTextShape(),e,i,s),_E(t.getBgRect(),e,i,s))}function xE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function SE(t,e,i,s){t&&(xE(t.startSymbol,e,i,s),t.lines.forEach((t=>xE(t,e,i,s))),xE(t.line,e,i,s),xE(t.endSymbol,e,i,s))}function AE(t,e,i,s){t&&(xE(t.getTextShape(),e,i,s),xE(t.getBgRect(),e,i,s))}function kE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;_E(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),_E(t.endSymbol,s+r+a,o,n),_E(e.getTextShape(),s+r+a+o,l,n),_E(e.getBgRect(),s+r+a+o,l,n)}function ME(t,e,i,s,n){yE(t,s,i,n),bE(e,s,i,n)}function TE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function wE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function CE(t,e,i,s,n,r){var a;yE(t,n,s,r),_E(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?bE(i,n,s,r):_E(i,n,s,r)}function EE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;_E(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),_E(e,n+o+l,h,r),_E(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(_E(i.getTextShape(),n+o+l+h+c,d,r),_E(i.getBgRect(),n+o+l+c,d,r)):_E(i,n+o+l+c,d,r)}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?kE(t,e,s,r,a):"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?kE(t,e,s,n,a):"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&wE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&wE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function LE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?CE(n,r,e,i,s,o):"callIn"===t&&EE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?CE(n,r,e,i,s,a):"callIn"===t&&EE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;SE(t,n,s,r),xE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AE(i,n,s,r):xE(i,n,s,r)}(n,r,e,t,i,s)}}const OE={type:"clipIn",duration:500,easing:"linear",delay:0},IE={type:"fadeIn",duration:500,easing:"linear",delay:0},DE={type:"callIn",duration:500,easing:"linear",delay:0},FE={type:"fadeOut",duration:500,easing:"linear",delay:0};class jE extends vE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=FE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;fE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const zE=.001,HE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:cE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},NE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},VE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:uE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},GE={interactive:!0,label:{position:dE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={interactive:!0,label:{position:uE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},UE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},YE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},KE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function XE(){$E._animate=PE}gE(),QT();class $E extends jE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$E.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,zE)||FM(Math.abs(e),3*Math.PI/2,zE)?jM(i,e,t):DM(e)?NE.postiveXAxis[t]:NE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function qE(){ZE._animate=BE}$E.defaultAttributes=HE,gE(),gM();class ZE extends vE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},YE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=vm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}ZE.defaultAttributes=GE,gE(),tw();class JE extends jE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case uE.arcInnerStart:l=s;case uE.arcOuterStart:l=s;break;case uE.arcInnerEnd:l=n;case uE.arcOuterEnd:l=n;break;case uE.center:case uE.arcInnerMiddle:case uE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return UE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}JE.defaultAttributes=VE,gE(),Jk();class QE extends vE{markerAnimate(t){QE._animate&&this._animationConfig&&QE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case uE.center:h=(i+s)/2,c=(n+r)/2;break;case uE.arcInnerStart:h=i,c=n;break;case uE.arcOuterStart:h=s,c=n;break;case uE.arcInnerEnd:h=i,c=r;break;case uE.arcOuterEnd:h=s,c=r;break;case uE.arcInnerMiddle:h=i,c=(n+r)/2;break;case uE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=vm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function tP(){eP._animate=LE}QE.defaultAttributes=WE,gE(),QT(),tw(),SM(),lM(),cM();class eP extends vE{markerAnimate(t){eP._animate&&this._animationConfig&&eP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=DE,this.defaultExitAnimation=FE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,zE)||FM(Math.abs(s),3*Math.PI/2,zE)?jM(t,s,n):DM(s)?KE.postiveXAxis[n]:KE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=pE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=vm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=vm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=vm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,zE)||FM(d,0,zE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(cP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(cP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===cP.focus||"focus"===o){const s=a.hasState(lP.focus);a.toggleState(lP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover,lP.focus],t),this._setLegendItemState(e,lP.selected,t)})):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover,lP.focus],t),this._setLegendItemState(e,lP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(lP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(lP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(hP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[lP.selected,lP.selectedHover],t),this._setLegendItemState(a,lP.unSelected,t)):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t))}else this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover],t),this._setLegendItemState(e,lP.unSelected,t))}))}this._dispatchLegendEvent(hP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,lP.selected),this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover])):(this._removeLegendItemState(e,[lP.selected,lP.selectedHover]),this._setLegendItemState(e,lP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=rP,spaceRow:h=aP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ei(c);let w;!1===x.visible?(w=vm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,cP.item,t,w)):(w=vm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,cP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?lP.selected:lP.unSelected);const C=vm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=vm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,cP.itemShape,t,w,S.state),s.addState(e?lP.selected:lP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=vm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,cP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,cP.itemLabel,t,w,A.state),D.addState(e?lP.selected:lP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,cP.itemValue,t,w,k.state),r.addState(e?lP.selected:lP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new nP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new nP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=vm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=rP,spaceRow:a=aP}=s,o=this._itemsContainer,{space:l=oP,defaultCurrent:h=1}=n,c=gP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=vm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(lP.selected)?this._setLegendItemState(t,lP.selectedHover,e):this._setLegendItemState(t,lP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===cP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(hP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(lP.unSelectedHover)||t.hasState(lP.selectedHover))&&(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(lP.unSelectedHover)&&!t.hasState(lP.selectedHover)||(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===cP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(hP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(lP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},mP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(lP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var vP;function _P(t){return y(t)?t:[t,t]}function yP(t){return t?"ew-resize":"ns-resize"}fP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:rP,spaceRow:aP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:oP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(vP||(vP={})),uP();class bP extends Tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===O_.env?(O_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===O_.env?(O_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),O_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:_P(d)[0],endValue:_P(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=vm.group({x:0,y:0});m.name=vP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=vm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=vP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=vm.group({x:g?v:0,y:g?0:v});m.add(_);const y=vm.group({x:0,y:0});let b;if(y.name=vP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=vm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=vP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=vm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=vP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=_P(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(v.name=vP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=vP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(i.name=vP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=vP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=vm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=vP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":yP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=vm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=vP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return vm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":yP(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),vm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=vm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=vm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===vP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===vP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===vP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===vP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}bP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},pP(),uP();class xP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function SP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}xP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},pP(),uP(),uM();class AP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},AP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=vm.group({x:0,y:0});this._innerView.add(x);const S=new bP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:SP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=vm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}AP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let kP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ei(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};kP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const MP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let TP=class extends Tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(MP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class wP extends Ag{constructor(t){super(t)}}var CP,EP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(CP||(CP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(EP||(EP={}));class PP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},PP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},PP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new wP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new wP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new wP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(CP.OnPlay)},this.pause=()=>{this._dispatchEvent(CP.OnPause)},this.forward=()=>{this._dispatchEvent(CP.OnForward)},this.backward=()=>{this._dispatchEvent(CP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}PP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},PP.defaultAttributes={[EP.Start]:{},[EP.Pause]:{},[EP.Backward]:{},[EP.Forward]:{}};const BP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},RP=[200,10];var LP,OP;!function(t){t.Default="default",t.Reverse="reverse"}(LP||(LP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(OP||(OP={}));const IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},DP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},FP=t=>"top"===t||"bottom"===t;class jP extends Tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(FP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:RP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:RP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new bP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return FP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new PP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=FP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:RP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(FP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:FP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:FP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function zP(){uP(),aM(),SM()}jP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},BP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},BP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},BP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},BP),{key:"backward",position:"start"})}},zP();class HP extends jP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:LP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(OP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||DP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===LP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(OP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(OP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(OP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),O_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(OP.change),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var NP,VP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};zP();class GP extends jP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(OP.change))},this.play=()=>VP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(OP.play),this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=O_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,O_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(OP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(NP||(NP={}));const WP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},UP=5;const YP={debounce:xt,throttle:St};aM(),gM();let KP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:YP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(NP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(NP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(NP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=WP.trigger,updateTrigger:e=WP.updateTrigger,endTrigger:i=WP.endTrigger,resetTrigger:s=WP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Xe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(NP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(NP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=UP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=vm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},$P=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},qP={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Qt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ZP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let JP=class t extends Tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ei(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Nc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>ZP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&yg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return XP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return XP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};JP.defaultAttributes=qP;const QP=pt;function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function eB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function iB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function sB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function nB(t,e){const i=sB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function rB(t,e){const i=aB(t),s=aB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function aB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function oB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function lB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const hB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var dB,uB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(dB||(dB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(uB||(uB={}));const pB="__VCHART",gB=500,mB=500,fB=`${pB}_LABEL_LIMIT`,vB=`${pB}_LABEL_ALIGN`,_B=`${pB}_LABEL_TEXT`,yB=`${pB}_LABEL_VISIBLE`,bB=`${pB}_LABEL_X`,xB=`${pB}_LABEL_Y`,SB=`${pB}_ARC_TRANSFORM_VALUE`,AB=`${pB}_ARC_RATIO`,kB=`${pB}_ARC_START_ANGLE`,MB=`${pB}_ARC_END_ANGLE`,TB=`${pB}_ARC_K`,wB=`${pB}_ARC_MIDDLE_ANGLE`,CB=`${pB}_ARC_QUADRANT`,EB=`${pB}_ARC_RADIAN`,PB=-Math.PI/2,BB=3*Math.PI/2,RB=-90,LB=.6;var OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB,XB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(OB||(OB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(IB||(IB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(DB||(DB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(FB||(FB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(jB||(jB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(zB||(zB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(HB||(HB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(NB||(NB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(VB||(VB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(GB||(GB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(WB||(WB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(UB||(UB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(YB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",YB.AFTER_EVALUATE_DATA="afterEvaluateData",YB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",YB.AFTER_EVALUATE_SCALE="afterEvaluateScale",YB.BEFORE_PARSE_VIEW="beforeParseView",YB.AFTER_PARSE_VIEW="afterParseView",YB.BEFORE_TRANSFORM="beforeTransform",YB.AFTER_TRANSFORM="afterTransform",YB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",YB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",YB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",YB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",YB.BEFORE_STAGE_RESIZE="beforeStageResize",YB.AFTER_STAGE_RESIZE="afterStageResize",YB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",YB.AFTER_VRENDER_DRAW="afterVRenderDraw",YB.BEFORE_MARK_JOIN="beforeMarkJoin",YB.AFTER_MARK_JOIN="afterMarkJoin",YB.BEFORE_MARK_UPDATE="beforeMarkUpdate",YB.AFTER_MARK_UPDATE="afterMarkUpdate",YB.BEFORE_MARK_STATE="beforeMarkState",YB.AFTER_MARK_STATE="afterMarkState",YB.BEFORE_MARK_ENCODE="beforeMarkEncode",YB.AFTER_MARK_ENCODE="afterMarkEncode",YB.BEFORE_DO_LAYOUT="beforeDoLayout",YB.AFTER_DO_LAYOUT="afterDoLayout",YB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",YB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",YB.BEFORE_DO_RENDER="beforeDoRender",YB.AFTER_DO_RENDER="afterDoRender",YB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",YB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",YB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",YB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",YB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",YB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",YB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",YB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",YB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",YB.BEFORE_ELEMENT_STATE="beforeElementState",YB.AFTER_ELEMENT_STATE="afterElementState",YB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",YB.AFTER_ELEMENT_ENCODE="afterElementEncode",YB.ANIMATION_START="animationStart",YB.ANIMATION_END="animationEnd",YB.ELEMENT_ANIMATION_START="elementAnimationStart",YB.ELEMENT_ANIMATION_END="elementAnimationEnd",YB.ALL_ANIMATION_START="allAnimationStart",YB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(KB||(KB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(XB||(XB={}));const $B="__vgrammar_scene_item__",qB=[DB.line,DB.area],ZB=[DB.arc3d,DB.rect3d,DB.pyramid3d],JB="key",QB=[{}],tR=["key"],eR=!0,iR=!0,sR=!1,nR=!0,rR="VGRAMMAR_IMMEDIATE_ANIMATION",aR=0,oR=1e3,lR=0,hR=0,cR=!1,dR=!1,uR="quintInOut",pR={stopWhenStateChange:!1,immediatelyApply:!0},gR="_mo_hide_";function mR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function fR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return mR(t.dependency,e);var i;return[]}function vR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function _R(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function yR(t,e){return bR(t)?t.output():e[t]}const bR=t=>t&&!u(t.grammarType),xR=t=>d(t)?t:e=>e[t];function SR(t){return!!(null==t?void 0:t.scale)}function AR(t){return!!(null==t?void 0:t.field)}function kR(t,e){if(!t)return[];let i=[];return t.scale&&(i=bR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(fR(t,e))}function MR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function TR(t,e,i,s,n){i&&(vR(i)?e.forEach((e=>{const n=_R(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case DB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case DB.group:case DB.rect:case DB.image:return["width","height","y1"].includes(e);case DB.path:case DB.shape:return["path","customPath"].includes(e);case DB.line:return"defined"===e;case DB.area:return["x1","y1","defined"].includes(e);case DB.rule:return["x1","y1"].includes(e);case DB.symbol:return"size"===e;case DB.polygon:return"points"===e;case DB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(SR(l)){const t=yR(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?gb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(AR(l)){const t=gb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=_R(l,s,e.datum,t)}))})))}function wR(t,e,i,s){if(!t)return null;if(vR(t))return _R(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(SR(h)){const t=yR(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?gb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(AR(h)){const t=gb(h.field);n[r]=t(e)}else n[r]=_R(h,s,e,i)})),n}class CR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let ER=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};ER._plotMarks={},ER._marks={},ER._components={},ER._graphicComponents={},ER._transforms={},ER._grammars={},ER._glyphs={},ER._animations={},ER._interactions={},ER._graphics={},ER.registerGlyph=(t,e,i,s,n)=>(ER._glyphs[t]=new CR(e,i,s,n),ER._glyphs[t]),ER.registerAnimationType=(t,e)=>{ER._animations[t]=e},ER.getAnimationType=t=>ER._animations[t],ER.registerInteraction=(t,e)=>{ER._interactions[t]=e},ER.registerGraphic=(t,e)=>{ER._graphics[t]=e},ER.getGraphicType=t=>ER._graphics[t],ER.createGraphic=(t,e)=>{const i=ER._graphics[t];return i?i(e):null};const PR=t=>!!DB[t];function BR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=ER.getGraphicType(e)?ER.createGraphic(e,i):ER.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const RR=t=>{t&&(t[$B]=null,t.release(),t.parent&&t.parent.removeChild(t))},LR=["fillOpacity"],OR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const IR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[DB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[DB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[DB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const DR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?IR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(LR.includes(r)?OR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{LR.includes(t)?OR(n,t,e):n[t]=e[t]}));return n},FR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),jR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],zR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(jR);function HR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?zR:jR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>FR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=NR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function NR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let VR=class{constructor(t){this.data=null,this.states=[],this.diffState=IB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));TR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?DR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[$B]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?DR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===IB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(RR(this.graphicItem),this.graphicItem[$B]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=xR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(_R(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===IB.unChange&&(this.diffState=IB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,gR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[gR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||this.useStates(this.states),this.mark.markType===DB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new gl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[OB.update],a=e[OB.enter],o=e[OB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===IB.enter?(a&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.update?((n&&a||i)&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.exit&&o&&(i&&TR(this,t,a,s,l),TR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)_b(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[DB.line,DB.area,DB.largeRects,DB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||MR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[OB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=NR(h),e===DB.line||e===DB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>MR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===DB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=HR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=NR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?HR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=wR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=HR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===DB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===DB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(RR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class GR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const WR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class UR extends GR{constructor(t,e){super(t,e),this.type=UR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}UR.type="element-select",UR.defaultOptions={state:XB.selected,trigger:"click"};class YR extends GR{constructor(t,e){super(t,e),this.type=YR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},YR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function KR(t){if(t)return t.type===Iw.Band?t.bandwidth():t.type===Iw.Point?t.step():void 0}YR.type="element-highlight",YR.defaultOptions={highlightState:XB.highlight,blurState:XB.blur,trigger:"pointerover",triggerOff:"pointerout"};class XR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const $R=()=>{U(UR,XR),ER.registerInteraction(UR.type,UR)},qR=()=>{U(YR,XR),ER.registerInteraction(YR.type,YR)},ZR=(t,e)=>bR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,JR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=ZR(n,e),i}),{}):t.map((t=>ZR(t,e))):t;let QR=-1;class tL extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++QR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(fR(this.spec[e],this.view)),this.spec[e]=t,this.attach(fR(t,this.view)),this.commit(),this}}const eL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=fR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},iL=(t,e)=>{const i=ER.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(mR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>eL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return eL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},sL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=iL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},nL={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class rL extends tL{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!nL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return nL[e.type](t,i,new ya(new va))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?fR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=fR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=fR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=bR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=sL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const aL="window",oL="view",lL={trap:!1},hL="width",cL="height",dL="viewWidth",uL="viewHeight",pL="padding",gL="viewBox",mL="autoFit";function fL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function vL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,fL(t,e,n,s)}class _L{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}return this.nodes.push(t),fL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,vL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class yL{constructor(t){this.list=[],this.ids={},this.idFunc=t||mb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class bL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new yL((t=>t.uid)),this._heap=new _L(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new yL((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const xL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===DB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class SL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Qd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{zl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new iy(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Qb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ix(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function AL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function kL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function ML(t,e,i,s,n){if(n===aL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{kL(t,AL(t),!1)}))}));const e=AL(t);kL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class TL extends tL{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?_R(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},PL=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class BL extends VR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return TR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[$B]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?DR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===IB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=DR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=IR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===DB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return qB.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)_b(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[$B]=null})),this.glyphGraphicItems=null),super.release()}}const RL=t=>t.markType===DB.glyph?new BL(t):new VR(t);function LL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JB,i?t.slice().sort(i):t.slice()),{keys:tR,data:s};const n=xR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class OL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?LL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const IL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const DL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class FL extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class jL extends yc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Nd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:So.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}xc.mode|=ko.SET_ATTR_IMMEDIATELY;let zL=0;const HL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof yc||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class NL{constructor(t,e,i){this.id=zL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!ER.getAnimationType(e.type))return null;const r=ER.getAnimationType(e.type)(t,n,i);return IL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?DL(t,0,n[i].from,0,s):void 0,e.to[i]=l?DL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),IL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=HL(o);return u(o)||HL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new jL(r.from,r.to,a,t.easing):void 0:new FL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new $c(a,e))}r>0&&t.wait(r)}}function VL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(GL(i,t[i]))})),e}function GL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:aR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:dR,loop:null!==(s=h.loop)&&void 0!==s?s:cR,controlOptions:z({},pR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:oR,delay:null!==(a=h.delay)&&void 0!==a?a:lR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:hR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:uR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:aR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:dR,loop:null!==(d=t.loop)&&void 0!==d?d:cR,controlOptions:z({},pR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:lR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:hR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:uR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function WL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class UL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class YL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=VL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=VL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==IB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=GL(rR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===IB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new NL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===IB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=_R(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=WL(t.startTime,e,n),o=WL(t.totalTime,e,n),l=WL(t.oneByOne,e,n),h=WL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=WL(t.delay,e,n),l=WL(t.delayAfter,e,n),h=null!==(i=WL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:WL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===IB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===IB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===rR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===IB.exit&&0===o[IB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class KL extends tL{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new YL(this,{}),this.differ=new OL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===IB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===UB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:QB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===DB.group)return;const e=LL(null!=t?t:QB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(IB.update,t,e,i)}encodeState(t,e,i,s){if(t===IB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(vR(n))this.detach(kR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(kR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(kR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(kR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(kR(i,this.view))):vR(e)?(this.spec.encode[t]=e,this.attach(kR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(kR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=sL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return qB.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==IB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===KB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!vR(n)&&Object.keys(n).forEach((t=>{SR(n[t])&&(e[t]=yR(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];vR(s)||Object.keys(s).forEach((t=>{AR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B];if((null==s?void 0:s.mark)===this){const i=ML(this.view,t,s,0,oL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new YL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=yR(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==DB.group){if(!this.graphicItem){const t=BR(this,DB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||ZB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==DB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=xR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>JB),a=xR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>JB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===IB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=IB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):RL(this),n.diffState===IB.exit&&(n.diffState=IB.enter,this.animate.getElementAnimators(n,IB.exit).forEach((t=>t.stop("start")))),n.diffState=IB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=IB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:QB;l||this.differ.setCurrentData(LL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=wR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{this.markType===DB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:BR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==DB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=xR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>JB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=RL(this);e.diffState=IB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=RL(this);i.diffState=IB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==DB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=BR(this,DB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==IB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:IR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=IB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&RR(this.graphicItem),this.detachAll(),super.release()}}let XL=class extends KL{constructor(t,e){super(t,DB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===DB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return IR.rect}evaluateJoin(t){if(!this.elements.length){const t=RL(this);t.updateData(JB,QB,(()=>""),this.view),this.elements=[t],this.elementMap.set(JB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return TR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:BR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function $L(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function qL(t,e){return Math.min(t<0?t+e:t-1,e)}function ZL(t,e,i){let s=qL(t,i),n=qL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=qL(Math.max(0,n-1),i)):n=qL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const JL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>$L(t,i))),u=l.map((t=>$L(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=ZL(e,i,r),{start:h,end:c}=ZL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Jt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},QL={[FB.axis]:0,[FB.legend]:1,[FB.slider]:2,[FB.player]:3,[FB.datazoom]:4},tO=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=QL[t.componentType])&&void 0!==s?s:1/0},eO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=yb(r.maxChildWidth,n.width()),o=yb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=EL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dtO(t)-tO(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==DB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=eO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(dL,o),i.updateSignal(uL,l),i.updateSignal(pL,h)}else eO(t,n,a,e);else"grid"===r.display&&JL(t,n,a);iO(n,e,i)}}))};class sO extends KL{constructor(t,e,i){super(t,DB.glyph,i),this.glyphType=e,this.glyphMeta=ER.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!ER.getGraphicType(DB.glyph))return;const s=ER.createGraphic(DB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(ER.getGraphicType(n[t])){const e=ER.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const nO=Symbol.for("key");class rO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=LL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=LL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=xR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:nO})),r=LL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:nO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==nO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=_R(i.animation.delay,n,o,l),d=_R(i.animation.duration,n,o,l),u=_R(i.animation.oneByOne,n,o,l),p=_R(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Td(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Pd:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Bd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Sd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>kd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:So.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Md({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Tc,null!==(l=i.easing)&&void 0!==l?l:wc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:So.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new wd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Tc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Td(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class aO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class oO extends aO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===DB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===DB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===DB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===DB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class lO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class hO extends KL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=BR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?DB.richtext:DB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}hO.markType=DB.text;const cO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},dO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},uO=Object.assign({},cO);uO.axis=Object.assign({},uO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.circleAxis=Object.assign({},uO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.grid=Object.assign({},uO.grid,{style:{stroke:"#404349"}}),uO.circleGrid=Object.assign({},uO.circleGrid,{style:{stroke:"#404349"}}),uO.rectLabel=Object.assign({},uO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.lineLabel=Object.assign({},uO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.symbolLabel=Object.assign({},uO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.title=Object.assign({},uO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const pO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:dO,components:uO},gO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:dO,components:cO};let mO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};mO._themes=new Map,mO.registerTheme("default",gO),mO.registerTheme("dark",pO);class fO extends KL{constructor(t,e,i,s){super(t,DB.component,i),this._componentDatum={[JB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:ER.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,JB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[JB]+=1}evaluateJoin(t){return this.spec.key=JB,t?(t[JB]=this._componentDatum[JB],this._componentDatum=t):this._componentDatum={[JB]:this._componentDatum[JB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class vO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B],n=ML(0,t,s,0,oL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(bR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):PR(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new TL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new rL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=ER.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=ER.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case DB.group:n=new XL(this,s);break;case DB.glyph:n=new sO(this,null==i?void 0:i.glyphType,s);break;case DB.component:n=ER.hasComponent(null==i?void 0:i.componentType)?ER.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new fO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case DB.text:n=new hO(this,t,s);break;default:n=ER.hasMark(t)?ER.createMark(t,this,s):new KL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(DB.group,t)}glyph(t,e){return this.mark(DB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(DB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.grid,mode:e})}legend(t){return this.mark(DB.component,t,{componentType:FB.legend})}slider(t){return this.mark(DB.component,t,{componentType:FB.slider})}label(t){return this.mark(DB.component,t,{componentType:FB.label})}datazoom(t){return this.mark(DB.component,t,{componentType:FB.datazoom})}player(t){return this.mark(DB.component,t,{componentType:FB.player})}title(t){return this.mark(DB.component,t,{componentType:FB.title})}scrollbar(t){return this.mark(DB.component,t,{componentType:FB.scrollbar})}customized(t,e){const i=ER.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&CL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(RR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++wL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(mO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(hL,t.width),this.updateSignal(cL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=ER.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:hL,value:null!==(s=t[hL])&&void 0!==s?s:0},{id:cL,value:null!==(n=t[cL])&&void 0!==n?n:0},{id:pL,value:EL(null!==(a=null!==(r=t[pL])&&void 0!==r?r:e[pL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:dL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[hL]-i.left-i.right},dependency:[hL,pL]}},{id:uL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[cL]-i.top-i.bottom},dependency:[cL,pL]}},{id:gL,update:{callback:(t,e)=>{const i=EL(e[pL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[dL],i.top+e[uL])},dependency:[dL,uL,pL]}},{id:mL,value:null!==(o=t[mL])&&void 0!==o?o:e[mL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===DB.glyph?{glyphType:t.glyphType}:t.type===DB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=mO.getTheme(t))&&void 0!==e?e:mO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(hL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(cL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(uL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(pL);if(arguments.length){const i=EL(t);return this.updateSignal(e,i),i}return EL(e.output())}autoFit(t){const e=this.getSignalById(mL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(gL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=UB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===DB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||iO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{xL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),xL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=eR,morph:o=iR,morphAll:l=sR,animation:h={},enableExitAnimation:c=nR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:uR,delay:null!==(i=h.delay)&&void 0!==i?i:lR,duration:null!==(s=h.duration)&&void 0!==s?s:oR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:dR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=UB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=UB.reevaluate,this._dataflow.evaluate()),this._layoutState=UB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!CL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return xL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ii(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(hL,t)),e!==this.height()&&(s=!0,this.updateSignal(cL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):PR(t)?(i.markType=t,i.source=e):i.source=t===aL?aL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=mR(l,this),v=PL(((t,e)=>{const s=c===oL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===aL&&(t=ML(0,t,e,0,aL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===oL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,oL,d))return this.addEventListener(d,v,lL),()=>{this.removeEventListener(d,v)}}else if(c===aL)return O_.addEventListener(d,v),this._eventListeners.push({type:d,source:O_,handler:v}),()=>{O_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===O_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=ER.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new SL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new aO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new oO((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new bL,this.animate=new lO(this),this._morph=new rO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[oL,aL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:mO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&O_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==DB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=O_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&O_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),ER.unregisterRuntimeTransforms(),at.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _O=()=>{bM(),uM(),ER.registerGraphic(DB.path,Yg)},yO=()=>{bM(),fM(),ER.registerGraphic(DB.rect,Pg)},bO=()=>{bM(),cM(),ER.registerGraphic(DB.rule,wg)},xO=()=>{bM(),SM(),ER.registerGraphic(DB.symbol,kg)},SO=()=>{bM(),kM(),_M(),ER.registerGraphic(DB.text,yp)},AO=()=>{bM(),nM(),ER.registerGraphic(DB.glyph,Rg)},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},MO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},TO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Ab(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},wO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ab(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},CO=kO(TO),EO=MO(TO);const PO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ab(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},BO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ab(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},RO=kO(PO),LO=MO(PO);const OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},IO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},DO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?IO:OO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},jO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},zO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class HO extends fO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const NO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class VO extends HO{constructor(t,e,i){super(t,FB.axis,e),this.spec.componentType=FB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=wR(n,e,i,s);const h=_R(this.spec.inside,s,e,i),c=_R(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(NO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=_R(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case zB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case zB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?zB.circleAxis:zB.lineAxis,this._axisComponentType}}VO.componentType=FB.axis;let GO=class extends fO{constructor(t,e){super(t,FB.label,e),this.spec.componentType=FB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=_R(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=_R(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case DB.line:case DB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case DB.rect:case DB.rect3d:case DB.interval:g=p.rectLabel;break;case DB.symbol:case DB.circle:case DB.cell:g=p.symbolLabel;break;case DB.arc:case DB.arc3d:g=p.arcLabel;break;case DB.polygon:case DB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=wR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=wR(i,t,e,d);m.push(z({},f,s))}));else{const t=wR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};GO.componentType=FB.label;const WO=()=>{ER.registerGraphicComponent(FB.label,(t=>new JT(t))),ER.registerComponent(FB.label,GO)};class UO extends HO{constructor(t,e,i){super(t,FB.grid,e),this.spec.componentType=FB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=wR(s,t,e,i);const d=_R(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case HB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case HB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=_R(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(NO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===HB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=_R(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case HB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case HB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=HB.circleAxisGrid:this._gridComponentType=HB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case zB.circleAxis:this._gridComponentType=HB.circleAxisGrid;break;case zB.lineAxis:default:this._gridComponentType=HB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?HB.lineAxisGrid:HB.circleAxisGrid:HB.lineAxisGrid}else this._gridComponentType=HB.lineAxisGrid;return this._gridComponentType}}UO.componentType=FB.grid;const YO=(t,e,i)=>e.filter((e=>t.callback(e,i))),KO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function XO(t){return t.reduce(((t,e)=>t+e),0)}const $O={min:$,max:X,average:function(t){return 0===t.length?0:XO(t)/t.length},sum:XO};function qO(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function ZO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function JO(t,e,i,s){return ZO(t,e,i,"min",s)}function QO(t,e,i,s){return ZO(t,e,i,"max",s)}function tI(t,e,i,s){return ZO(t,e,i,"average",s)}function eI(t,e,i,s){return ZO(t,e,i,"sum",s)}const iI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=qO;if("min"===n?l=JO:"max"===n?l=QO:"average"===n?l=tI:"sum"===n&&(l=eI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const sI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(gR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(gR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(gR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},nI=()=>{ER.registerTransform("filter",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{ER.registerTransform("map",{transform:KO,markPhase:"beforeJoin"},!0)},aI=()=>{ER.registerTransform("sampling",{transform:iI,markPhase:"afterEncode"},!0)},oI=()=>{ER.registerTransform("markoverlap",{transform:sI,markPhase:"afterEncode"},!0)},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},hI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},cI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},dI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},pI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},xI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},SI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},AI=(t,e,i)=>({from:{points:SI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),kI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:SI(t,e)}}),MI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),TI=(t,e,i)=>({from:{points:MI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),wI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:MI(t,e,i)}}),CI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),EI=(t,e,i)=>({from:{points:CI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),PI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:CI(t,e,i)}}),BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},LI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},OI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},II={symbol:["_mo_hide_","visible"]},DI=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=II[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{_b(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},jI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=pt(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},zI=()=>{ER.registerAnimationType("clipIn",lI)},HI=()=>{ER.registerAnimationType("clipOut",hI)},NI=()=>{ER.registerAnimationType("fadeIn",cI)},VI=()=>{ER.registerAnimationType("fadeOut",dI)},GI=()=>{ER.registerAnimationType("growCenterIn",uI)},WI=()=>{ER.registerAnimationType("growCenterOut",pI)},UI=()=>{ER.registerAnimationType("growHeightIn",fI)},YI=()=>{ER.registerAnimationType("growHeightOut",vI)},KI=()=>{ER.registerAnimationType("growWidthIn",gI)},XI=()=>{ER.registerAnimationType("growWidthOut",mI)},$I=()=>{ER.registerAnimationType("growPointsIn",AI)},qI=()=>{ER.registerAnimationType("growPointsOut",kI)},ZI=()=>{ER.registerAnimationType("growPointsXIn",TI)},JI=()=>{ER.registerAnimationType("growPointsXOut",wI)},QI=()=>{ER.registerAnimationType("growPointsYIn",EI)},tD=()=>{ER.registerAnimationType("growPointsYOut",PI)},eD=()=>{ER.registerAnimationType("growAngleIn",_I)},iD=()=>{ER.registerAnimationType("growAngleOut",yI)},sD=()=>{ER.registerAnimationType("growRadiusIn",bI)},nD=()=>{ER.registerAnimationType("growRadiusOut",xI)},rD=()=>{ER.registerAnimationType("moveIn",BI)},aD=()=>{ER.registerAnimationType("moveOut",RI)},oD=()=>{ER.registerAnimationType("scaleIn",LI)},lD=()=>{ER.registerAnimationType("scaleOut",OI)},hD=()=>{ER.registerAnimationType("rotateIn",FI)},cD=()=>{ER.registerAnimationType("rotateOut",jI)},dD=()=>{ER.registerAnimationType("update",DI)};class uD extends KL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=vR(e)?null:Object.keys(e).reduce(((t,s)=>(SR(e[s])&&(t[s]=yR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=wR(e,t,i,n);if(u(r.size)){const t=s.x?KR(s.x):void 0,e=s.y?KR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(IR.symbol)}release(){super.release(),this._encoders=null}}uD.markType=DB.cell;const pD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var gD,mD,fD;t.ChartEvent=void 0,(gD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",gD.rendered="rendered",gD.renderFinished="renderFinished",gD.animationFinished="animationFinished",gD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",gD.afterInitData="afterInitData",gD.afterInitEvent="afterInitEvent",gD.afterInitMark="afterInitMark",gD.rawDataUpdate="rawDataUpdate",gD.viewDataFilterOver="viewDataFilterOver",gD.viewDataUpdate="viewDataUpdate",gD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",gD.markDeltaYUpdate="markDeltaYUpdate",gD.viewDataLabelUpdate="viewDataLabelUpdate",gD.scaleDomainUpdate="scaleDomainUpdate",gD.scaleUpdate="scaleUpdate",gD.dataZoomChange="dataZoomChange",gD.drill="drill",gD.layoutStart="layoutStart",gD.layoutEnd="layoutEnd",gD.layoutRectUpdate="layoutRectUpdate",gD.playerPlay="playerPlay",gD.playerPause="playerPause",gD.playerEnd="playerEnd",gD.playerChange="playerChange",gD.playerForward="playerForward",gD.playerBackward="playerBackward",gD.scrollBarChange="scrollBarChange",gD.brushStart="brushStart",gD.brushChange="brushChange",gD.brushEnd="brushEnd",gD.brushClear="brushClear",gD.legendSelectedDataChange="legendSelectedDataChange",gD.legendFilter="legendFilter",gD.legendItemClick="legendItemClick",gD.legendItemHover="legendItemHover",gD.legendItemUnHover="legendItemUnHover",gD.tooltipShow="tooltipShow",gD.tooltipHide="tooltipHide",gD.tooltipRelease="tooltipRelease",gD.afterResize="afterResize",gD.afterRender="afterRender",gD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(mD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",mD.window="window",mD.canvas="canvas",t.Event_Bubble_Level=void 0,(fD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",fD.chart="chart",fD.model="model",fD.mark="mark";const vD=`${pB}_waterfall_default_seriesField`,_D=`${pB}_CORRELATION_X`,yD=`${pB}_CORRELATION_Y`,bD=`${pB}_CORRELATION_SIZE`,xD=`${pB}_MEASURE_CANVAS_ID`,SD=`${pB}_DEFAULT_DATA_INDEX`,AD=`${pB}_DEFAULT_DATA_KEY`,kD=`${pB}_DEFAULT_DATA_SERIES_FIELD`,MD=`${pB}_DEFAULT_SERIES_STYLE_NAME`;var TD;t.AttributeLevel=void 0,(TD=t.AttributeLevel||(t.AttributeLevel={}))[TD.Default=0]="Default",TD[TD.Theme=1]="Theme",TD[TD.Chart=2]="Chart",TD[TD.Base_Series=3]="Base_Series",TD[TD.Series=4]="Series",TD[TD.Mark=5]="Mark",TD[TD.User_Chart=6]="User_Chart",TD[TD.User_Series=7]="User_Series",TD[TD.User_Mark=8]="User_Mark",TD[TD.User_SeriesStyle=9]="User_SeriesStyle",TD[TD.Built_In=99]="Built_In";const wD=`${pB}_STACK_KEY`,CD=`${pB}_STACK_START`,ED=`${pB}_STACK_END`,PD=`${pB}_STACK_START_PERCENT`,BD=`${pB}_STACK_END_PERCENT`,RD=`${pB}_STACK_START_OffsetSilhouette`,LD=`${pB}_STACK_END_OffsetSilhouette`,OD=`${pB}_STACK_TOTAL`,ID=`${pB}_STACK_TOTAL_PERCENT`,DD=`${pB}_STACK_TOTAL_TOP`,FD=`${pB}_SEGMENT_START`,jD=`${pB}_SEGMENT_END`;var zD,HD;t.LayoutZIndex=void 0,(zD=t.LayoutZIndex||(t.LayoutZIndex={}))[zD.Axis_Grid=50]="Axis_Grid",zD[zD.CrossHair_Grid=100]="CrossHair_Grid",zD[zD.Region=450]="Region",zD[zD.Mark=300]="Mark",zD[zD.Node=400]="Node",zD[zD.Axis=100]="Axis",zD[zD.MarkLine=500]="MarkLine",zD[zD.MarkArea=100]="MarkArea",zD[zD.MarkPoint=500]="MarkPoint",zD[zD.DataZoom=500]="DataZoom",zD[zD.ScrollBar=500]="ScrollBar",zD[zD.Player=500]="Player",zD[zD.Legend=500]="Legend",zD[zD.CrossHair=500]="CrossHair",zD[zD.Indicator=500]="Indicator",zD[zD.Title=500]="Title",zD[zD.Label=500]="Label",zD[zD.Brush=500]="Brush",zD[zD.CustomMark=500]="CustomMark",zD[zD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(HD=t.LayoutLevel||(t.LayoutLevel={}))[HD.Indicator=10]="Indicator",HD[HD.Region=20]="Region",HD[HD.Axis=30]="Axis",HD[HD.DataZoom=40]="DataZoom",HD[HD.Player=40]="Player",HD[HD.ScrollBar=40]="ScrollBar",HD[HD.Legend=50]="Legend",HD[HD.Title=70]="Title",HD[HD.CustomMark=70]="CustomMark";const ND=["linear","radial","conical"],VD={x0:0,y0:0,x1:1,y1:1},GD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},WD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},UD={linear:VD,radial:GD,conical:WD},YD={label:{name:"label",type:"text"}},KD=`${pB}_rect_x`,XD=`${pB}_rect_x1`,$D=`${pB}_rect_y`,qD=`${pB}_rect_y1`,ZD={data:!0},JD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},QD=Object.assign(Object.assign({},YD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),tF=Object.assign(Object.assign({},YD),{bar3d:{name:"bar3d",type:"rect3d"}}),eF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},iF=Object.assign(Object.assign({},YD),eF),sF=Object.assign(Object.assign({},YD),{point:{name:"point",type:"symbol"}}),nF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),aF=Object.assign(Object.assign({},YD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},YD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),lF=Object.assign(Object.assign({},YD),{rose:{name:"rose",type:"arc"}}),hF=Object.assign(Object.assign({},YD),{area:{name:"area",type:"path"}}),cF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"}}),dF=Object.assign(Object.assign({},cF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),uF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),pF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),gF=Object.assign(Object.assign({},YD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),mF=Object.assign(Object.assign({},YD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},YD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),vF=Object.assign(Object.assign({},YD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),_F=Object.assign(Object.assign({},QD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),yF=Object.assign(Object.assign({},YD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),bF=Object.assign(Object.assign({},YD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),xF=Object.assign(Object.assign({},YD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),SF=Object.assign(Object.assign({},cF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),AF=Object.assign(Object.assign({},YD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),kF=Object.assign(Object.assign({},YD),{sunburst:{name:"sunburst",type:"arc"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},tF),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),wF=Object.assign(Object.assign({},YD),{circlePacking:{name:"circlePacking",type:"arc"}}),CF=Object.assign(Object.assign({},YD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),EF=Object.assign(Object.assign({},YD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),PF=Object.assign({},nF),BF=Object.assign(Object.assign({},YD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),RF=Object.assign(Object.assign({},YD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var LF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(LF||(LF={}));const OF={[dB.bar]:QD,[dB.bar3d]:tF,[dB.line]:iF,[dB.scatter]:sF,[dB.area]:nF,[dB.radar]:rF,[dB.pie]:aF,[dB.pie3d]:oF,[dB.rose]:lF,[dB.geo]:YD,[dB.map]:hF,[dB.circularProgress]:dF,[dB.link]:uF,[dB.dot]:pF,[dB.wordCloud]:gF,[dB.wordCloud3d]:gF,[dB.funnel]:mF,[dB.funnel3d]:fF,[dB.linearProgress]:vF,[dB.waterfall]:_F,[dB.boxPlot]:yF,[dB.treemap]:bF,[dB.sankey]:xF,[dB.gauge]:SF,[dB.gaugePointer]:AF,[dB.sunburst]:kF,[dB.rangeColumn]:MF,[dB.rangeColumn3d]:TF,[dB.circlePacking]:wF,[dB.heatmap]:CF,[dB.correlation]:EF,[dB.rangeArea]:PF,[dB.liquid]:BF,[dB.venn]:RF};function IF(t){var e,i;const{type:s}=t;return s===dB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const DF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},FF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function jF(t,e){var i;if(!t)return[];const s=UF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?GF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>VF(i)?HF(t,i,e):i)).filter(p)}))):i.map((i=>VF(i)?HF(t,i,e):i)).filter(p):[]}return[]}function zF(t,e){var i,s;return GF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function HF(t,e,i){var s;const n=UF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=DF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=FF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new _e(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ce(t,i,s),a=he(n,r,e.l),l=new _e(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const NF=(t,e,i)=>{if(e&&VF(t)){const s=HF(e,t,i);if(s)return s}return t};function VF(t){return t&&"palette"===t.type&&!!t.key}function GF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function WF(t){return y(t)?{dataScheme:t}:t}function UF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=IF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class YF extends lC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!GF(this._range))return void super.range(this._range);const t=zF(this._range,this._domain);super.range(t)}}const KF={linear:BC,band:cC,point:class extends cC{constructor(t){super(!1),this.type=Iw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:lC,threshold:DC,colorOrdinal:YF};function XF(t){const e=KF[t];return e?new e:null}function $F(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function qF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ZF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function JF(t){return!!_(t)&&(!!t.endsWith("%")&&lb(t.substring(0,t.length-1)))}function QF(t,e,i,s=0){var n,r;return S(t)?t:JF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function tj(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=QF(t[s],e.size,i)}))})),o}function ej(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||JF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ij(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sj=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},nj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],rj={default:{dataScheme:nj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},aj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",oj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:aj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:aj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:RB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},lj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},hj=Object.assign(Object.assign({},lj),{label:{space:0}}),cj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},dj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",uj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},pj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},gj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},mj={horizontal:Object.assign(Object.assign({},pj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj}),vertical:Object.assign(Object.assign({},pj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj})},fj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},vj={horizontal:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj}),vertical:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj})},_j={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},bj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function xj(t,e){return t&&e.key in t?t[e.key]:e.default}function Sj(t){return t&&"token"===t.type&&!!t.key}const Aj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},kj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:rj,token:Aj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:oj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:mj,sizeLegend:vj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:lj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:hj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:yj,markArea:_j,markPoint:bj,polarMarkLine:yj,polarMarkArea:_j,polarMarkPoint:bj,geoMarkPoint:bj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:uj,crosshair:cj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},Mj={name:"dark",colorScheme:{default:{dataScheme:nj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Tj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Tj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Tj(t[i],e[i])))),wj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),wj(t[s],e.slice(1),i))};function Cj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof ya||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=Cj(n,e)}return s}function Ej(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Pj(t,e,r,i):Bj(t,r,s[r])}}}}function Pj(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Rj({},t[n][e.index],i):i):t[n]=s?Rj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Rj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Rj({},t[n],i):i)}))}function Oj(t,...e){return Rj(Ij(t),...e.map(Ij))}function Ij(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=WF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(OF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Dj(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Dj(t,e,i,s){if(!OF[e])return t;const n={};return Object.values(OF[e]).forEach((({type:e,name:r})=>{n[r]=Rj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Fj=["animationThreshold","colorScheme","name","padding"];function jj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Fj.includes(r)?n[r]=a:f(a)?VF(a)?n[r]=NF(a,e,s):Sj(a)?n[r]=xj(i,a):n[r]=jj(a,e,i,s):n[r]=a})),n}const zj={[kj.name]:kj},Hj=kj.name,Nj=new Map(Object.keys(zj).map((t=>[t,zj[t]]))),Vj=new Map(Object.keys(zj).map((t=>[t,jj(zj[t])]))),Gj=new Map(Object.keys(zj).map((t=>[t,t===Hj]))),Wj=(t,e)=>{if(!t)return;const i=Xj(e);Nj.set(t,i),Vj.set(t,jj(i)),Gj.set(t,!0)},Uj=(t=Hj,e=!1)=>(Gj.has(t)&&!Gj.get(t)&&Wj(t,Nj.get(t)),e?Vj.get(t):Nj.get(t)),Yj=t=>Nj.delete(t)&&Vj.delete(t)&&Gj.delete(t),Kj=t=>!!_(t)&&Nj.has(t),Xj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Hj;return Oj({},Uj(i),t)};class $j{static registerInstance(t){$j.instances.set(t.id,t)}static unregisterInstance(t){$j.instances.delete(t.id)}static getInstance(t){return $j.instances.get(t)}static instanceExist(t){return $j.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return $j.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}$j.instances=new Map;class qj{static registerTheme(t,e){Wj(t,e)}static getTheme(t,e=!1){return Uj(t,e)}static removeTheme(t){return Yj(t)}static themeExist(t){return Kj(t)}static getDefaultTheme(){return qj.themes.get(Hj)}static setCurrentTheme(t){qj.themeExist(t)&&(qj._currentThemeName=t,$j.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return qj.getTheme(qj._currentThemeName,t)}static getCurrentThemeName(){return qj._currentThemeName}}function Zj(t,e){return _(t)?qj.themeExist(t)?qj.getTheme(t,e):{}:g(t)?t:{}}function Jj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}function Qj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Qj(t[s],e)}return i}return y(t)?t.map((t=>Qj(t,e))):t}qj.themes=Nj,qj._currentThemeName=Hj;function tz(t,e){for(let i=0;it.key===e))}function iz(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},lz(t,a,n[o],l,e,r))})),s?nz(n):n}function nz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nz(t[e].nodes);return t}function rz(t,e){if("values"in t&&t.values.length){const i=iB(t.values,e),s=eB(t.values,BD);t.values.forEach((t=>{t[OD]=i,t[ID]=s,delete t[DD]}));const n=t.values.reduce(((t,e)=>e[ED]>t[ED]?e:t));n[DD]=!0}else for(const i in t.nodes)rz(t.nodes[i],e)}function az(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ED]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[CD]=s,s+=r[ED],r[ED]=s):(r[CD]=n,n+=r[ED],r[ED]=n),r[wD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r,l[BD]=0===h?0:Math.min(1,l[ED]/h)*r}}for(const s in t.nodes)oz(t.nodes[s],e,i)}function lz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[ED]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),lz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const hz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mz(t.style(e,i,s,n)):B(t.style)||(e.style=mz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mz(t.state[e]))})),e.state=i}return e}function pz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e,s,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}function gz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mz(i)}function mz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class fz{static registerChart(t,e){fz._charts[t]=e}static registerSeries(t,e){fz._series[t]=e}static registerComponent(t,e,i){fz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){fz._marks[t]=e}static registerRegion(t,e){fz._regions[t]=e}static registerTransform(t,e){fz.transforms[t]=e}static registerLayout(t,e){fz._layout[t]=e}static registerAnimation(t,e){fz._animations[t]=e}static registerImplement(t,e){fz._implements[t]=e}static registerChartPlugin(t,e){fz._chartPlugin[t]=e}static registerComponentPlugin(t,e){fz._componentPlugin[t]=e}static createChart(t,e,i){if(!fz._charts[t])return null;return new(0,fz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!fz._charts[t])return null;const i=fz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!fz._regions[t])return null;return new(0,fz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!fz._regions[t])return null;return new(0,fz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!fz._series[t])return null;return new(0,fz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!fz._series[t])return null;return new(0,fz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!fz._marks[t])return null;const s=new(0,fz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(fz._components)}static getComponentInKey(t){return fz._components[t].cmp}static getLayout(){return Object.values(fz._layout)}static getLayoutInKey(t){return fz._layout[t]}static getSeries(){return Object.values(fz._series)}static getSeriesInType(t){return fz._series[t]}static getRegionInType(t){return fz._regions[t]}static getAnimationInKey(t){return fz._animations[t]}static getImplementInKey(t){return fz._implements[t]}static getSeriesMarkMap(t){return fz._series[t]?fz._series[t].mark:{}}static getChartPlugins(){return Object.values(fz._chartPlugin)}static getComponentPlugins(){return Object.values(fz._componentPlugin)}static getComponentPluginInType(t){return fz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}fz._charts={},fz._series={},fz._components={},fz._marks={},fz._regions={},fz._animations={},fz._implements={},fz._chartPlugin={},fz._componentPlugin={},fz.transforms={fields:Or,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},fz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},fz._layout={};const vz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},_z=(t,e,i,s)=>{var n;const r=Gw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:yz(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,bz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},xz=(t,e)=>{if(!t)return null;const{x:i,y:s}=e,n=bz(t,(t=>"angle"===t.getOrient()),e),r=bz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Gw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=rB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=aB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=_z(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Gw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=rB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=aB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=_z(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function Sz(t){return"bottom"===t||"top"===t}function Az(t){return"left"===t||"right"===t}function kz(t){return"z"===t}function Mz(t,e){return ZF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Tz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function wz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Sz(t)?"linear":"band":Sz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Cz=t=>t.fieldX[0],Ez=t=>t.fieldY[0],Pz=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Bz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Rz=(t,e)=>t?e?Cz:Pz:e?Ez:Bz,Lz=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=bz(t,(t=>Sz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=bz(t,(t=>Az(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Gw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Oz(s,i,t,Rz(e,Gw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Oz(s,i,t,Rz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Oz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Iz(t,a,s)},Iz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=_z(e,t,"cartesian",null!=i?i:Sz(t.getOrient())?Cz:Ez);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Dz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Qy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Qy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Lz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=xz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Gw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return Sz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Iz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Fz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Fz||(Fz={}));const jz={[Fz.dimensionHover]:class extends Dz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!vz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),nb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),nb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Fz.dimensionClick]:class extends Dz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let zz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(jz[t]){const e=new jz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(jz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Hz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Nz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Vz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new Hz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Nz[a]&&(a=Nz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=St(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=xt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return pD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&ER.hasInteraction(e)}}function Gz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Wz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Uz=new Map;let Yz;function Kz(){Yz||(Yz=new va,Wz(Yz,"geojson",da),Wz(Yz,"topojson",pa),Gz(Yz,"simplify",Rr))}function Xz(t,e,i={type:"geojson",centroid:!0}){Uz.has(t)&&Jy(`map type of '${t}' already exists, will be overwritten.`),Kz();const s=new ya(Yz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Uz.set(t,s)}function $z(t){Uz.has(t)?Uz.delete(t):Jy(`map type of '${t}' does not exists.`)}function qz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Zz=(t,e)=>0===t.length?[]:1===t.length?qz(t[0],null==e?void 0:e.deep):t.map((t=>qz(t,null==e?void 0:e.deep)));function Jz(t,e,i){Gz(e=e instanceof va?e:t.dataSet,"copyDataView",Zz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:eH.copyDataView}),s}function Qz(t,e,i=[],s={}){var n,r,a;if(t instanceof ya)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new ya(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Qy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Qy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Jy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function tH(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var eH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(eH||(eH={}));const iH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:oH(this._option.mode),autoFit:!1,eventConfig:{gesture:nb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(O_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=O_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return sb(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function hH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Qy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function cH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Rj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function dH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ii(l,i.width,i.height);a=t,o=e}else if(h&&sb(e.mode)){let t;t=_(h)?O_.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(rb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function uH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function pH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(rH||(rH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aH||(aH={}));class gH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},gH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}gH.defaultMarkInfo={};class mH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gH,this._markReverse=new gH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(rH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(rH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[rH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[rH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Fz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const fH={};Object.values(rH).forEach((t=>{fH[t]=!0}));const vH={[rH.STATE_HOVER]:rH.STATE_HOVER_REVERSE,[rH.STATE_SELECTED]:rH.STATE_SELECTED_REVERSE,[rH.STATE_DIMENSION_HOVER]:rH.STATE_DIMENSION_HOVER_REVERSE};function _H(t){return vH[t]}class yH{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=_H(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=_H(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=_H(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=_H(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class bH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class xH extends bH{constructor(){super(...arguments),this.id=ob(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class SH extends xH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=nH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class AH extends bH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new SH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class kH extends AH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class MH extends kH{constructor(){super(...arguments),this.id=ob(),this.stateKeyToSignalName=t=>`${pB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===sH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===sH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?sH.none:sH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?sH.exit:"update"===e.diffState?sH.update:sH.appear}}}}class TH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Rj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class wH extends bH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=TH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new gH,this._lastLayoutRect=null,this.id=ob(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${pB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=fz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class CH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=tj(ej(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class EH extends wH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new CH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class PH extends TH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BH extends EH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=PH,this.modelType="region",this.specKey="region",this.type=BH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new yH,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new mH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aH)B(t.stateStyle[aH[e]])||this.interaction.registerMark(aH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function RH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function LH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function OH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function IH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),OH(c,!0,u,o),s&&LH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function DH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),OH(c,!1,u,a),s&&LH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function jH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"left"),n.length&&IH(n,e,i,!0,"left"),r.length&&DH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"top"),n.length&&FH(n,e,i,!0,"top"),r.length&&jH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"right"),n.length&&IH(n,e,i,!0,"right"),r.length&&DH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"bottom"),n.length&&FH(n,e,i,!0,"bottom"),r.length&&jH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Qy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}zH.type="base";const HH=["line","area","trail"];function NH(t){return HH.includes(t)}class VH extends kH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(NH)?s:!t.mark||NH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!fH[t])).map((t=>[t,10])),s=!t.mark||NH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(pB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(pB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(Nw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class GH extends xH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=nH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class WH extends GH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${pB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class UH extends xH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=nH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new VH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new zz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new WH(t)}stateKeyToSignalName(t){return`${pB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=rH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=rH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===sH.appear&&this.runAnimationByState(sH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(sH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class YH extends UH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,te)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Rj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=XF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):ND.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Vw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},UD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=_e.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)ND.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class KH extends YH{constructor(){super(...arguments),this.type=KH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}KH.type="group";const XH=()=>{bM(),aM(),ER.registerGraphic(DB.group,Cu),fz.registerMark(KH.type,KH)},$H={type:"fadeIn"};function qH(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return $H;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ZH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},JH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},QH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},tN=()=>{fz.registerAnimation("scaleInOut",(()=>JH))},eN=()=>{fz.registerAnimation("fadeInOut",(()=>QH))},iN=(t,e)=>({appear:qH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Wc,duration:ZH.update.duration,easing:ZH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),sN=()=>{fz.registerAnimation("line",iN)},nN=()=>{vO.useRegisters([$I,qI,ZI,JI,QI,tD,zI,HI])},rN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Aj.fontFamily,fontSize:Aj.fontSize}))(e,i,s).measure(t)};class aN{static instance(){return aN.instance_||(aN.instance_=new aN),aN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class oN{constructor(){this.id=ob(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class lN extends oN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class hN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>fz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>fz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>fz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return fz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>fz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){fz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}static getFunction(t){return t?aN.instance().getFunction(t):null}static getFunctionList(){return aN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=fz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=fz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Uz.get(e);var e}static hideTooltip(t=[]){$j.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ob(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=xt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=sb(p);v?Rx(th):"node"===p&&PA(th),v&&d&&(this._container=_(d)?O_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=qj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new lH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Vz(this,this._compiler),this._event=new zz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),$j.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Rj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Jj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;hN.getFunctionList()&&hN.getFunctionList().length&&(t=Qj(t,hN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=fz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return dH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:gB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:mB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof va?t:new va,Wz(this._dataSet,"dataview",ga),Wz(this._dataSet,"array",s),Gz(this._dataSet,"stackSplit",iH),Gz(this._dataSet,"copyDataView",Zz);for(const t in fz.transforms)Gz(this._dataSet,t,fz.transforms[t]);for(const t in fz.dataParser)Wz(this._dataSet,t,fz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(d=this._compiler)||void 0===d||d.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?sH.appear:sH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,$j.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof ya?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Qz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=uH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Rj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=Zj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Oj({},Zj(this._currentThemeName,!0),Zj(s,!0),Zj(n,!0));this._currentTheme=t}else{const t=Oj({},Zj(this._currentThemeName),Zj(s),Zj(n));this._currentTheme=jj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!sb(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Zj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield hH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!sb(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?O_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ij(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ij(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return aN.instance().getFunction(t)}registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}getFunctionList(){return aN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=fz.getChartPlugins();t.length>0&&(this._chartPlugin=new lN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}hN.InstanceManager=$j,hN.ThemeManager=qj,hN.globalConfig={uniqueTooltip:!0},hN.Utils=rN,hN.vglobal=O_;fz.registerRegion("region",BH),fz.registerLayout("base",zH),XH(),vO.useRegisters([nI,rI]),vO.useRegisters([oD,lD,NI,VI,rD,aD,hD,cD,dD]),qR(),$R(),Wj(Mj.name,Mj),at.getInstance(rt.Error);const cN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(dB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=fz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=fz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},dN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=cN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Tj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Rj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Rj(m,f),hasChanged:!0};const i=Rj({},t,f);wj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class uN{constructor(t){this.id=ob(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const pN=t=>{fz.registerChartPlugin(t.type,t)};class gN extends uN{constructor(){super(gN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[gN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[gN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=Cj(this._option.globalInstance.getSpec(),["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Cj(this._baseChartSpec,["data",gN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=dN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=Cj(i,["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}gN.pluginType="chart",gN.specKey="media",gN.type="MediaQueryPlugin";const mN=/\{([^}]+)\}/,fN=/\{([^}]+)\}/g,vN=/:/;class _N extends uN{constructor(){super(_N.type),this.type="formatterPlugin",this._timeModeFormat={utc:di.getInstance().timeUTCFormat,local:di.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=yi.getInstance().format,this._numericSpecifier=yi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[_N.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),fz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=mN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(fN,((t,i)=>{if(!vN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(fi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}_N.pluginType="chart",_N.specKey="formatter",_N.type="formatterPlugin";const yN=()=>{pN(_N)};function bN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function xN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function SN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function AN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function kN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function MN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const TN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return FC(v)};class wN extends uN{constructor(){super(wN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Nw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&bN(c)&&bN(d)))return;const u=xN(t,c),p=xN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!AN(u,p))return}else if(0===y&&0===b){if(!AN(p,u))return}else if(_||A)if(_&&!A){if(!SN(u,p))return}else if(A&&!_){if(!SN(p,u))return}else{if(m===b)return;if(m>b){if(!kN(u,p))return}else if(!kN(p,u))return}else{if(0===m&&0===y){if(!MN(u,p))return}else if(0===b&&0===g&&!MN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Gz(e.getOption().dataSet,"tickAlign",TN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}wN.pluginType="component",wN.type="AxisSyncPlugin";const CN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,EN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},ym||(ym=vm.CreateGraphic("richtext",{})),ym.setAttributes(a),ym.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},PN="vchart-tooltip-container",BN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function RN(t,e){return R(e,`component.${t}`)}function LN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=fz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const ON={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function IN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function DN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function FN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function jN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?RN("axisBand",i):["linear","log","symlog"].includes(e)?RN("axisLinear",i):{})&&void 0!==s?s:{},r=Sz(t)?RN("axisX",i):Az(t)?RN("axisY",i):RN("axisZ",i);return Rj({},RN("axis",i),n,r)},HN=(t,e,i)=>{var s;const n=null!==(s="band"===e?RN("axisBand",i):"linear"===e?RN("axisLinear",i):{})&&void 0!==s?s:{},r=RN("angle"===t?"axisAngle":"axisRadius",i);return Rj({},RN("axis",i),n,r)},NN=t=>"band"===t||"ordinal"===t||"point"===t;function VN(t,e){return{id:t,label:t,value:e,rawValue:t}}function GN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function WN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const UN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Gw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Nw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=WN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=IN(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Gw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Nw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=WN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=IN(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(KN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&YN(t,"top",r.label),e.visible&&YN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(KN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&YN(t,"left",a.label),e.visible&&YN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},YN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=LN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},KN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},XN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=qN(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},$N=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=qN(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},qN=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},ZN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},JN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},QN=(t,e)=>{var i,s;return null!==(s=null===(i=JN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},tV=(t,e)=>{var i,s;return null!==(s=null===(i=JN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},eV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=UN(3,e,i,s,n,r,a);return o?XN(r,o,d,h):l?$N(a,l,u,c):void 0},iV={fontFamily:Aj.fontFamily,spacing:10,wordBreak:"break-word"};function sV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:iV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},rV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,aV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),oV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function lV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=hV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>aV(i,s)(t)&&aV(n,r)(t)&&(u(a)||aV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(u.id),d}return"none"}const hV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=rV(c,t);let _=rV(d,t);const y=oV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(aV(c,v));if(!y&&(_=rV(d,i),!oV(_)))return;const n=e.type===dB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Gw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(aV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=rV(d,o),!oV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(aV(c,n));if(!y&&(_=rV(d,r),!oV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===dB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(aV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=rV(d,i),!oV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},cV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const dV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class uV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class pV extends uV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:mV(e.title,{seriesId:this.series.id},!0),content:fV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=cV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const gV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},mV=(t,e,i)=>p(t)?d(t)?(...s)=>gV(t(...s),e,i):gV(t,e,i):void 0,fV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>gV(t,e,i))):gV(t,e,i))):void 0;return s},vV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=dV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=dV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},_V=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=yV(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&cV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},yV=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),bV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},xV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=LN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},AV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class kV{}kV.dom=`${pB}_TOOLTIP_HANDLER_DOM`,kV.canvas=`${pB}_TOOLTIP_HANDLER_CANVAS`;const MV=20,TV={key:"其他",value:"..."},wV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=di.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},CV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=AV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==SV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:wV(SV(c,t,i,v),p,g),valueStyle:SV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=MV}=t,x=t.othersLine?Object.assign(Object.assign({},TV),t.othersLine):TV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=EV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=EV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},EV=(t,e,i)=>{const s=wV(SV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=wV(SV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==SV(e.visible,t,i)&&(p(s)||p(n)),a=SV(e.isKeyAdaptive,t,i),o=SV(e.spaceRow,t,i),l=SV(e.shapeType,t,i),h=SV(e.shapeColor,t,i),c=SV(e.shapeFill,t,i),d=SV(e.shapeStroke,t,i),u=SV(e.shapeLineWidth,t,i),g=SV(e.shapeHollow,t,i),m=SV(e.keyStyle,t,i),f=SV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class PV extends uN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=AV(x.position,b,e),M=null!==(n=AV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:gB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:mB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(sb(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=CN(t,e),j=CN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=eV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(QN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=eV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(tV(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=ZN(t,c),N=ZN(i,c),V=ZN(e,c),G=ZN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=ZN(t,c):Y(t),S(e)||d(e)?N=ZN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(QN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(tV(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,sb(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===QN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===QN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===tV(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===tV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(QN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(tV(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,St(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},BN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:BN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:BN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ei(d.padding),x=ej(d.padding),S=sV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=sV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=sV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:nV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Rj({},A,sV(b,void 0,{})),{width:s,height:n,text:r}=EN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Rj({},k,sV(x,void 0,{})),{width:e,height:s,text:n}=EN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Rj({},S,sV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=EN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(sb(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=CN(t,s),u=CN(l,c)}return s*=d,n*=d,sb(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(De(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Xe([c,a,o],r.x,r.y)||Xe([c,l,h],r.x,r.y)||Xe([c,a,h],r.x,r.y)||Xe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}PV.specKey="tooltip";const BV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",RV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let LV;const OV=(t=document.body)=>{if(u(LV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),LV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return LV};function IV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Rj({},e,t),s={};return s.width=BV(i),s}(C),R=DV(E),L=DV(P),{bottom:O,left:I,right:D,top:F}=ej(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:BV(T+2*M),minHeight:BV(g+2*M),paddingBottom:BV(O),paddingLeft:BV(I),paddingRight:BV(D),paddingTop:BV(F),borderColor:k,borderWidth:BV(M),borderRadius:BV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?BV(null==r?void 0:r.spaceRow):"0px"},DV(Rj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return FV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=FV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==ib?void 0:ib.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(FV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}FV.type="tooltipModel";const jV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},zV={boxSizing:"border-box"},HV={display:"inline-block",verticalAlign:"top"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},GV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},WV={lineHeight:"normal",boxSizing:"border-box"};class UV extends FV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=RV(u),y=t=>new Ag({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class YV extends FV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const KV={overflowWrap:"normal",wordWrap:"normal"};class XV extends FV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Rj({},HV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Rj({},o?VV:NV,Object.assign(Object.assign(Object.assign({height:BV(l)},KV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Rj({},GV,Object.assign(Object.assign(Object.assign({height:BV(s)},KV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Rj({},WV,Object.assign(Object.assign({height:BV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class $V extends FV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new XV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Rj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+RV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+OV(this._option.getContainer())}px`,maxHeight:BV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class qV extends FV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new UV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new YV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Rj({},jV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const ZV="99999999999999";class JV extends FV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:ZV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new qV(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new $V(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Rj({},zV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const QV=t=>{fz.registerComponentPlugin(t.type,t)};class tG extends PV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(tG.type),this.type=kV.dom,this._tooltipContainer=null==ib?void 0:ib.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(ib&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=IV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!si(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}tG.type=kV.dom;class eG extends PV{constructor(){super(eG.type),this.type=kV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new JP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}eG.type=kV.canvas;const iG=()=>{QV(eG)},sG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},nG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tz([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return aG(a,n,o)},aG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{lb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{lb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{lb(t[e])||(t[e]=0)}))})),t};class lG extends GH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hG=`${pB}_HIERARCHY_DEPTH`,cG=`${pB}_HIERARCHY_ROOT`,dG=`${pB}_HIERARCHY_ROOT_INDEX`;function uG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pG(t,e,i){t&&(i.needDefaultSeriesField&&(t[kD]=i.defaultSeriesField),t[SD]=e,t[AD]=i.getKey(t,e,i))}function gG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mG(t,e,i,s=0,n,r){void 0===r&&(r=e),pG(t,e,i),t[hG]=s,t[cG]=n||t[i.categoryField],t[dG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mG(e,s,i,t[hG]+1,t[cG],r)))}const fG=["appear","enter","update","exit","disappear","normal"];function vG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return SG(n)&&delete n.type,n.oneByOne&&(n=yG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Rj({},o[e],a);return SG(n)&&delete n.type,n.oneByOne&&(n=yG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function _G(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),AG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function yG(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function bG(t,e){var i,s;return null!==(i=null==t?void 0:t[SD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function xG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function SG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function AG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),AG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),AG(t[i],e)}function kG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class MG extends TH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=IF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Dj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Rj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Rj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Rj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class TG extends wH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${pB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=MG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=kG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"invalidTravel",oG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Qz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Jz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Jz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=aG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Gz(this._dataSet,"dimensionStatistics",rG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ya(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tz(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Gz(this._dataSet,"dimensionStatistics",rG);const s=new ya(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tz(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tz(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ya(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",sG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=vG({},_G(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:nb(s)||rb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Rj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Rj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:rH.STATE_HOVER_REVERSE,highlightState:rH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:rH.STATE_SELECTED_REVERSE,state:rH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:kD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:MD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,MD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new pV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},ZD),JD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>JD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ya||tH(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();kG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:kD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new YF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return jF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:kD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Rj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:AD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ED&&t!==BD&&t!==CD&&t!==PD||(t=this.getStackValueField()),null!==(e=iz(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=OF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>lb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:kD]}}function wG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Nw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function CG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}TG.mark=YD,TG.transformerConstructor=MG;class EG extends TG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Nw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${pB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(BD),this.setFieldX2(PD)):(this.setFieldY(BD),this.setFieldY2(PD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(LD),this.setFieldX2(RD)):(this.setFieldY(LD),this.setFieldY2(RD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(wG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const PG="monotone",BG="linear";class RG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(eF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:BG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===PG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(eF.point,{morph:xG(this._spec,eF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new ya(this._option.dataSet,{name:`${pB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[eF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Rj({},this._spec[eF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class LG extends YH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Vw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class OG extends LG{constructor(){super(...arguments),this.type=OG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===dB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}OG.type="line";const IG=()=>{fz.registerMark(OG.type,OG),bM(),cM(),ER.registerGraphic(DB.line,wg),nN()};class DG extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class FG extends DG{constructor(){super(...arguments),this.type=FG.type}}FG.type="symbol";const jG=()=>{fz.registerMark(FG.type,FG),xO()};class zG extends MG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class HG extends oN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function NG(t,e,i,s){switch(t){case r.cartesianBandAxis:return zN(Mz(i,["z"]),"band",e);case r.cartesianLinearAxis:return zN(Mz(i,["z"]),"linear",e);case r.cartesianLogAxis:return zN(Mz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return zN(Mz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return zN(Mz(i),void 0,e);case r.polarBandAxis:return HN(i.orient,"band",e);case r.polarLinearAxis:return HN(i.orient,"linear",e);case r.polarAxis:return HN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=RN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>Sz(t.orient)));let d;d=p(c)?Rj({},NN(c.type)?a:o,l):l;const u=n.find((t=>Az(t.orient)));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=RN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Rj({},NN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return VG(i,RN(t,e));default:return RN(t,e)}}const VG=(t,e)=>{var i;const s=Rj({},e,e[Tz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class GG extends TH{getTheme(t,e){return NG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},ej(e)),{[s]:0}))}}class WG extends EH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new HG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=GG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof rc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}WG.transformerConstructor=GG;class UG extends YH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(DB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}UG.type="component";const YG=()=>{fz.registerMark(UG.type,UG)},KG=t=>t;class XG extends WG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?HB.circleAxisGrid:HB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=vG(null===(o=fz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new GH(this._option,t)]}collectData(t,e){const i=[];return oB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Nw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return oB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(oB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uz(s=t.domainLine)).startSymbol=uz(s.startSymbol),s.endSymbol=uz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mz(Rj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mz(t.tick.style)),t.tick.state&&(i.tick.state=pz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mz(t.subTick.style)),t.subTick.state&&(i.subTick.state=pz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=ON[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Rj({},d,mz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mz(h.style)}),h.state&&(i.title.state.shape=pz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mz(o.style)}),o.state&&(i.title.state.background=pz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mz(t.background.style)),t.background.state&&(i.panel.state=pz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mz(Rj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=LN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Wz(this._option.dataSet,"scale",KG),Gz(this._option.dataSet,"ticks",qC);return new ya(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}XG.specKey="axes";const $G=()=>{ER.registerGraphicComponent(zB.lineAxis,((t,e)=>new Lw(t,e))),ER.registerGraphicComponent(zB.circleAxis,(t=>new Fw(t))),ER.registerComponent(FB.axis,VO),ER.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new tE(t,e))),ER.registerGraphicComponent(HB.circleAxisGrid,((t,e)=>new iE(t,e))),ER.registerComponent(FB.grid,UO),YG(),fz.registerAnimation("axis",(()=>({appear:{custom:zw},update:{custom:jw},exit:{custom:Xc}})))},qG=[wN];class ZG extends XG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{const e=this.getOrient();Sz(e)?t.setXAxisHelper(this.axisHelper()):Az(e)?t.setYAxisHelper(this.axisHelper()):kz(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Rj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Rj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Sz(this.getOrient()),n=t=>{var e;return(s?!Sz(t.getOrient()):Sz(t.getOrient()))&&Nw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=Mz(i,["z"]),kz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!FN(e))return null;const{axisType:t,componentName:s}=wz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!FN(t))return;const{axisType:s,componentName:n}=wz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];Sz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):kz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(qG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){Sz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Sz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!kz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Sz(this.getOrient())?t.fieldX:kz(this.getOrient())?t.fieldZ:t.fieldY,Nw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(Sz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Sz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return oB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:Sz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:kz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();oB(this._regions,(e=>{Sz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Az(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):kz(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Sz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=Sz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Rj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return VN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=DN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=JG?10:n>=QG?5:n>=tW?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class iW extends ZG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}iW.type=r.cartesianLinearAxis,iW.specKey="axes",U(iW,eW);const sW=()=>{$G(),fz.registerComponent(iW.type,iW)};class nW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=VN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>VN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class rW extends ZG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=eC(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$G(),fz.registerComponent(rW.type,rW)};class oW extends iW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{Sz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Rj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new GH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=di.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>VN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>VN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}oW.type=r.cartesianTimeAxis,oW.specKey="axes";class lW extends iW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new OC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}lW.type=r.cartesianLogAxis,lW.specKey="axes",U(lW,eW);class hW extends iW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new IC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}hW.type=r.cartesianSymlogAxis,hW.specKey="axes",U(hW,eW);class cW extends EG{constructor(){super(...arguments),this.type=dB.line,this.transformerConstructor=zG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),_G("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=CG(this);this._symbolMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_G("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}cW.type=dB.line,cW.mark=iF,cW.transformerConstructor=zG,U(cW,RG);class dW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{tH(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ya)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class uW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{hb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tz(e,[{key:t,operations:Nw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tz(e,[{key:i.field,operations:Nw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?XF("colorOrdinal"):XF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(hb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),hb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!hb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Nw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Nw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Nw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Nw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class pW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=sz(t,!0);for(const e in a)for(const i in a[e].nodes)oz(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)az(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class gW extends bH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ob(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:gB,height:mB},this._viewRect={width:gB,height:mB},this._viewBox={x1:0,y1:0,x2:gB,y2:mB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=ej(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new zz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new dW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new pW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=fz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=fz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof YH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof YH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&tH(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=dH(this._spec,this._option,{width:gB,height:mB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=jF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new uW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){uH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=jF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{uH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,uH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):uH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=tj(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(rH.STATE_SELECTED)}clearHovered(){this.clearState(rH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Fz.dimensionHover||s===Fz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Gw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class fW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);wj(t,r,l.spec),wj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));wj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=fz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class vW extends fW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Rj(i,pH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class _W extends vW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class yW extends gW{constructor(){super(...arguments),this.transformerConstructor=_W,this.type="line",this.seriesType=dB.line,this._canStack=!0}}yW.type="line",yW.seriesType=dB.line,yW.transformerConstructor=_W;class bW extends LG{constructor(){super(...arguments),this.type=bW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}bW.type="area";const xW=()=>{fz.registerMark(bW.type,bW),bM(),tM(),ER.registerGraphic(DB.area,$g),nN()};class SW extends pV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const AW=()=>{fz.registerAnimation("area",iN),sN(),tN()};class kW extends zG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Rj({},m.style,g.style),l.state=Rj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class MW extends EG{constructor(){super(...arguments),this.type=dB.area,this.transformerConstructor=kW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(MW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===PG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return $F(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return $F(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),_G("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),_G("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=CG(this);this._symbolMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_G("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new SW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}MW.type=dB.area,MW.mark=nF,MW.transformerConstructor=kW,U(MW,RG);class TW extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class wW extends gW{constructor(){super(...arguments),this.transformerConstructor=TW,this.type="area",this.seriesType=dB.area,this._canStack=!0}}wW.type="area",wW.seriesType=dB.area,wW.transformerConstructor=TW;function CW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CW(t,e)}),PW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:CW(t,e)}),BW={type:"fadeIn"},RW={type:"growCenterIn"};function LW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BW;case"scaleIn":return RW;default:return EW(t)}}class OW extends YH{constructor(){super(...arguments),this.type=OW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}OW.type="rect";const IW=()=>{fz.registerMark(OW.type,OW),yO(),vO.useRegisters([UI,YI,KI,XI,GI,WI])};function DW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):$F(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[XD]):$F(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):$F(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[qD]):$F(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},zW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:xG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(zW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Gz(this._option.dataSet,"addVChartProperty",sG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Gz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ya(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=qD,s=$D,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=XD,s=KD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)DW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=$F(this[n](t),o),d=$F(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[CD],n=t[ED],r=t[PD],h=t[BD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[CD]:i,[ED]:s}),a?{[PD]:o,[BD]:l}:void 0);t.push(Pg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>$F(this._dataToPosY(t),a),y1:t=>$F(this._dataToPosY1(t),a)}:{y:t=>$F(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>$F(this._dataToPosX(t),r),x1:t=>$F(this._dataToPosX1(t),r)}:{x:t=>$F(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=CG(this);this._barMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),_G(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=sj(this._spec.barWidth,a)),l&&(c=Math.max(c,sj(this._spec.barMinWidth,a))),h&&(c=Math.min(c,sj(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sj(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=Nw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}zW.type=dB.bar,zW.mark=QD,zW.transformerConstructor=jW;const HW=()=>{aI(),IW(),fz.registerAnimation("bar",((t,e)=>({appear:LW(t,e),enter:EW(t,!1),exit:PW(t,!1),disappear:PW(t)}))),aW(),sW(),fz.registerSeries(zW.type,zW)};class NW extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),cH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class VW extends gW{constructor(){super(...arguments),this.transformerConstructor=NW,this.type="bar",this.seriesType=dB.bar,this._canStack=!0}}VW.type="bar",VW.seriesType=dB.bar,VW.transformerConstructor=NW;class GW extends YH{constructor(){super(...arguments),this.type=GW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}GW.type="rect3d";class WW extends zW{constructor(){super(...arguments),this.type=dB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}WW.type=dB.bar3d,WW.mark=tF;class UW extends NW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class YW extends VW{constructor(){super(...arguments),this.transformerConstructor=UW,this.type="bar3d",this.seriesType=dB.bar3d}}YW.type="bar3d",YW.seriesType=dB.bar3d,YW.transformerConstructor=UW;const KW=[10,20],XW=Iw.Linear,$W="circle",qW=Iw.Ordinal,ZW=["circle","square","triangle","diamond","star"],JW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class QW extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class tU extends EG{constructor(){super(...arguments),this.type=dB.scatter,this.transformerConstructor=QW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${pB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${pB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:XW,defaultRange:KW},"size")}getShapeAttribute(t,e){return u(e)?$W:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qW,defaultRange:ZW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(tU.mark.point,{morph:xG(this._spec,tU.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=CG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),_G("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:$W},rH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}tU.type=dB.scatter,tU.mark=sF,tU.transformerConstructor=QW;const eU=()=>{jG(),fz.registerAnimation("scatter",((t,e)=>Object.assign({appear:JW(0,e)},JH))),aW(),sW(),fz.registerSeries(tU.type,tU)};class iU extends vW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class sU extends gW{constructor(){super(...arguments),this.transformerConstructor=iU,this.type="scatter",this.seriesType=dB.scatter,this._canStack=!0}}sU.type="scatter",sU.seriesType=dB.scatter,sU.transformerConstructor=iU;Ln();const nU={},rU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function aU(t,e){t&&_(t)||ub("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(nU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ln().projection(s),s.copy=s.copy||function(){const t=i();return rU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),nU[i]||null}const oU={albers:Jn,albersusa:function(){var t,e,i,s,n,r,a=Jn(),o=Zn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Zn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(oU).forEach((t=>{aU(t,oU[t])}));const lU="Feature",hU="FeatureCollection";function cU(t){const e=Y(t);return 1===e.length?e[0]:{type:hU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===hU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===lU?t:{type:lU,geometry:t}))}(e))),[])}}const dU=rU.concat(["pointRadius","fit","extent","size"]);function uU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{dU.includes(s)&&(i=i.concat(fR(t[s],e)))})),i):i}let pU=class extends tL{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(fR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(fR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(fR(this.spec.size,this.view)),this.spec.size=t,this.attach(fR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(fR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(fR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(fR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(fR(t,this.view)),this.commit(),this}configure(t){return this.detach(uU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(uU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=aU((t||"mercator").toLowerCase());return e||ub("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),rU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,_R(this.spec[t],e,aU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(_R(this.spec.pointRadius,e,aU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=cU(_R(this.spec.fit,e,aU));this.spec.extent?this.projection.fitExtent(_R(this.spec.extent,e,aU),t):this.spec.size&&this.projection.fitSize(_R(this.spec.size,e,aU),t)}return this.projection}output(){return this.projection}};const gU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class mU extends TG{constructor(){super(...arguments),this.type=dB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${pB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const fU=`${pB}_MAP_LOOK_UP_KEY`,vU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[SD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[fU]=e.nameMap[n]:t[fU]=n})),t.features);class _U extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class yU extends YH{constructor(){super(...arguments),this.type=yU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}yU.type="path";const bU=()=>{fz.registerMark(yU.type,yU),_O()};class xU{constructor(t){this.projection=aU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class SU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class AU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function kU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:SU}:nb(e)||rb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:AU}:null}const MU={debounce:xt,throttle:St};class TU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=nb(this._renderMode)||rb(this._renderMode),kU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return kU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,MU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,MU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||kU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:De({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,MU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,MU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){kU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;De({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||kU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||kU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=MU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=MU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function wU(t,e){return`${pB}_${e}_${t}`}class CU extends WG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:wU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Rj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new xU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===dB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),oB(this._regions,(t=>{var e;if(t.type===dB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new oe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===dB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}CU.type=r.geoCoordinate,U(CU,TU);const EU=()=>{fz.registerComponent(CU.type,CU)};class PU extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class BU extends mU{constructor(){super(...arguments),this.type=dB.map,this.transformerConstructor=PU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Uz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Gz(this._dataSet,"copyDataView",Zz),Gz(this._dataSet,"map",vU),Gz(this._dataSet,"lookup",gU);const i=Uz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ya(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:eH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:fU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lG(this._option,s)}initMark(){this._pathMark=this._createMark(BU.mark.area,{morph:xG(this._spec,BU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:kD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(vG(null===(t=fz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),_G("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new _U(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[SD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[SD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new oe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new oe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return SD}getActiveMarks(){return[this._pathMark]}}BU.type=dB.map,BU.mark=hF,BU.transformerConstructor=PU;const RU=()=>{ER.registerGrammar("projection",pU,"projections"),EU(),bU(),fz.registerSeries(BU.type,BU),fz.registerImplement("registerMap",Xz),fz.registerImplement("unregisterMap",$z),eN()},LU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[DD]=!0:delete t[DD]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=OU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=IU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Kt(_,e)):(t[c]=+y,y=Kt(y,e)),t[d]=Kt(t[c],e),f=Kt(f,e),b=Xt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=OU(a,t,n,r,h,l,i,e),r.push(n)})),r};function OU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=IU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Kt(i.positive,e)):(t[h]=+i.negative,i.negative=Kt(i.negative,e)),t[c]=Kt(t[h],e),i.end=Kt(i.end,e)}i.isTotal=e,(u(p)||p===vD)&&(t[vD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function IU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Jy("total.collectCountField error"):n=e[a].start;o<0?Jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Kt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const DU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Kt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},FU={type:"fadeIn"},jU={type:"growCenterIn"};function zU(t,e){switch(e){case"fadeIn":return FU;case"scaleIn":return jU;default:return EW(t,!1)}}class HU extends YH{constructor(){super(...arguments),this.type=HU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}HU.type="rule";const NU=()=>{fz.registerMark(HU.type,HU),bO()},VU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:GU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function GU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>GU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class WU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ya(e instanceof va?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Gz(e,"dimensionTree",VU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class UU extends jW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const YU={rect:ZU,symbol:$U,arc:QU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=$U(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tY,line:eY,area:eY,rect3d:ZU,arc3d:QU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function KU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=LN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function XU(t){return d(t)?e=>t(e.data):t}function $U(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QU(t){var e;const{labelSpec:i}=t,s=null!==(e=XU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tY(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=KU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),yp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class iY extends zW{constructor(){super(...arguments),this.type=dB.waterfall,this.transformerConstructor=UU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new WU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=vD)}getSeriesKeys(){return this._seriesField===vD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Gz(this._dataSet,"waterfallFillTotal",DU),Gz(this._dataSet,"waterfall",LU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Jz(this.getViewData(),this._dataSet,{name:`${pB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:CD,endAs:ED,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=CG(this);this._barMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),_G("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(iY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Xt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tY(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?$F(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):$F(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}iY.type=dB.waterfall,iY.mark=_F,iY.transformerConstructor=UU;const sY=()=>{NU(),IW(),fz.registerAnimation("waterfall",((t,e)=>({appear:zU(t,e),enter:EW(t,!1),exit:PW(t,!1),disappear:PW(t,!1)}))),eN(),aW(),sW(),fz.registerSeries(iY.type,iY)},nY=`${pB}_BOX_PLOT_OUTLIER_VALUE`;var rY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(rY||(rY={}));const aY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[nY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class oY extends pV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===rY.OUTLIER)return this.series.getOutliersField();if(t===rY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case rY.MIN:return this.series.getMinField();case rY.MAX:return this.series.getMaxField();case rY.MEDIAN:return this.series.getMedianField();case rY.Q1:return this.series.getQ1Field();case rY.Q3:return this.series.getQ3Field();case rY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===rY.OUTLIER)return e[nY];if(t===rY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case rY.MIN:return e[this.series.getMinField()];case rY.MAX:return e[this.series.getMaxField()];case rY.MEDIAN:return e[this.series.getMedianField()];case rY.Q1:return e[this.series.getQ1Field()];case rY.Q3:return e[this.series.getQ3Field()];case rY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[nY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(rY.OUTLIER),value:this.getContentValue(rY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(rY.MAX),value:this.getContentValue(rY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.Q3),value:this.getContentValue(rY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.MEDIAN),value:this.getContentValue(rY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.Q1),value:this.getContentValue(rY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.MIN),value:this.getContentValue(rY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(rY.SERIES_FIELD),value:this.getContentValue(rY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class lY extends YH{constructor(){super(...arguments),this.type=lY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}lY.type="boxPlot";const hY=()=>{fz.registerMark(lY.type,lY),ER.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(wO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ab(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ab(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),ER.registerAnimationType("boxplotScaleIn",CO),ER.registerAnimationType("boxplotScaleOut",EO),AO(),yO(),bO(),ER.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(BO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ab(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),ER.registerAnimationType("barBoxplotScaleIn",RO),ER.registerAnimationType("barBoxplotScaleOut",LO),AO(),yO(),bO()};class cY extends EG{constructor(){super(...arguments),this.type=dB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(cY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(cY.mark.outlier,{progressive:t,key:SD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,rH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>$F(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>$F(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>$F(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>$F(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>$F(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},rH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>$F(e(this.getDatumPositionValues(t,nY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>$F(e(this.getDatumPositionValues(t,nY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,rH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"foldOutlierData",aY),Gz(this._dataSet,"addVChartProperty",sG);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${pB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._outlierDataView=new lG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=CG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=fz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(_G("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(vG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(vG(null===(a=fz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new oY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}cY.type=dB.boxPlot,cY.mark=yF;class dY extends YH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=dY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}dY.type="text";const uY=()=>{fz.registerMark(dY.type,dY),SO(),bM(),_M(),ER.registerGraphic(DB.richtext,Gg)};function pY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class gY extends pV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const mY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),fY={type:"fadeIn"},vY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function _Y(t,e){return"fadeIn"===e?fY:mY(t)}class yY extends jW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class bY extends zW{constructor(){super(...arguments),this.type=dB.rangeColumn,this._barMarkType="rect",this._barName=dB.bar,this.transformerConstructor=yY}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(bY.mark.bar,{morph:xG(this._spec,bY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(bY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(bY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});pY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});pY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=CG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),_G("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(vG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),_G("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new gY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}bY.type=dB.rangeColumn,bY.mark=MF,bY.transformerConstructor=yY;const xY=()=>{IW(),uY(),fz.registerAnimation("rangeColumn",((t,e)=>({appear:_Y(t,e),enter:mY(t),exit:vY(t),disappear:vY(t)}))),eN(),aW(),sW(),fz.registerSeries(bY.type,bY)};class SY extends bY{constructor(){super(...arguments),this.type=dB.rangeColumn3d,this._barMarkType="rect3d",this._barName=dB.bar3d}}SY.type=dB.rangeColumn3d,SY.mark=TF;class AY extends pV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class kY extends MW{constructor(){super(...arguments),this.type=dB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(kY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new AY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}kY.type=dB.rangeArea,kY.mark=PF;class MY extends TG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=LB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Nw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Nw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&wG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const TY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{asStartAngle:s,asEndAngle:n,asMiddleAngle:r,asRadian:a,asRatio:o,asQuadrant:l,asK:h}=e,c=e.angleField(),d=e.startAngle(),u=e.endAngle(),p=e.minAngle(),g=(t,e,i)=>{t[s]=e,t[n]=e+i,t[r]=e+i/2,t[a]=i,t[l]=function(t){return(t=re(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[c]))),y=u-d;let b=d,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[SB],s=m?i/m:0;let n=s*y;n{g(e,d+i*t,t)}))}else{const t=x/S;b=d,i.forEach((e=>{const i=e[a]===p?p:e[SB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][n]=u),i};function wY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const CY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:wY(t,!0,sH.appear)}),EY={type:"fadeIn"},PY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:wY(t,!0,sH.enter)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:wY(t,!0,sH.exit)}),RY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:wY(t,!0,sH.exit)});function LY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return EY;case"growRadius":return CY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return CY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class OY extends YH{constructor(t,e){super(t,e),this.type=IY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>se({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[wB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class IY extends OY{constructor(){super(...arguments),this.type=IY.type}}IY.type="arc";const DY=()=>{bM(),Jk(),ER.registerGraphic(DB.arc,Jg),vO.useRegisters([sD,nD,eD,iD]),fz.registerMark(IY.type,IY)};class FY extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Rj({},this._theme,i,t);const n=(t,e)=>Rj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const jY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:RB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:LB,layoutRadius:e.layoutRadius}},zY=(t,e,i,s=0,n=0*Math.PI)=>{if(S(t))return t;if(d(t))return t(e(),i());const r=e();return"auto"===t&&r.width>0&&r.height>0?ae(r,i(),s,n):Math.min(r.width/2,r.height/2)};class HY extends MY{constructor(){super(...arguments),this.transformerConstructor=FY,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}},this._startAngle=PB,this._endAngle=BB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[wB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return se(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?te(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?te(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?te(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Gz(this._dataSet,"pie",TY),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?te(this._spec.minAngle):0,asStartAngle:kB,asEndAngle:MB,asRatio:AB,asMiddleAngle:wB,asRadian:EB,asQuadrant:CB,asK:TB}},!1);const e=new ya(this._dataSet,{name:`${pB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},HY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:xG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:AD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return cB(kB)(t)}endAngleScale(t){return cB(MB)(t)}_computeLayoutRadius(){return zY(this._spec.layoutRadius,this.getLayoutRect,this.getCenter,this._startAngle,this._endAngle)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:qF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:qF(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:cB(yB).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[wB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return se(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===sH.appear)return this._startAngle;if(i===sH.disappear)return this._endAngle;const n=[sH.disappear,sH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[SD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[wB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[wB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[wB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[wB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}HY.transformerConstructor=FY,HY.mark=aF;class NY extends HY{constructor(){super(...arguments),this.type=dB.pie}}NY.type=dB.pie;const VY=()=>{DY(),fz.registerAnimation("pie",((t,e)=>({appear:LY(t,e),enter:PY(t),exit:BY(t),disappear:RY(t)}))),fz.registerSeries(NY.type,NY)};class GY extends OY{constructor(){super(...arguments),this.type=GY.type,this._support3d=!0}}GY.type="arc3d";class WY extends FY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class UY extends HY{constructor(){super(...arguments),this.type=dB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=WY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[wB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}UY.type=dB.pie3d,UY.mark=oF,UY.transformerConstructor=WY;const YY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},KY={type:"fadeIn"},XY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),$Y=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),qY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function ZY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return KY;case"growAngle":return YY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return YY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class JY extends MY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(ED),this.setInnerRadiusField(CD)}setValueFieldToPercent(){this.setRadiusField(BD),this.setInnerRadiusField(PD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class QY extends MG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class tK extends XG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!jN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=jY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s,n;const r=[],a=[];return e.forEach(((e,o)=>{if(!jN(e))return;const{axisType:l,componentName:h,startAngle:c,endAngle:d,center:u,outerRadius:p,layoutRadius:g}=jY(e,t);e.center=u,e.startAngle=c,e.endAngle=d,e.outerRadius=p,e.type=l,e.layoutRadius=g;const m={spec:e,specPath:[this.specKey,o],specInfoPath:["component",this.specKey,o],type:h};i.push(m),"radius"===e.orient?(r.push(m),n=o):(a.push(m),s=o)})),r.forEach((t=>{t.angleAxisIndex=s})),a.forEach((t=>{t.radiusAxisIndex=n})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=PB,this._endAngle=BB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:IN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){oB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Nw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return se(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>VN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=qt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return zY(this._spec.layoutRadius,this.getRefLayoutRect,this.getCenter,this._startAngle,this._endAngle)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=LB,e=0;const i=this.getChart().getSpec();return oB(this.getRegions(),(s=>{const n=s;if(r=n.type,[dB.rose,dB.radar,dB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Rj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Rj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}tK.type=r.polarAxis,tK.specKey="axes";class eK extends tK{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}eK.type=r.polarLinearAxis,eK.specKey="axes",U(eK,eW);const iK=()=>{$G(),fz.registerComponent(eK.type,eK)};class sK extends tK{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}sK.type=r.polarBandAxis,sK.specKey="axes",U(sK,nW);const nK=()=>{$G(),fz.registerComponent(sK.type,sK)};class rK extends JY{constructor(){super(...arguments),this.type=dB.rose,this.transformerConstructor=QY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(rK.mark.rose,{morph:xG(this._spec,rK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>$F(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=$F(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),_G("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rK.type=dB.rose,rK.mark=lF,rK.transformerConstructor=QY;const aK=()=>{fz.registerSeries(rK.type,rK),DY(),fz.registerAnimation("rose",((t,e)=>({appear:ZY(t,e),enter:XY(t),exit:$Y(t),disappear:qY(t)}))),nK(),iK()};class oK extends yc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,QP(this._fromAngle,this._toAngle)&&QP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class lK extends Wc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=re(s.angle),a=re(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=re(o.angle),c=re(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new $t(m,f,v,_);return y.defined=e.defined,y}}const hK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cK(t,e,i){return"fadeIn"===e?hK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dK(t,e,i){return"fadeIn"===e?hK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const uK=(t,e)=>({custom:Yc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class pK extends JY{constructor(){super(...arguments),this.type=dB.radar,this.transformerConstructor=zG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(pK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:BG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?te(this._spec.startAngle):PB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),_G("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=fz.getAnimationInKey(e);t.setAnimationConfig(vG(null==i?void 0:i(n,r),_G(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}pK.type=dB.radar,pK.mark=rF,pK.transformerConstructor=zG,U(pK,RG);const gK=()=>{fz.registerSeries(pK.type,pK),oI(),xW(),IG(),jG(),fz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cK(t,e,"in"),enter:cK(t,e,"in"),exit:cK(t,e,"out"),disappear:"clipIn"===e?void 0:cK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:lK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:oK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarGroup",((t,e)=>({appear:uK(t,"in"),disappear:uK(t,"out")}))),Jk(),nK(),iK()};class mK extends pV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>di.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const fK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},vK={fill:"#bbb",fillOpacity:.2};class _K extends EG{constructor(){super(...arguments),this.type=dB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Gz(this._option.dataSet,"objFlat",fK),Gz(this._option.dataSet,"copyDataView",Zz),Wz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:eH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Rj(vK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(_K.mark.group),this._containerMark=this._createMark(_K.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(_K.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(_K.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(_K.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(_K.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(_K.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(_K.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new YF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:kD}}initTooltip(){this._tooltipHelper=new mK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}_K.type=dB.dot,_K.mark=pF;class yK extends pV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>di.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const bK=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class xK extends EG{constructor(){super(...arguments),this.type=dB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Gz(this._option.dataSet,"linkDotInfo",bK),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:eH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(xK.mark.group),this._containerMark=this._createMark(xK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(xK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(xK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new yK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}xK.type=dB.link,xK.mark=uF;class SK extends MY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:FD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ED:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=te(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?te(n):PB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):BB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[ED]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(SK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+te(s),n=te(i)/2;return Jg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Pg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const MK=()=>{fz.registerAnimation("circularProgress",((t,e)=>({appear:kK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class TK extends MG{constructor(){super(...arguments),this._supportStack=!0}}class wK extends SK{constructor(){super(...arguments),this.type=dB.circularProgress,this.transformerConstructor=TK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(wK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(wK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ED:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),_G("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}wK.type=dB.circularProgress,wK.mark=dF,wK.transformerConstructor=TK;function CK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const EK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:CK(t)}),PK={type:"fadeIn"};function BK(t,e){return!1===e?{}:"fadeIn"===e?PK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CK(t)}))(t)}class RK extends pV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class LK extends EG{constructor(){super(...arguments),this.type=dB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(LK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return $F(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(LK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(LK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=$F(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Pg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=$F(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Pg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),_G("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),_G("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new RK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}LK.type=dB.linearProgress,LK.mark=vF;const OK=()=>{IW(),fz.registerAnimation("linearProgress",((t,e)=>({appear:BK(t,e),enter:{type:"grow"},disappear:EK(t)}))),eN(),fz.registerSeries(LK.type,LK)},IK=[0],DK=[20,40],FK=[200,500],jK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},zK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],HK=`${pB}_WORD_CLOUD_WEIGHT`,NK=`${pB}_WORD_CLOUD_TEXT`;class VK extends TG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=DK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:FK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:IK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?NK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:jK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:IK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!zK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(VK.mark.word,{key:AD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(vG(fz.getAnimationInKey("wordCloud")(n,s),_G("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new YF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new BC,o=this._fontWeightRange;if(r){const[e,i]=vb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:HK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:NK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:sb(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:AD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:HK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:AD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:HK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}VK.mark=gF;function GK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||ZH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function UK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function YK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const KK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function XK(t){return d(t)?t:function(){return t}}class $K{constructor(t){var e,i,s;switch(this.options=z({},$K.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,WK[s]?WK[s]():WK.circle()),this.getText=null!==(e=XK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=XK(this.options.fontWeight),this.getTextFontSize=XK(this.options.fontSize),this.getTextFontStyle=XK(this.options.fontStyle),this.getTextFontFamily=XK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>KK(10,50);break;case"random-light":this.getTextColor=()=>KK(50,90);break;default:this.getTextColor=XK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return te(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return te(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class ZK extends $K{constructor(t){var e;super(z({},ZK.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=ZK.defaultOptions.minFontSize&&(this.options.minFontSize=ZK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=qK[this.options.spiral])&&void 0!==e?e:qK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=XK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=YK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(O_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(eX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(tX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}eX(p,this._size)&&(p=iX(p,this._size))}else if(eX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||QK(p,i))&&(!i||!JK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function JK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function QK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,eX=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function iX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=YK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}nX.defaultOptions={enlarge:!1};const aX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},oX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?lX(t.fontFamily):"sans-serif",d=t.fontStyle?lX(t.fontStyle):"normal",u=t.fontWeight?lX(t.fontWeight):"normal",p=t.rotate?lX(t.rotate):0,g=lX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?lX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||aX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?lX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=cX(dX(t,l),C);w=i=>e(t(i))}let E=ZK;"fast"===t.layoutType?E=nX:"grid"===t.layoutType&&(E=sX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},lX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],hX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),cX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=hX(t[0]),s=hX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(hX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},dX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function uX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{ER.registerTransform("wordcloud",{transform:oX,markPhase:"beforeJoin"},!0),uY(),fz.registerAnimation("wordCloud",((t,e)=>({appear:GK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),fz.registerSeries(pX.type,pX)};(class extends VK{constructor(){super(...arguments),this.type=dB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(VK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),_G("word",this._spec,this._markAttributeContext)))}}).type=dB.wordCloud3d;const mX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},fX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},vX=`${pB}_FUNNEL_TRANSFORM_RATIO`,_X=`${pB}_FUNNEL_REACH_RATIO`,yX=`${pB}_FUNNEL_HEIGHT_RATIO`,bX=`${pB}_FUNNEL_VALUE_RATIO`,xX=`${pB}_FUNNEL_LAST_VALUE_RATIO`,SX=`${pB}_FUNNEL_NEXT_VALUE_RATIO`,AX=`${pB}_FUNNEL_LAST_VALUE`,kX=`${pB}_FUNNEL_CURRENT_VALUE`,MX=`${pB}_FUNNEL_NEXT_VALUE`,TX=`${pB}_FUNNEL_TRANSFORM_LEVEL`,wX=20;class CX extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[_X])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class EX extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class PX extends EX{constructor(){super(...arguments),this.type=PX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}PX.type="polygon";const BX=()=>{fz.registerMark(PX.type,PX),bM(),gM(),ER.registerGraphic(DB.polygon,em),vO.useRegisters([$I,qI])};class RX extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class LX extends TG{constructor(){super(...arguments),this.type=dB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=RX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"funnel",mX),Gz(this._dataSet,"funnelTransform",fX);const t=new ya(this._dataSet,{name:`${pB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:kX,asTransformRatio:vX,asReachRatio:_X,asHeightRatio:yX,asValueRatio:bX,asNextValueRatio:SX,asLastValueRatio:xX,asLastValue:AX,asNextValue:MX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:TX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},LX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:xG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},LX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(LX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(LX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new CX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*cB(_X).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),_G("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(vG(fz.getAnimationInKey("fadeInOut")(),_G(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(vG(fz.getAnimationInKey("funnel")({},o),_G(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(vG(null===(a=fz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),_G("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[xX])/2:this._getSecondaryAxisLength(t[bX])/2,n=this._getSecondaryAxisLength(t[bX])/2):(s=this._getSecondaryAxisLength(t[bX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[SX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[TX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[AD]===t[AD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?wX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{BX(),uY(),NU(),fz.registerSeries(LX.type,LX),fz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},QH))),fz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Kc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Kc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),eN()};class IX extends EX{constructor(){super(...arguments),this.type=IX.type}}IX.type="pyramid3d";class DX extends RX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class FX extends LX{constructor(){super(...arguments),this.type=dB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=DX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},FX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},FX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(FX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(FX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}FX.type=dB.funnel3d,FX.mark=fF,FX.transformerConstructor=DX;const jX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zX=t=>{const e=t.mark.elements.filter((t=>t.diffState===IB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},NX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=HX(r,s,n);return jX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=HX(r,s,n);return jX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},GX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=VX(r);return jX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=zX(i),a=VX(r);return jX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),WX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},UX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):UX(t.children,e,i)))})),e};function YX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=$X(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,wt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},qX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=qX(t.children,e,t,n))})),s},ZX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=ZX(t.children,e,t,n)),n=e(t,s,i,n)})),n},JX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:YX,slice:KX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?KX:YX)(t,e,i,s,n)}};class QX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},QX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?gb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?XX(this.options.aspectRatio):null!==(e=JX[this.options.splitType])&&void 0!==e?e:JX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=$X(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}QX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const t$=(t,e)=>{const i=new QX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return UX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},e$={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class i${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];YX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),e$);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},i$.defaultOpionts,t):Object.assign({},i$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+yb(this.options.center[0],t.width),s=t.y0+yb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>yb(t,n))):yb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>yb(t,n))):yb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=yb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=$X(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=se({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}i$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const s$=4294967296;function n$(t,e){let i,s;if(o$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function o$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function d$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function u$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function p$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function g$(t){return{_:t,next:null,prev:null}}function m$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];d$(n,s,r);let a,o,l,h,c,d,u,p=g$(s),g=g$(n),m=g$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=$X(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%s$)/s$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:y$.defaultOpionts.nodeSort;qX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)qX([o],f$(h)),ZX([o],v$(this._getPadding,.5,a)),qX([o],_$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);qX([o],f$(y$.defaultOpionts.setRadius)),ZX([o],v$(fb,1,a)),c&&ZX([o],v$(this._getPadding,o.radius/t,a)),qX([o],_$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}y$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const b$=(t,e={})=>{if(!t)return[];const i=[];return UX(t,i,e),i},x$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new i$(i).layout(t,{width:s,height:n})};class S$ extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var A$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(A$||(A$={}));const k$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===A$.DrillDown){return Y(hz(t,n,s,"children"))}if(i.type===A$.DrillUp){const e=cz(t,n,s,"children");if(e)return Y(e)}return t};class M${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=kU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Gz(t,"drillFilter",k$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:A$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:A$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:A$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:A$.DrillUp},model:this}),r}}class T$ extends MY{constructor(){super(...arguments),this.type=dB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._startAngle=te(this._spec.startAngle),this._endAngle=te(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"sunburstLayout",x$),Gz(this._dataSet,"flatten",b$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",sG),t.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(T$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(T$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new S$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}T$.type=dB.sunburst,T$.mark=kF,U(T$,M$);const w$=()=>{fz.registerSeries(T$.type,T$),DY(),uY(),eN(),fz.registerAnimation("sunburst",((t,e)=>({appear:WX(0,e),enter:NX(t),exit:GX(t),disappear:GX(t)})))},C$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new y$(i).layout(t,{width:s,height:n})};class E$ extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const P$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class B$ extends EG{constructor(){super(...arguments),this.type=dB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"circlePackingLayout",C$),Gz(this._dataSet,"flatten",b$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",sG),t.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(B$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(B$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}B$.type=dB.circlePacking,B$.mark=wF,U(B$,M$);const R$=()=>{fz.registerSeries(B$.type,B$),DY(),uY(),tN(),fz.registerAnimation("circlePacking",((t,e)=>({appear:P$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},L$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=L$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function O$(t){return t.depth}function I$(t,e){return e-1-t.endDepth}const D$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),F$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},j$={left:O$,right:I$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:O$,end:I$},z$=yt(0,1);class H${constructor(t){this._ascendingSourceBreadth=(t,e)=>D$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>D$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},H$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?gb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):j$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};kb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),kb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];L$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[F$(s[t.source]),F$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*z$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(D$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(D$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new H$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},V$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&V$(t,e.children,i)}))},G$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},W$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new H$(e),r=[];return r.push(n.layout(s,i)),r},U$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},Y$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class K$ extends pV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const X$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),$$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:X$(t),q$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class Z$ extends YH{constructor(){super(...arguments),this.type=Z$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}Z$.type="linkPath";const J$=()=>{ER.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(DO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),ER.registerAnimationType("linkPathGrowIn",FO),ER.registerAnimationType("linkPathGrowOut",jO),ER.registerAnimationType("linkPathUpdate",zO),AO(),_O(),fz.registerMark(Z$.type,Z$)};class Q$ extends EG{constructor(){super(...arguments),this.type=dB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Jt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(rH.STATE_SANKEY_EMPHASIS),e.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS)):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(rH.STATE_SANKEY_EMPHASIS),s.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Gz(this._dataSet,"sankeyLayout",W$),Gz(this._dataSet,"sankeyFormat",G$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:eH.sankeyLayout});const{dataSet:a}=this._option;Gz(a,"sankeyNodes",U$),Gz(a,"flatten",b$);const o=new ya(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._nodesSeriesData=new lG(this._option,o),Gz(a,"sankeyLinks",Y$);const l=new ya(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}},!1),this._linksSeriesData=new lG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Q$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(Q$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(Q$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},rH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),_G("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),_G("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(vG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),_G("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([rH.STATE_SANKEY_EMPHASIS_REVERSE,rH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new K$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new YF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return V$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}Q$.type=dB.sankey,Q$.mark=xF;const tq=()=>{ER.registerTransform("sankey",{transform:N$,markPhase:"beforeJoin"},!0),IW(),J$(),uY(),fz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:$$(t,e)},QH))),fz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:q$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),eN(),fz.registerSeries(Q$.type,Q$)},eq=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=b$(n);return i=rG([{latestData:r}],e),i};class iq extends pV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const sq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class nq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class rq extends EG{constructor(){super(...arguments),this.type=dB.treemap,this.transformerConstructor=nq,this._viewBox=new Jt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new oe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:AD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",sG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gG.bind(this),call:mG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Gz(this._dataSet,"hierarchyDimensionStatistics",eq),Gz(this._dataSet,"flatten",b$);const i=new ya(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hG,operations:["max","min","values"]},{key:cG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(rq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(rq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new iq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}rq.type=dB.treemap,rq.mark=bF,rq.transformerConstructor=nq,U(rq,M$),U(rq,TU);const aq=()=>{IW(),uY(),fz.registerAnimation("treemap",((t,e)=>({appear:sq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),eN(),ER.registerTransform("treemap",{transform:t$,markPhase:"beforeJoin"},!0),fz.registerSeries(rq.type,rq)},oq={type:"fadeIn"};function lq(t,e){return"fadeIn"===e?oq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class hq extends MG{constructor(){super(...arguments),this._supportStack=!1}}class cq extends SK{constructor(){super(...arguments),this.type=dB.gaugePointer,this.transformerConstructor=hq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(cq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},cq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(cq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),_G("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}cq.type=dB.gaugePointer,cq.mark=AF,cq.transformerConstructor=hq;const dq=()=>{fz.registerSeries(cq.type,cq),bU(),IW(),fz.registerAnimation("gaugePointer",((t,e)=>{const i=lq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),nK(),iK()};class uq extends MG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class pq extends SK{constructor(){super(...arguments),this.type=dB.gauge,this.transformerConstructor=uq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=te(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Gz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[jD]=t[this._angleField[0]],t[FD]=e>0?i[e-1][jD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(pq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(pq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[FD])?this.angleAxisHelper.dataToPosition([t[FD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[jD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),_G("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}pq.type=dB.gauge,pq.mark=SF,pq.transformerConstructor=uq;class gq extends DG{constructor(){super(...arguments),this.type=gq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}gq.type="cell";const mq=()=>{fz.registerMark(gq.type,gq),bM(),SM(),ER.registerGraphic(DB.cell,kg),ER.registerMark(DB.cell,uD)};function fq(t){return!1===t?{}:{type:"fadeIn"}}class vq extends pV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class _q extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class yq extends EG{constructor(){super(...arguments),this.type=dB.heatmap,this.transformerConstructor=_q}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(yq.mark.cell,{morph:xG(this._spec,yq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(yq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ei(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=CG(this);this._cellMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),_G("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new vq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}yq.type=dB.heatmap,yq.mark=CF,yq.transformerConstructor=_q;const bq=()=>{uY(),mq(),fz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},QH),{appear:fq(e)}))),aW(),sW(),fz.registerSeries(yq.type,yq)},xq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=te(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=te(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=yb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=yb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+yb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+yb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=gb(e.field),C=t.map(w),[E,P]=vb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:gb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?vb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=Sq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),Aq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Aq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[SD]:null==n?void 0:n[SD],[kD]:null==n?void 0:n[kD]}};class Mq extends YH{constructor(){super(...arguments),this.type=Mq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Mq.type="ripple";const Tq=()=>{fz.registerMark(Mq.type,Mq),ER.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),AO(),xO()},wq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Cq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Eq extends MY{constructor(){super(...arguments),this.type=dB.correlation,this.transformerConstructor=Cq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Gz(this._dataSet,"correlation",xq);const s=new va;Wz(s,"dataview",ga),Gz(s,"correlationCenter",kq);const n=new ya(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(Eq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:SD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(Eq.mark.ripplePoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Eq.mark.centerPoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[_D],y:t=>t[yD],size:t=>t[bD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),_G("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Eq.type=dB.correlation,Eq.mark=EF,Eq.transformerConstructor=Cq;const Pq=()=>{jG(),Tq(),fz.registerSeries(Eq.type,Eq),fz.registerAnimation("correlation",((t,e)=>Object.assign({appear:wq(0,e)},JH)))};class Bq extends YH{constructor(){super(...arguments),this.type=Bq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Bq.type="liquid";const Rq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Lq extends pV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Oq extends TG{constructor(){super(...arguments),this.type=dB.liquid,this.transformerConstructor=zG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=kg({x:s,y:n,size:r,symbolType:Rq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=ej(this._spec.outlineMargin),this._paddingSpec=ej(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Oq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Oq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Oq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Oq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Lq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(vG(null===(i=fz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),_G("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(vG(null===(s=fz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),_G("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Oq.type=dB.liquid,Oq.mark=BF,Oq.transformerConstructor=zG;const Iq=t=>Y(t).join(",");class Dq extends pV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Iq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Iq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Fq extends MG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class jq extends TG{constructor(){super(...arguments),this.type=dB.venn,this.transformerConstructor=Fq,this._viewBox=new Jt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:AD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(jq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(jq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},rH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},rH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Iq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},rH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Iq(t.sets)},rH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Dq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Iq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Iq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Iq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Iq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(vG(null===(e=fz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),_G(t.name,this._spec,this._markAttributeContext)))}))}}jq.type=dB.venn,jq.mark=RF,jq.transformerConstructor=Fq;class zq extends fW{_isValidSeries(t){return t===dB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class Hq extends gW{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="map",this.seriesType=dB.map}}Hq.type="map",Hq.seriesType=dB.map,Hq.transformerConstructor=zq;class Nq extends fW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Vq extends Nq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=DN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Rj({},s,l)),n&&Object.assign(o,Rj({},n,o))}}class Gq extends Nq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Wq extends Nq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,layoutRadius:t.layoutRadius})}}class Uq extends gW{constructor(){super(...arguments),this.transformerConstructor=Wq}}Uq.transformerConstructor=Wq;class Yq extends Uq{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="pie",this.seriesType=dB.pie}}Yq.type="pie",Yq.seriesType=dB.pie,Yq.transformerConstructor=Wq;class Kq extends Wq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Xq extends Uq{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="pie3d",this.seriesType=dB.pie3d}}Xq.type="pie3d",Xq.seriesType=dB.pie3d,Xq.transformerConstructor=Kq;class $q extends Gq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:LB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:LB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class qq extends gW{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="rose",this.seriesType=dB.rose,this._canStack=!0}}qq.type="rose",qq.seriesType=dB.rose,qq.transformerConstructor=$q;class Zq extends Gq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Rj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Jq extends gW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="radar",this.seriesType=dB.radar,this._canStack=!0}}Jq.type="radar",Jq.seriesType=dB.radar,Jq.transformerConstructor=Zq;class Qq extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Rj(e,pH(this.type,t))})),this._transformAxisSpec(t)}}class tZ extends gW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="common",this._canStack=!0}}tZ.type="common",tZ.transformerConstructor=Qq;class eZ extends vW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class iZ extends gW{constructor(){super(...arguments),this.transformerConstructor=eZ,this._canStack=!0}}iZ.transformerConstructor=eZ;class sZ extends eZ{transformSpec(t){super.transformSpec(t),cH(t)}}class nZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="histogram",this.seriesType=dB.bar}}nZ.type="histogram",nZ.seriesType=dB.bar,nZ.transformerConstructor=sZ;class rZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="histogram3d",this.seriesType=dB.bar3d}}rZ.type="histogram3d",rZ.seriesType=dB.bar3d,rZ.transformerConstructor=sZ;class aZ extends Vq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class oZ extends gW{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="circularProgress",this.seriesType=dB.circularProgress,this._canStack=!0}}oZ.type="circularProgress",oZ.seriesType=dB.circularProgress,oZ.transformerConstructor=aZ;class lZ extends Vq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:dB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===dB.gauge||t.type===dB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===dB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class hZ extends gW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="gauge",this.seriesType=dB.gaugePointer}}hZ.type="gauge",hZ.seriesType=dB.gaugePointer,hZ.transformerConstructor=lZ;class cZ extends fW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dZ extends gW{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}dZ.transformerConstructor=cZ;class uZ extends cZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class pZ extends dZ{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}pZ.type="wordCloud",pZ.seriesType=dB.wordCloud,pZ.transformerConstructor=uZ;class gZ extends cZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class mZ extends dZ{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="wordCloud3d",this.seriesType=dB.wordCloud3d}}mZ.type="wordCloud3d",mZ.seriesType=dB.wordCloud3d,mZ.transformerConstructor=gZ;class fZ extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class vZ extends gW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="funnel",this.seriesType=dB.funnel}}vZ.type="funnel",vZ.seriesType=dB.funnel,vZ.transformerConstructor=fZ;class _Z extends gW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="funnel3d",this.seriesType=dB.funnel3d}}_Z.type="funnel3d",_Z.seriesType=dB.funnel3d,_Z.transformerConstructor=fZ;class yZ extends vW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=DN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=DN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class bZ extends gW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="linearProgress",this.seriesType=dB.linearProgress,this._canStack=!0}}bZ.type="linearProgress",bZ.seriesType=dB.linearProgress,bZ.transformerConstructor=yZ;class xZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),cH(t)}}class SZ extends gW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="rangeColumn",this.seriesType=dB.rangeColumn}}SZ.type="rangeColumn",SZ.seriesType=dB.rangeColumn,SZ.transformerConstructor=xZ;class AZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class kZ extends gW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="rangeColumn3d",this.seriesType=dB.rangeColumn3d}}kZ.type="rangeColumn3d",kZ.seriesType=dB.rangeColumn3d,kZ.transformerConstructor=AZ;class MZ extends fW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:RB,i=p(t.endAngle)?t.endAngle:e+ee(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=dB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class TZ extends gW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="sunburst",this.seriesType=dB.sunburst}}TZ.type="sunburst",TZ.seriesType=dB.sunburst,TZ.transformerConstructor=MZ;class wZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=dB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CZ extends gW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="circlePacking",this.seriesType=dB.circlePacking}}CZ.type="circlePacking",CZ.seriesType=dB.circlePacking,CZ.transformerConstructor=wZ;class EZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class PZ extends gW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="treemap",this.seriesType=dB.treemap}}PZ.type="treemap",PZ.seriesType=dB.treemap,PZ.transformerConstructor=EZ;class BZ extends NW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),cH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class RZ extends VW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="waterfall",this.seriesType=dB.waterfall}}RZ.type="waterfall",RZ.seriesType=dB.waterfall,RZ.transformerConstructor=BZ;class LZ extends vW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),cH(t)}}class OZ extends gW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="boxPlot",this.seriesType=dB.boxPlot}}OZ.type="boxPlot",OZ.seriesType=dB.boxPlot,OZ.transformerConstructor=LZ;class IZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class DZ extends gW{constructor(){super(...arguments),this.transformerConstructor=IZ,this.type="sankey",this.seriesType=dB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}DZ.type="sankey",DZ.seriesType=dB.sankey,DZ.transformerConstructor=IZ;class FZ extends vW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),cH(t)}}class jZ extends gW{constructor(){super(...arguments),this.transformerConstructor=FZ,this.type="rangeArea",this.seriesType=dB.rangeArea}}jZ.type="rangeArea",jZ.seriesType=dB.rangeArea,jZ.transformerConstructor=FZ;class zZ extends vW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class HZ extends gW{constructor(){super(...arguments),this.transformerConstructor=zZ,this.type="heatmap",this.seriesType=dB.heatmap}}HZ.type="heatmap",HZ.seriesType=dB.heatmap,HZ.transformerConstructor=zZ;class NZ extends fW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=dB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class VZ extends gW{constructor(){super(...arguments),this.transformerConstructor=NZ,this.type="correlation",this.seriesType=dB.correlation}}VZ.type="correlation",VZ.seriesType=dB.correlation,VZ.transformerConstructor=NZ;function GZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mz(t.style)),B(t.textStyle)||Rj(s.textStyle,mz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mz(s.background.style),s}const WZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},UZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:kD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class YZ extends WG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=ZF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new GH(this._option,e),this._initSelectedData(),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(oB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Rj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}YZ.specKey="legends";class KZ extends YZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Gz(this._option.dataSet,"discreteLegendFilter",UZ),Gz(this._option.dataSet,"discreteLegendDataMake",WZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return oB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!hb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iz(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=GZ(s)),B(n.focusIconStyle)||mz(n.focusIconStyle),n.shape&&(n.shape=uz(n.shape)),n.label&&(n.label=uz(n.label)),n.value&&(n.value=uz(n.value)),n.background&&(n.background=uz(n.background)),JF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),JF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),JF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mz(r.railStyle),B(r.sliderStyle)||mz(r.sliderStyle)):(B(r.textStyle)||mz(r.textStyle),r.handler&&uz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Rj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return fP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(hP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(hP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(hP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=LN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=LN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}KZ.specKey="legends",KZ.type=r.discreteLegend;const XZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},$Z=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function qZ(t){return"color"===t||"size"===t}const ZZ={color:xP,size:AP},JZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],QZ=[2,10];class tJ extends YZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return qZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{qZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Gz(this._option.dataSet,"continuousLegendFilter",$Z),Gz(this._option.dataSet,"continuousLegendDataMake",XZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iz(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!hb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iz(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?JZ:QZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Rj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=GZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=mz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=mz(r.style)),B(a.style)||(w.trackStyle=mz(a.style)),w.startText=uz(o),w.endText=uz(l),w.handlerText=uz(h),B(c)||(w.sizeBackground=mz(c)),d.visible&&!B(d.style)&&(Rj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return ZZ[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}tJ.specKey="legends",tJ.type=r.continuousLegend;class eJ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Lz(n,a,!0))&&void 0!==e?e:[],...null!==(i=xz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Gw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=cV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=cV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(yV(s).every((t=>{var e;return!cV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=cV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=vV(t,i,s),m=_V(t,i,s),f=Rj({},I(e[t]),m),v=g.title,_=xV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=mV(f.title,Object.assign(Object.assign({},v),_)):f.title=mV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=bV(y);f.content=fV(f.content,(e=>xV(e,f,u.shape,t)))}else f.content=fV(y,(t=>xV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=CV(a,t,e),l=!!p(o)&&!1!==AV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class iJ extends eJ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class sJ extends eJ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class nJ extends eJ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const rJ=t=>p(t)&&!y(t),aJ=t=>p(t)&&y(t);class oJ extends GG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Rj({},this._theme,s.style),s.offset=Rj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=cV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:rb(this._option.mode)||!sb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=O_.getElementById(t.parentElement)):sb(this._option.mode)&&(t.parentElement=null==ib?void 0:ib.body)}}class lJ extends WG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=oJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=sb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&rJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&aJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&hN.globalConfig.uniqueTooltip&&l&&hN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?kV.canvas:kV.dom,n=fz.getComponentPluginInType(t);n||Qy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new sJ(this),dimension:new iJ(this),group:new nJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(nb(i)||rb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=lV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(aJ(t)){if(rJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>vz(t,e[i])))))return!1}else{if(aJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&si(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}lJ.type=r.tooltip,lJ.transformerConstructor=oJ,lJ.specKey="tooltip";var hJ,cJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(hJ||(hJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(cJ||(cJ={}));const dJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class uJ extends WG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:nb(e)||rb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{dJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){Sz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=hB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=UN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=XN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=$N(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),GN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}pJ.specKey="crosshair",pJ.type=r.cartesianCrosshair;class gJ extends uJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:qt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=hB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Rj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=IN(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=IN(s.getSpec())),c.angle=a.angle,c.axis=s,Rj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=LN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=LN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:se(o,s,i),end:se(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},se(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ne(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=se(t,r,p),f=se(t,r,g),v=Re([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(qt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=re(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},se(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),GN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}gJ.specKey="crosshair",gJ.type=r.polarCrosshair;const mJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},fJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class vJ extends WG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Lt(s/n)>=.5:Lt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=Mz(t),this._isHorizontal="horizontal"===Tz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(Nw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};oB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=Nw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else oB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Wz(s,"dataview",ga),Gz(s,"dataFilterComputeDomain",fJ);const n=new ya(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new GH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(Nw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&Nw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Nw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new cC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Gz(this._option.dataSet,"dataFilterWithNewDomain",mJ),oB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>Nw(this._stateScale.type)},level:eH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Gw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Gw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(vJ,TU);class _J extends GG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Rj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class yJ extends vJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=_J,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new BC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Nw(t.type)||e[0]!==e[1])&&(!Gw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new hE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mz(g.style)},selectedBackgroundStyle:mz(this._spec.selectedBackground.style),dragMaskStyle:mz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Rj(mz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Rj(mz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=LN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}yJ.type=r.dataZoom,yJ.transformerConstructor=_J,yJ.specKey="dataZoom";class bJ extends vJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=QP(this._start,e)&&QP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}bJ.type=r.scrollBar,bJ.specKey="scrollBar";const xJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class SJ extends WG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==SJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Gz(this._option.dataSet,"indicatorFilter",xJ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new GH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Rj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?sj(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?sj(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},gz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new TP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}SJ.type=r.indicator,SJ.specKey="indicator";const AJ=["sum","average","min","max","variance","standardDeviation","median"];function kJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function MJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&kJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=JF(t.x)?EJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function TJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&kJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=JF(t.y)?EJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function wJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&kJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function CJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&kJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function EJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function PJ(t){return AJ.includes(t)}function BJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=MJ(t,m,n,d,h,a),i=TJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=MJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=TJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function RJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=wJ(t,l,n,r),i=CJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=wJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=CJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function LJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=JF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=JF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&kJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&kJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function OJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&kJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&kJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function IJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=EJ(e,r)),e+=s,JF(i)&&(i=EJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=EJ(e,s)),JF(i)&&(i=EJ(i,n)),{x:e,y:i}}))}function DJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function FJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},mz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},zJ(mz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=zJ(mz(n),i)),t}return{visible:!1}}function jJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function zJ(t,e){return d(t)?t(e):t}function HJ(t,e){return d(t)?t(e):t}function NJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function VJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function GJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function WJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function UJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>KJ(i,t,e))):s.x=KJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>KJ(i,t,e))):s.y=KJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>KJ(i,t,e))):s.angle=KJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>KJ(i,t,e))):s.radius=KJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=KJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const YJ={min:(t,e)=>tB(t[0].latestData,e.field),max:(t,e)=>eB(t[0].latestData,e.field),sum:function(t,e){return iB(t[0].latestData,e.field)},average:function(t,e){return sB(t[0].latestData,e.field)},variance:function(t,e){return nB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(nB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function KJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return YJ[i](e,{field:s})}return t}class XJ extends WG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&PJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&PJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&PJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&PJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&PJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new va;return e.registerParser("array",s),new ya(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=hB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=QF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function $J(t,e){return function(t,e,i){const{predict:s}=Sb(t,(t=>t[e]),(t=>t[i])),n=tB(t,e),r=eB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function qJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class ZJ extends XJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=VJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:zJ(mz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:FJ(y,this._markerData),state:{line:jJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:jJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:jJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:jJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:jJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:mz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:mz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=VJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerRegression",$J),Gz(this._option.dataSet,"markerFilter",qJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ya(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}ZJ.specKey="markLine";class JJ extends ZJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=VJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=BJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=LJ(i,r,d,e.coordinatesOffset):c&&(y=IJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(JF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=VJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}JJ.type=r.markLine,JJ.coordinateType="cartesian";class QJ extends ZJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=VJ(this._spec);return e||i?new JE(t):new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=VJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=RJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>se(m,t.radius,t.angle)))}}else u&&(p=OJ(i,r,a),g={points:p.map((t=>se(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=VJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}QJ.type=r.polarMarkLine,QJ.coordinateType="polar";class tQ extends WG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=ZF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new kP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}tQ.type=r.title,tQ.specKey=r.title;class eQ extends XJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=GJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:zJ(mz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:FJ(u,this._markerData),state:{area:jJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:jJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:jJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=GJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerFilter",qJ);const c=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}eQ.specKey="markArea";class iQ extends eQ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=GJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=BJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=BJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=LJ(i,r,d,e.coordinatesOffset):c&&(u=IJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=GJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}iQ.type=r.markArea,iQ.coordinateType="cartesian";class sQ extends eQ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=GJ(this._spec);return i||e||s?new QE(t):new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=GJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=RJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=OJ(i,r,c),u={points:d.map((t=>se(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=GJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}sQ.type=r.polarMarkArea,sQ.coordinateType="polar";const nQ=t=>mz(Object.assign({},t)),rQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mz(t.style))}),aQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=nQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=nQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mz(Object.assign({},y)));var y;const b=rQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=rQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=rQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=rQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},oQ=t=>"left"===t||"right"===t,lQ=t=>"top"===t||"bottom"===t;class hQ extends WG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},aQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},aQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new HP(t):this._playerComponent=new GP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=oQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=oQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=oQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=lQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):oQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):lQ(this._orient)?this._maxSize():t.height}_computeDx(t){return oQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return lQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}hQ.specKey="player",hQ.type=r.player;class cQ extends WG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}cQ.type=r.label;class dQ extends dY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}dQ.type="text",dQ.constructorType="label";const uQ=()=>{fz.registerMark(dQ.constructorType,dQ),SO()};class pQ extends GG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class gQ extends cQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=pQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),oB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Rj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=YU[t])&&void 0!==i?i:YU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:KU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}gQ.type=r.label,gQ.specKey="label",gQ.transformerConstructor=pQ;class mQ extends cQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[OD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Rj({textStyle:{pickable:!0===this._spec.interactive},position:fQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[DD]))},a))}})).encode((e=>KU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function fQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}mQ.type=r.totalLabel,mQ.specKey="totalLabel";class vQ extends XJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=WJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:HJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:HJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:zJ(B.style,this._markerData)},state:{line:jJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:jJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:jJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:jJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:jJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:jJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:jJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:jJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:jJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:jJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=mz(zJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=zJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=FJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=zJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mz(z.style)}):{visible:!1};return new eP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=DJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:NJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:NJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=WJ(t);if(!(p(t.coordinate)||e||i||s))return;Gz(this._option.dataSet,"markerAggregation",UJ),Gz(this._option.dataSet,"markerFilter",qJ);const{options:n}=this._computeOptions(),r=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}vQ.specKey="markPoint";class _Q extends vQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=BJ(i,s,s,s,o)[0][0]:r?l=LJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=IJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=WJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}_Q.type=r.markPoint,_Q.coordinateType="cartesian";class yQ extends vQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=RJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:se({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}yQ.type=r.polarMarkPoint,yQ.coordinateType="polar";class bQ extends vQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}bQ.type=r.geoMarkPoint,bQ.coordinateType="geo";const xQ="inBrush",SQ="outOfBrush";class AQ extends WG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),xQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),SQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new KP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(NP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,SQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(NP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(NP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(xQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(xQ),i.addState(SQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(xQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(xQ),i.addState(SQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ze(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ze(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(xQ),i.removeState(SQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}AQ.type=r.brush,AQ.specKey="brush";class kQ extends WG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${pB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=vG({},_G(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Jt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Jt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}kQ.type=r.customMark,kQ.specKey="customMark";function MQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function TQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function wQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:TQ(t.rect),anchorCandidates:LQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>MQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tMQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function CQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Ue(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=BQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ci(r,s,i);if(!BQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],EQ(PQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=EQ(PQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=RQ(t.rect,a,0),t}));return wQ(h)}function EQ(t){return t>180?t-360:t}function PQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function BQ(t,e){for(let i=0;i{const{x:r,y:a}=RQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class OQ extends WG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ya(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:eH.copyDataView},!1),this._data=new GH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new eP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=ej(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Cu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Pg(mz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=kg(mz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=yp(mz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=yp(mz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=RQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):wQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}OQ.type=r.mapLabel,OQ.specKey="mapLabel";class IQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>DQ(t))),a=n.filter((t=>!DQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>DQ(t))),h=o.filter((t=>!DQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function DQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}IQ.type="grid";hN.useRegisters([()=>{aI(),oI(),IG(),jG(),sN(),tN(),aW(),sW(),fz.registerSeries(cW.type,cW),fz.registerChart(yW.type,yW)},()=>{aI(),oI(),IG(),xW(),jG(),AW(),aW(),sW(),fz.registerSeries(MW.type,MW),fz.registerChart(wW.type,wW)},()=>{HW(),fz.registerChart(VW.type,VW)},()=>{eU(),fz.registerChart(sU.type,sU)},()=>{VY(),fz.registerChart(Yq.type,Yq)},()=>{aK(),fz.registerChart(qq.type,qq)},()=>{gK(),fz.registerChart(Jq.type,Jq)},()=>{HW(),fz.registerChart(nZ.type,nZ)},()=>{RU(),fz.registerChart(Hq.type,Hq)},()=>{dq(),fz.registerSeries(pq.type,pq),DY(),MK(),iK(),fz.registerChart(hZ.type,hZ)},()=>{gX(),fz.registerChart(pZ.type,pZ)},()=>{OX(),fz.registerChart(vZ.type,vZ)},()=>{sY(),fz.registerChart(RZ.type,RZ)},()=>{hY(),jG(),tN(),aW(),sW(),fz.registerSeries(cY.type,cY),fz.registerChart(OZ.type,OZ)},()=>{fz.registerSeries(wK.type,wK),DY(),MK(),eN(),nK(),iK(),fz.registerChart(oZ.type,oZ)},()=>{OK(),fz.registerChart(bZ.type,bZ)},()=>{xY(),fz.registerChart(SZ.type,SZ)},()=>{xW(),aW(),sW(),fz.registerSeries(kY.type,kY),fz.registerChart(jZ.type,jZ)},()=>{w$(),fz.registerChart(TZ.type,TZ)},()=>{R$(),fz.registerChart(CZ.type,CZ)},()=>{aq(),fz.registerChart(PZ.type,PZ)},()=>{tq(),fz.registerChart(DZ.type,DZ)},()=>{bq(),fz.registerChart(HZ.type,HZ)},()=>{Pq(),fz.registerChart(VZ.type,VZ)},()=>{fz.registerChart(tZ.type,tZ)},sW,aW,()=>{$G(),fz.registerComponent(oW.type,oW)},()=>{$G(),fz.registerComponent(lW.type,lW)},()=>{$G(),fz.registerComponent(hW.type,hW)},nK,iK,()=>{fz.registerComponent(KZ.type,KZ)},()=>{fz.registerComponent(tJ.type,tJ)},()=>{fz.registerComponent(lJ.type,lJ)},()=>{fz.registerComponent(pJ.type,pJ)},()=>{fz.registerComponent(gJ.type,gJ)},()=>{fz.registerComponent(yJ.type,yJ)},()=>{fz.registerComponent(bJ.type,bJ)},()=>{fz.registerComponent(SJ.type,SJ)},EU,()=>{fz.registerComponent(JJ.type,JJ),XE()},()=>{fz.registerComponent(iQ.type,iQ),qE()},()=>{fz.registerComponent(_Q.type,_Q),tP()},()=>{fz.registerComponent(QJ.type,QJ),JE._animate=PE,XE()},()=>{fz.registerComponent(sQ.type,sQ),QE._animate=RE,qE()},()=>{fz.registerComponent(yQ.type,yQ),tP()},()=>{fz.registerComponent(bQ.type,bQ),tP()},()=>{fz.registerComponent(tQ.type,tQ)},()=>{fz.registerComponent(hQ.type,hQ)},()=>{WO(),uQ(),YG(),fz.registerComponent(gQ.type,gQ,!0)},()=>{WO(),uQ(),YG(),fz.registerComponent(mQ.type,mQ,!0)},()=>{fz.registerComponent(AQ.type,AQ)},()=>{fz.registerComponent(kQ.type,kQ)},()=>{fz.registerComponent(OQ.type,OQ)},()=>{th.load(pT)},()=>{fz.registerLayout(IQ.type,IQ)},iG,yN,qR,$R]),hN.useRegisters([()=>{gA(th)}]),t.ARC_END_ANGLE=MB,t.ARC_K=TB,t.ARC_MIDDLE_ANGLE=wB,t.ARC_QUADRANT=CB,t.ARC_RADIAN=EB,t.ARC_RATIO=AB,t.ARC_START_ANGLE=kB,t.ARC_TRANSFORM_VALUE=SB,t.AxisSyncPlugin=wN,t.BASE_EVENTS=pD,t.CORRELATION_SIZE=bD,t.CORRELATION_X=_D,t.CORRELATION_Y=yD,t.CanvasTooltipHandler=eG,t.DEFAULT_CHART_HEIGHT=mB,t.DEFAULT_CHART_WIDTH=gB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=WD,t.DEFAULT_DATA_INDEX=SD,t.DEFAULT_DATA_KEY=AD,t.DEFAULT_DATA_SERIES_FIELD=kD,t.DEFAULT_GRADIENT_CONFIG=UD,t.DEFAULT_LABEL_ALIGN=vB,t.DEFAULT_LABEL_LIMIT=fB,t.DEFAULT_LABEL_TEXT=_B,t.DEFAULT_LABEL_VISIBLE=yB,t.DEFAULT_LABEL_X=bB,t.DEFAULT_LABEL_Y=xB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=VD,t.DEFAULT_MEASURE_CANVAS_ID=xD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=GD,t.DEFAULT_SERIES_STYLE_NAME=MD,t.DomTooltipHandler=tG,t.Factory=fz,t.FormatterPlugin=_N,t.GradientType=ND,t.MediaQuery=gN,t.POLAR_DEFAULT_RADIUS=LB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=BB,t.POLAR_START_ANGLE=RB,t.POLAR_START_RADIAN=PB,t.PREFIX=pB,t.SEGMENT_FIELD_END=jD,t.SEGMENT_FIELD_START=FD,t.STACK_FIELD_END=ED,t.STACK_FIELD_END_OffsetSilhouette=LD,t.STACK_FIELD_END_PERCENT=BD,t.STACK_FIELD_KEY=wD,t.STACK_FIELD_START=CD,t.STACK_FIELD_START_OffsetSilhouette=RD,t.STACK_FIELD_START_PERCENT=PD,t.STACK_FIELD_TOTAL=OD,t.STACK_FIELD_TOTAL_PERCENT=ID,t.STACK_FIELD_TOTAL_TOP=DD,t.ThemeManager=qj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=hN,t.WaterfallDefaultSeriesField=vD,t.builtinThemes=zj,t.computeActualDataScheme=zF,t.darkTheme=Mj,t.dataScheme=nj,t.default=hN,t.defaultThemeName=Hj,t.getActualColor=NF,t.getColorSchemeBySeries=UF,t.getDataScheme=jF,t.getMergedTheme=Xj,t.getTheme=Uj,t.hasThemeMerged=Gj,t.isColorKey=VF,t.isProgressiveDataColorScheme=GF,t.isTokenKey=Sj,t.lightTheme=kj,t.queryColorFromColorScheme=HF,t.queryToken=xj,t.registerCanvasTooltipHandler=iG,t.registerChartPlugin=pN,t.registerDomTooltipHandler=()=>{QV(tG)},t.registerFormatPlugin=yN,t.registerMediaQuery=()=>{pN(gN)},t.registerTheme=Wj,t.removeTheme=Yj,t.themeExist=Kj,t.themes=Nj,t.token=Aj,t.transformColorSchemeToStandardStruct=WF,t.version="1.11.12",t.vglobal=O_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index 94a76b84a6..a4ce39dcb6 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -19,7 +19,7 @@ "start": "ts-node __tests__/runtime/browser/scripts/initVite.ts && vite serve __tests__/runtime/browser" }, "dependencies": { - "@visactor/vchart": "workspace:1.11.11", + "@visactor/vchart": "workspace:1.11.12", "@visactor/vrender-core": "0.19.24", "@visactor/vrender-kits": "0.19.24", "@visactor/vutils": "~0.18.10" diff --git a/packages/vchart-schema/package.json b/packages/vchart-schema/package.json index fb07b54c91..b079f8a3ba 100644 --- a/packages/vchart-schema/package.json +++ b/packages/vchart-schema/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-schema", - "version": "1.11.11", + "version": "1.11.12", "description": "The VChart JSON schema file.", "sideEffects": false, "main": "vchart.json", diff --git a/packages/vchart-schema/vchart.json b/packages/vchart-schema/vchart.json index dbe75505e5..3ac5ffd8e0 100644 --- a/packages/vchart-schema/vchart.json +++ b/packages/vchart-schema/vchart.json @@ -55247,6 +55247,21 @@ "$ref": "#/definitions/ILayoutSpec", "description": "布局配置" }, + "layoutRadius": { + "anyOf": [ + { + "typeof": "function" + }, + { + "const": "auto", + "type": "string" + }, + { + "type": "number" + } + ], + "since": "1.11.12" + }, "legends": { "anyOf": [ { @@ -55795,6 +55810,21 @@ "$ref": "#/definitions/ILayoutSpec", "description": "布局配置" }, + "layoutRadius": { + "anyOf": [ + { + "typeof": "function" + }, + { + "const": "auto", + "type": "string" + }, + { + "type": "number" + } + ], + "since": "1.11.12" + }, "legends": { "anyOf": [ { @@ -56212,6 +56242,21 @@ "$ref": "#/definitions/IMultiLabelSpec", "description": "标签配置" }, + "layoutRadius": { + "anyOf": [ + { + "typeof": "function" + }, + { + "const": "auto", + "type": "string" + }, + { + "type": "number" + } + ], + "since": "1.11.12" + }, "minAngle": { "default": 0, "description": "最小的扇区角度(0 ~ 360),用于防止某个值过小导致扇区太小影响交互。", @@ -80719,7 +80764,7 @@ }, "Mapvoid>": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80727,14 +80772,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80742,14 +80787,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80757,14 +80802,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80772,14 +80817,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80787,14 +80832,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80802,14 +80847,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80817,14 +80862,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80832,14 +80877,14 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" }, "size": { @@ -80847,7 +80892,7 @@ } }, "required": [ - "__@toStringTag@13481", + "__@toStringTag@13484", "size" ], "type": "object" @@ -85410,6 +85455,21 @@ "$ref": "#/definitions/IMultiLabelSpec", "description": "标签配置" }, + "layoutRadius": { + "anyOf": [ + { + "typeof": "function" + }, + { + "const": "auto", + "type": "string" + }, + { + "type": "number" + } + ], + "since": "1.11.12" + }, "minAngle": { "default": 0, "description": "最小的扇区角度(0 ~ 360),用于防止某个值过小导致扇区太小影响交互。", @@ -101572,34 +101632,34 @@ }, "Promise": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" } }, "required": [ - "__@toStringTag@13481" + "__@toStringTag@13484" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" } }, "required": [ - "__@toStringTag@13481" + "__@toStringTag@13484" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@13481": { + "__@toStringTag@13484": { "type": "string" } }, "required": [ - "__@toStringTag@13481" + "__@toStringTag@13484" ], "type": "object" }, diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 5bbde30373..a393cac991 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "1.11.11", + "version": "1.11.12", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart-types/types/chart/polar/interface.d.ts b/packages/vchart-types/types/chart/polar/interface.d.ts index f09a14610c..41fa3a2348 100644 --- a/packages/vchart-types/types/chart/polar/interface.d.ts +++ b/packages/vchart-types/types/chart/polar/interface.d.ts @@ -1,8 +1,9 @@ +import type { IPointLike } from '@visactor/vutils'; import type { IPolarAxisSpec } from '../../component/axis/polar/interface'; import type { IPolarCrosshairSpec } from '../../component/crosshair/interface'; -import type { IChartSpec, ILayoutRect, IPoint } from '../../typings'; +import type { IChartSpec, ILayoutRect } from '../../typings'; export interface IPolarChartSpec extends IChartSpec { axes?: IPolarAxisSpec[]; crosshair?: IPolarCrosshairSpec | IPolarCrosshairSpec[]; - layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPoint) => number); + layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPointLike) => number); } diff --git a/packages/vchart-types/types/component/axis/polar/axis.d.ts b/packages/vchart-types/types/component/axis/polar/axis.d.ts index b6e37216bb..b3e1e7a3ce 100644 --- a/packages/vchart-types/types/component/axis/polar/axis.d.ts +++ b/packages/vchart-types/types/component/axis/polar/axis.d.ts @@ -81,8 +81,8 @@ export declare abstract class PolarAxis & { - layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPoint) => number); + layoutRadius?: 'auto' | number | ((layoutRect: ILayoutRect, center: IPointLike) => number); inside?: boolean; orient: IPolarOrientType; grid?: IPolarGrid; diff --git a/packages/vchart-types/types/component/axis/polar/util/common.d.ts b/packages/vchart-types/types/component/axis/polar/util/common.d.ts index c63b1e725f..141bff000b 100644 --- a/packages/vchart-types/types/component/axis/polar/util/common.d.ts +++ b/packages/vchart-types/types/component/axis/polar/util/common.d.ts @@ -1,4 +1,6 @@ import type { IPolarAxisCommonSpec } from '../interface'; +import type { ILayoutRect } from '../../../../typings/layout'; +import type { IPoint } from '../../../../typings/coordinate'; export declare const getPolarAxisInfo: (spec: IPolarAxisCommonSpec, chartSpec: any) => { axisType: import("../..").AxisType; componentName: string; @@ -8,3 +10,4 @@ export declare const getPolarAxisInfo: (spec: IPolarAxisCommonSpec, chartSpec: a outerRadius: any; layoutRadius: any; }; +export declare const computeLayoutRadius: (layoutRadius: number | "auto" | ((layoutRect: ILayoutRect, center: IPoint) => number), getLayoutRect: () => ILayoutRect, getCenter: () => IPoint, startAngle?: number, endAngle?: number) => number; diff --git a/packages/vchart-types/types/core/interface.d.ts b/packages/vchart-types/types/core/interface.d.ts index 9bfe9389ff..caabfa1412 100644 --- a/packages/vchart-types/types/core/interface.d.ts +++ b/packages/vchart-types/types/core/interface.d.ts @@ -10,7 +10,7 @@ import type { ITheme } from '../theme'; import type { IComponent } from '../component/interface'; import type { LayoutCallBack } from '../layout/interface'; import type { Compiler } from '../compile/compiler'; -import type { IChart, IChartSpecInfo } from '../chart/interface'; +import type { DimensionIndexOption, IChart, IChartSpecInfo } from '../chart/interface'; import type { Stage } from '@visactor/vrender-core'; import type { IContainerSize } from '@visactor/vrender-components'; import type { IBaseScale } from '@visactor/vscale'; @@ -29,8 +29,8 @@ export interface IVChartConstructor { } export interface IVChart { readonly id: number; - renderSync: (morphConfig?: IMorphConfig, resetMediaQuery?: boolean) => IVChart; - renderAsync: (morphConfig?: IMorphConfig, resetMediaQuery?: boolean) => Promise; + renderSync: (morphConfig?: IMorphConfig) => IVChart; + renderAsync: (morphConfig?: IMorphConfig) => Promise; updateData: (id: StringOrNumber, data: Datum[] | string, options?: IParserOptions) => Promise; updateDataInBatches: (list: { id: string; @@ -39,6 +39,7 @@ export interface IVChart { }[]) => Promise; updateDataSync: (id: StringOrNumber, data: Datum[], options?: IParserOptions) => IVChart; updateFullDataSync: (data: IDataValues | IDataValues[], reRender?: boolean) => IVChart; + updateFullData: (data: IDataValues | IDataValues[], reRender?: boolean) => Promise; updateSpec: (spec: ISpec, forceMerge?: boolean, morphConfig?: IMorphConfig, userUpdateOptions?: IUpdateSpecResult) => Promise; updateSpecSync: (spec: ISpec, forceMerge?: boolean, morphConfig?: IMorphConfig, userUpdateOptions?: IUpdateSpecResult) => void; updateModelSpecSync: (filter: string | { @@ -89,8 +90,19 @@ export interface IVChart { getComponents: () => IComponent[]; getDataSet: () => Maybe; getScale: (scaleId: string) => IBaseScale | null; + setDimensionIndex: (value: StringOrNumber, options?: DimensionIndexOption) => void; convertDatumToPosition: (datum: Datum, dataLinkInfo?: DataLinkSeries, isRelativeToCanvas?: boolean, checkInViewData?: boolean) => IPoint | null; convertValueToPosition: ((value: StringOrNumber, dataLinkInfo: DataLinkAxis, isRelativeToCanvas?: boolean) => number | null) & ((value: [StringOrNumber, StringOrNumber], dataLinkInfo: DataLinkSeries, isRelativeToCanvas?: boolean) => IPoint | null); + updateIndicatorDataById: (id: string, datum?: Datum) => void; + updateIndicatorDataByIndex: (index?: number, datum?: Datum) => void; + geoZoomByIndex: (regionIndex: number, zoom: number, center?: { + x: number; + y: number; + }) => void; + geoZoomById: (regionId: string | number, zoom: number, center?: { + x: number; + y: number; + }) => void; stopAnimation: () => void; pauseAnimation: () => void; resumeAnimation: () => void; diff --git a/packages/vchart-types/types/data/transforms/pie.d.ts b/packages/vchart-types/types/data/transforms/pie.d.ts index 9f32c1afee..f727bc4509 100644 --- a/packages/vchart-types/types/data/transforms/pie.d.ts +++ b/packages/vchart-types/types/data/transforms/pie.d.ts @@ -1,9 +1,9 @@ import type { DataView } from '@visactor/vdataset'; export interface IPieOpt { - angleField: string; - startAngle: number; - endAngle: number; - minAngle: number; + angleField: () => string; + startAngle: () => number; + endAngle: () => number; + minAngle: () => number; asStartAngle: string; asEndAngle: string; asMiddleAngle: string; diff --git a/packages/vchart-types/types/model/interface.d.ts b/packages/vchart-types/types/model/interface.d.ts index 1f66278ae3..723516af51 100644 --- a/packages/vchart-types/types/model/interface.d.ts +++ b/packages/vchart-types/types/model/interface.d.ts @@ -46,6 +46,7 @@ export interface IUpdateSpecResult { reTransformSpec?: boolean; reAnimate?: boolean; changeTheme?: boolean; + changeBackground?: boolean; } export interface IUpdateDataResult { reAnimate?: boolean; diff --git a/packages/vchart-types/types/series/pie/interface.d.ts b/packages/vchart-types/types/series/pie/interface.d.ts index ff2488de9a..c2dc874714 100644 --- a/packages/vchart-types/types/series/pie/interface.d.ts +++ b/packages/vchart-types/types/series/pie/interface.d.ts @@ -6,6 +6,8 @@ import type { IPolarSeriesSpec, IPolarSeriesTheme } from '../polar/interface'; import type { PieAppearPreset } from './animation/animation'; import type { ILabelSpec, IMultiLabelSpec } from '../../component/label'; import type { ICustomPath2D, ILineGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core'; +import type { ILayoutRect } from '../../typings/layout'; +import type { IPointLike } from '@visactor/vutils'; export type PieMarks = 'pie' | 'label' | 'labelLine'; export type IBasePieSeriesSpec = Omit & { type: string; @@ -25,6 +27,7 @@ export interface IPieSeriesSpec extends IPolarSeriesSpec, IAnimationSpec number); [SeriesMarkNameEnum.pie]?: IMarkSpec; [SeriesMarkNameEnum.label]?: IMultiLabelSpec; } diff --git a/packages/vchart-types/types/series/pie/pie.d.ts b/packages/vchart-types/types/series/pie/pie.d.ts index 648f656e1e..6e8108045a 100644 --- a/packages/vchart-types/types/series/pie/pie.d.ts +++ b/packages/vchart-types/types/series/pie/pie.d.ts @@ -18,7 +18,7 @@ export declare class BasePieSeries extends PolarSe protected _pieMarkType: MarkTypeEnum; static readonly mark: SeriesMarkMap; protected _viewDataLabel: SeriesData; - getCenter(): IPoint; + getCenter: () => IPoint; protected _centerOffset: number; protected _cornerRadius: number; protected _startAngle: number; @@ -33,6 +33,7 @@ export declare class BasePieSeries extends PolarSe initMark(): void; private startAngleScale; private endAngleScale; + protected _computeLayoutRadius(): number; initMarkStyle(): void; initInteraction(): void; protected initTooltip(): void; diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 0c2625eb1d..ab223fd8ae 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,51 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "1.11.12", + "tag": "@visactor/vchart_v1.11.12", + "date": "Wed, 14 Aug 2024 14:51:54 GMT", + "comments": { + "none": [ + { + "comment": "fix: fix params of tickCount in linear-axis-mixin, fix #3053\n\n" + }, + { + "comment": "feat: support `layoutRadius` of pie\n\n" + }, + { + "comment": "fix: fix `padding` of region not work\n\n" + }, + { + "comment": "fix: brush error after legend filter. fix#3061" + }, + { + "comment": "fix: fix funnel chart color bug with different category and series fields" + }, + { + "comment": " git push --set-upstream origin fix/gauge-angle" + }, + { + "comment": "fix: fix issue with harmony event" + }, + { + "comment": "fix: fix type error of react vchart, fix #3065\n\n" + }, + { + "comment": "fix: tooltip should show when chart has multiple regions\n\n" + }, + { + "comment": "fix: fix the issue background of chart not updated, fix #3054\n\n" + }, + { + "comment": "fix: fix the update of `startAngle` and `endAngle` in pie chart, fix #3059\n\n" + }, + { + "comment": "fix: fix switch `visible` of legend, fix #3060\n\n" + } + ] + } + }, { "version": "1.11.11", "tag": "@visactor/vchart_v1.11.11", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index cc3a2d0d3f..1d899ba988 100644 --- a/packages/vchart/CHANGELOG.md +++ b/packages/vchart/CHANGELOG.md @@ -1,6 +1,40 @@ # Change Log - @visactor/vchart -This log was last generated on Tue, 06 Aug 2024 09:20:16 GMT and should not be manually modified. +This log was last generated on Wed, 14 Aug 2024 14:51:54 GMT and should not be manually modified. + +## 1.11.12 +Wed, 14 Aug 2024 14:51:54 GMT + +### Updates + +- fix: fix params of tickCount in linear-axis-mixin, fix #3053 + + +- feat: support `layoutRadius` of pie + + +- fix: fix `padding` of region not work + + +- fix: brush error after legend filter. fix#3061 +- fix: fix funnel chart color bug with different category and series fields +- git push --set-upstream origin fix/gauge-angle +- fix: fix issue with harmony event +- fix: fix type error of react vchart, fix #3065 + + +- fix: tooltip should show when chart has multiple regions + + +- fix: fix the issue background of chart not updated, fix #3054 + + +- fix: fix the update of `startAngle` and `endAngle` in pie chart, fix #3059 + + +- fix: fix switch `visible` of legend, fix #3060 + + ## 1.11.11 Tue, 06 Aug 2024 09:20:16 GMT diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index 3efa678953..a20ebe9268 100644 --- a/packages/vchart/dist/index-wx-simple.min.js +++ b/packages/vchart/dist/index-wx-simple.min.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var s,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(s=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s.tt="tt",s.harmony="harmony",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const M=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(M.call(t,e))return!1;return!0}var R=(t,e,i)=>{const n=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function P(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=_(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=P(n)}return e}function L(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];p(n[r])&&"object"==typeof n[r]?D(t,e,r,i):F(t,r,n[r])}}}}function D(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(_(r)){if(n)a=[];else if(_(s))a=s;else if(b(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const s=t[n];let r=!1;e.forEach((t=>{(y(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(i[n]=s)})),i}function z(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function H(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(z(t)!==z(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!H(t[n],e[n],i))return!1;return!0}if(!m(t))return!1;const n=V(t),s=V(e);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){const r=n[s];if(!H(t[r],e[r],i))return!1}return!0}function G(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;s{var i;if(0===t.length)return;let n=t[0];for(let s=1;s0)&&(n=r)}return n},X=(t,e)=>{var i;if(0===t.length)return;let n=t[0];for(let s=1;se?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const n=[e].concat([].slice.call(i));Q&&console[t].apply(console,n)}var et;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(et||(et={}));class it{static getInstance(t,e){return it._instance&&S(t)?it._instance.level(t):it._instance||(it._instance=new it(t,e)),it._instance}static setInstance(t){return it._instance=t}static setInstanceLevel(t){it._instance?it._instance.level(t):it._instance=new it(t)}static clearInstance(){it._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=et.Info}canLogDebug(){return this._level>=et.Debug}canLogError(){return this._level>=et.Error}canLogWarn(){return this._level>=et.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):tt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Warn&&tt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Info&&tt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Debug&&tt(this._method||"log","DEBUG",e),this}}function nt(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(u(n)&&(n=t.length);i>>1;q(t[s],e)>0?n=s:i=s+1}return i}it._instance=null;const st=1e-10,rt=1e-10;function at(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:st,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:rt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function ot(t,e,i,n){return t>e&&!at(t,e,i,n)}function lt(t,e,i,n){return t{let e=null,i=null;return function(){for(var n=arguments.length,s=new Array(n),r=0;rt===e[i]))||(e=s,i=t(...s)),i}};var ct=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,n=e-(t-l);return d?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,u&&n?f(t):(n=s=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_t=new RegExp(yt.source,"g");const bt=1e-12,xt=Math.PI,St=xt/2,At=2*xt,kt=2*Math.PI,wt=Math.abs,Tt=Math.atan2,Ct=Math.cos,Et=Math.max,Mt=Math.min,Bt=Math.sin,Rt=Math.sqrt,Ot=Math.pow;function It(t){return t>1?0:t<-1?xt:Math.acos(t)}function Pt(t){return t>=1?St:t<=-1?-St:Math.asin(t)}function Lt(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function Dt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ft(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class jt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new jt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Nt{static distancePP(t,e){return Rt(Ot(t.x-e.x,2)+Ot(t.y-e.y,2))}static distanceNN(t,e,i,n){return Rt(Ot(t-i,2)+Ot(e-n,2))}static distancePN(t,e,i){return Rt(Ot(e-t.x,2)+Ot(i-t.y,2))}static pointAtPP(t,e,i){return new jt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function zt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Ht extends Vt{}function Gt(t){return t*(Math.PI/180)}const Ut=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-At;)t+=At;else if(t>0)for(;t>At;)t-=At;return t};function Wt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Yt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function Kt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new Xt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Xt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Xt(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class $t{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:s=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=s)););if(in;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function qt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Jt=/^#([0-9a-f]{3,8})$/,Qt={transparent:4294967040},te={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ee(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ie(t){return S(t)?new ae(t>>16,t>>8&255,255&t,1):_(t)?new ae(t[0],t[1],t[2]):new ae(255,255,255)}function ne(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function se(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class re{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new re(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new re(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof re?t:new re(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(Qt[t]))return function(t){return S(t)?new ae(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ae(t[0],t[1],t[2],t[3]):new ae(255,255,255,1)}(Qt[t]);if(p(te[t]))return ie(te[t]);const e=`${t}`.trim().toLowerCase(),i=Jt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ae((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ie(t):8===e?new ae(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ae(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ae(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=re.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ae(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=qt(this.color.r,this.color.g,this.color.b),r=Zt(u(t)?s.h:ct(t,0,360),u(e)?s.s:e>=0&&e<=1?100*e:e,u(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new ae(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Jt.exec(e),n=parseInt(i[1],16),s=i[1].length;return 3===s?new ae((n>>8&15)+((n>>8&15)<<4),(n>>4&15)+((n>>4&15)<<4),(15&n)+((15&n)<<4),1):6===s?ie(n):8===s?new ae(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):this}setColorName(t){const e=te[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new re(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ne(t.color.r),this.color.g=ne(t.color.g),this.color.b=ne(t.color.b),this}copyLinearToSRGB(t){return this.color.r=se(t.color.r),this.color.g=se(t.color.g),this.color.b=se(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ae{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ee(this.r)+ee(this.g)+ee(this.b)+(1===this.opacity?"":ee(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=qt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function oe(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new ae(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:qt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ve;function ye(t,e,i,n){if(!function(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&h<=1&&[t[0]+s[0]*h,t[1]+s[1]*h]}var _e;function be(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ve=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ve&&([me,ve]=[ve,me]),ce>fe||deve||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function Ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ke(t,e){const i=e?t.angle:Gt(t.angle),n=Ae(t);return[Se({x:t.x1,y:t.y1},i,n),Se({x:t.x2,y:t.y1},i,n),Se({x:t.x2,y:t.y2},i,n),Se({x:t.x1,y:t.y2},i,n)]}!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const we=1e-8;function Te(t,e,i){let n=0,s=t[0];if(!s)return!1;for(let r=1;re&&r>n||rs?o:0}function Ee(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class Be{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Be.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Be.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Be.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Be.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Be.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Be.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Be.NUMBERS_CHAR_SET="0123456789",Be.FULL_SIZE_CHAR="字";const Re=(t,e)=>{const{x1:i,x2:n,y1:s,y2:r}=t,a=Math.abs(n-i),o=Math.abs(r-s);let l=(i+n)/2,h=(s+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function Oe(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ie(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const e=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,r=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?n:r}}return{width:i,height:n}}function Pe(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const Le=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();class De{static getInstance(){return De.instance||(De.instance=new De),De.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r1?s[0]+s.slice(2):s,+i.slice(n+1)]}let je;function Ne(t,e){const i=Fe(t,e);if(!i)return t+"";const n=i[0],s=i[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}class ze{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ve=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function He(t){let e;if(e=Ve.exec(t))return new ze({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});it.getInstance().error("invalid format: "+t)}const Ge=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ue{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,n){let s=t.length;const r=[];let a=0,o=e[0],l=0;for(;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),r.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Ue.instance||(Ue.instance=new Ue),Ue.instance}newFormat(t){const e=He(t);let i=e.fill,n=e.align;const s=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):We[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===n)&&(a=!0,i="0",n="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=We[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,n=-1;t:for(let s=1;s0&&(n=0)}return n>0?t.slice(0,n)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==s&&(t=!1),S=(t?"("===s?s:v:"-"===s||"("===s?"":s)+S,A=("s"===d?Ge[8+je/3]:"")+A+(t&&"("===s?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let w=S.length+k.length+A.length,T=w>1)+S+k+A+T.slice(w);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=He(t);i.type="f";const n=this.newFormat(i.toString()),s=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Fe(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-s),a=Ge[8+s/3];return function(t){return n(r*t)+a}}}const We={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ne(100*t,e),r:Ne,s:function(t,e){const i=Fe(t,e);if(!i)return t+"";const n=i[0],s=i[1],r=s-(je=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return r===a?n:r>a?n+new Array(r-a+1).join("0"):r>0?n.slice(0,r)+"."+n.slice(r):"0."+new Array(1-r).join("0")+Fe(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const Ye=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ei(e,6):ei(e,4))+"-"+ei(t.getUTCMonth()+1,2)+"-"+ei(t.getUTCDate(),2)+(r?"T"+ei(i,2)+":"+ei(n,2)+":"+ei(s,2)+"."+ei(r,3)+"Z":s?"T"+ei(i,2)+":"+ei(n,2)+":"+ei(s,2)+"Z":n||i?"T"+ei(i,2)+":"+ei(n,2)+"Z":"")}function ni(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Je;if(h)return h=!1,qe;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=$e.DSV;const i=Ye(ai,e),{delimiter:n}=i;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return ni(n).parse(t)},li=function(t){return(arguments.length>2?arguments[2]:void 0).type=$e.DSV,si(t)},hi=function(t){return(arguments.length>2?arguments[2]:void 0).type=$e.DSV,ri(t)},ci=(t,e,i)=>{const n=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let di=0;function ui(){return di>1e8&&(di=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+di++}class pi{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ui("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:it.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const gi="_data-view-diff-rank";class fi{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:ui("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[gi]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[gi]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[gi]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Ze),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class mi{static GenAutoIncrementId(){return mi.auto_increment_id++}}mi.auto_increment_id=0;class vi{constructor(t){this.id=mi.GenAutoIncrementId(),this.registry=t}}const yi="named",_i="inject",bi="multi_inject",xi="inversify:tagged",Si="inversify:paramtypes";class Ai{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===yi?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ki=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,n=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",s=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[s]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const n=this._keys.length;for(let t=i+1;t{wi(e,0,n,t)}}function Ci(t){return e=>(i,n,s)=>Ti(new Ai(t,e))(i,n,s)}const Ei=Ci(_i),Mi=Ci(bi);function Bi(){return function(t){return ki.defineMetadata(Si,null,t),t}}function Ri(t){return Ti(new Ai(yi,t))}const Oi="Singleton",Ii="Transient",Pi="ConstantValue",Li="DynamicValue",Di="Factory",Fi="Function",ji="Instance",Ni="Invalid";class zi{constructor(t,e){this.id=mi.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ni,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new zi(this.serviceIdentifier,this.scope);return t.activated=t.scope===Oi&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Vi{getConstructorMetadata(t){return{compilerGeneratedMetadata:ki.getMetadata(Si,t),userGeneratedMetadata:ki.getMetadata(xi,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Hi=(Gi=yi,t=>{const e=e=>{if(null==e)return!1;if(e.key===Gi&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Yi=Symbol("ContributionProvider");class Ki{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xi(t,e){t(Yi).toDynamicValue((t=>{let{container:i}=t;return new Ki(e,i)})).inSingletonScope().whenTargetNamed(e)}class $i{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class Zi extends $i{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const qi=Symbol.for("EnvContribution"),Ji=Symbol.for("VGlobal");var Qi=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},en=function(t,e){return function(i,n){e(i,n,t)}};let nn=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=mi.GenAutoIncrementId(),this.hooks={onSetEnv:new Zi(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};nn=Qi([Bi(),en(0,Ei(Yi)),en(0,Ri(qi)),tn("design:paramtypes",[Object])],nn);const sn=At-1e-8;class rn{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>sn)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=At)<0&&(n+=At),(s%=At)<0&&(s+=At),ss;++o,a-=St)g(a);else for(a=n-n%St+St,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const on=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ln={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},hn={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let cn,dn,un,pn,gn,fn;var mn,vn,yn,_n,bn,xn,Sn,An,kn;function wn(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),v=.5*(s-n),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,x=i+g+_*p,S=e+f,A=i+m,k=S+_*m,w=A-_*f;return[h*b+c*x,d*b+u*x,h*k+c*w,d*k+u*w,h*S+c*A,d*S+u*A]}function Tn(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,v=-c/n,y=d/n,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===s&&(k=-k);const w=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),C=Math.atan2(b-T,_-w);let E=Math.atan2(S-T,x-w)-C;E<0&&1===r?E+=At:E>0&&0===r&&(E-=At);const M=Math.ceil(Math.abs(E/(St+.001))),B=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function Mn(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Nn extends jn{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zn(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}function Vn(t,e,i){const n=null!=e?e:wt(i[i.length-1].x-i[0].x)>wt(i[i.length-1].y-i[0].y)?Sn.ROW:Sn.COLUMN;return"monotoneY"===t?new Nn(t,n):new jn(t,n)}class Hn{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Gn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=Vn("linear",i,t);return function(t,e){zn(t,e)}(new Hn(s,n),t),s}function Un(t,e,i,n,s){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n,t.lastPoint1)}class Wn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Un(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Un(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Yn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Gn(t,e);const s=Vn("basis",i,t);return function(t,e){zn(t,e)}(new Wn(s,n),t),s}function Kn(t){return t<0?-1:1}function Xn(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Kn(r)+Kn(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function $n(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Zn(t,e,i,n,s){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class qn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Zn(this,this._t0,$n(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,Zn(this,$n(this,e=Xn(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Zn(this,this._t0,e=Xn(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Jn extends qn{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Qn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Gn(t,e);const s=Vn("monotoneX",i,t);return function(t,e){zn(t,e)}(new qn(s,n),t),s}function ts(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Gn(t,e);const s=Vn("monotoneY",i,t);return function(t,e){zn(t,e)}(new Jn(s,n),t),s}let es=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function is(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new jn("step",null!=n?n:wt(t[t.length-1].x-t[0].x)>wt(t[t.length-1].y-t[0].y)?Sn.ROW:Sn.COLUMN);return function(t,e){zn(t,e)}(new es(r,e,s),t),r}class ns extends Hn{lineEnd(){this.context.closePath()}}function ss(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=Vn("linear",i,t);return function(t,e){zn(t,e)}(new ns(s,n),t),s}function rs(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>bt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>bt){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function as(t,e){return function(i,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Gn(i,s);const o=Vn(t,r,i);return zn(new e(o,n,a),i),o}}const os=as("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:rs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ls=as("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:rs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function hs(t,e,i){var n,s;switch(e){case"linear":default:return Gn(t,i);case"basis":return Yn(t,i);case"monotoneX":return Qn(t,i);case"monotoneY":return ts(t,i);case"step":return is(t,.5,i);case"stepBefore":return is(t,0,i);case"stepAfter":return is(t,1,i);case"catmullRom":return os(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return ls(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return ss(t,i)}}class cs extends an{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new rn(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([hn.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([hn.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([hn.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([hn.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([hn.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([hn.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([hn.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([hn.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([hn.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[hn.M]=t=>`M${t[1]} ${t[2]}`,t[hn.L]=t=>`L${t[1]} ${t[2]}`,t[hn.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[hn.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[hn.A]=t=>{const e=[];Cn(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[hn.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tfn){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Mn(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Sn.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.y-e.p1.y)}if(this.direction===Sn.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const ds=["l",0,0,0,0,0,0,0];function us(t,e,i){const n=ds[0]=t[0];if("a"===n||"A"===n)ds[1]=e*t[1],ds[2]=i*t[2],ds[3]=t[3],ds[4]=t[4],ds[5]=t[5],ds[6]=e*t[6],ds[7]=i*t[7];else if("h"===n||"H"===n)ds[1]=e*t[1];else if("v"===n||"V"===n)ds[1]=i*t[1];else for(let n=1,s=t.length;n{it.getInstance().warn("空函数")}}),Es=Object.assign(Object.assign({},bs),{points:[],cornerRadius:0,closePath:!0}),Ms=Object.assign(Object.assign({},bs),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bs),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Bs=Object.assign(Object.assign({},bs),{symbolType:"circle",size:10,keepDirIn3d:!0}),Rs=Object.assign(Object.assign(Object.assign({},bs),vs),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Os=Object.assign(Object.assign(Object.assign({},bs),vs),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Is=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bs),{fill:!0,cornerRadius:0}),Ps=Object.assign(Object.assign({},Is),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const Ls=new class{},Ds={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Fs=!0,js=!1,Ns=/\w|\(|\)|-/,zs=/[.?!,;:/,。?!、;:]/,Vs=/\S/;function Hs(t,e,i,n,s){if(!e||e<=0)return 0;const r=Ls.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=Gs(t,a)),a}function Gs(t,e){let i=e;for(;Ns.test(t[i-1])&&Ns.test(t[i])||zs.test(t[i]);)if(i--,i<=0)return e;return i}function Us(t,e){const i=Ls.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var Ws=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ys=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Rs.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&r.str!==t){const i=Gs(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextEnd(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length-1);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,s,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=Gs(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}};Ys=Ws([Bi()],Ys);var Ks=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Xs=Symbol.for("TextMeasureContribution");let $s=class extends Ys{};$s=Ks([Bi()],$s);const Zs=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ii,this.options=e,this.id=mi.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Vi}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,yi,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new zi(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),new Wi(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),s=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:s(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),n=Object.keys(i),s=[];for(let t=0;t{n[t.key]=t.value}));const r={inject:n[_i],multiInject:n[bi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};s.push(l)}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Pi:case Fi:e=t.cache;break;case ji:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Oi&&(t.cache=e,t.activated=!0)}},qs=Symbol.for("CanvasFactory"),Js=Symbol.for("Context2dFactory");function Qs(t){return Zs.getNamed(qs,Ls.global.env)(t)}const tr=1e-4,er=Math.sqrt(3),ir=1/3;function nr(t){return t>-vr&&tvr||t<-vr}const rr=[0,0],ar=[0,0],or=[0,0];function lr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hr(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function cr(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function dr(t){return(t%=kt)<0&&(t+=kt),t}function ur(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function pr(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=kt);let d=Math.atan2(l,o);return d<0&&(d+=kt),d>=n&&d<=s||d+kt>=n&&d+kt<=s}function mr(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(nr(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const _r=[-1,-1,-1],br=[-1,-1];function xr(){const t=br[0];br[0]=br[1],br[1]=t}function Sr(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(nr(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ir):Math.pow(i,ir),n=n<0?-Math.pow(-n,ir):Math.pow(n,ir);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+er*Math.sin(e)))/(3*a),h=(-o+i*(n-er*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,_r);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xr(),p=cr(e,n,r,o,br[0]),u>1&&(g=cr(e,n,r,o,br[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(nr(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,_r);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=hr(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);_r[0]=-l,_r[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=kt-1e-4){n=0,s=kt;const e=r?1:-1;return a>=_r[0]+t&&a<=_r[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=kt,s+=kt);let c=0;for(let e=0;e<2;e++){const i=_r[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=kt+t),(t>=n&&t<=s||t+kt>=n&&t+kt<=s)&&(t>xt/2&&t<1.5*xt&&(e=-e),c+=e)}}return c}function wr(t){return Math.round(t/xt*1e8)/1e8%2*xt}function Tr(t,e){let i=wr(t[0]);i<0&&(i+=kt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=kt?s=i+kt:e&&i-s>=kt?s=i-kt:!e&&i>s?s=i+(kt-wr(i-s)):e&&i1&&(i||(h+=ur(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;Cr[0]=S,Cr[1]=A,Tr(Cr,Boolean(a[6])),S=Cr[0],A=Cr[1];const k=S,w=A-S,T=!!(1-(a[6]?0:1)),C=(n-m)*y/y+m;switch(f){case hn.M:u=m,p=v,c=u,d=p;break;case hn.L:if(i){if(mr(c,d,m,v,e,n,s))return!0}else h+=ur(c,d,m,v,n,s)||0;c=m,d=v;break;case hn.C:if(i){if(gr(c,d,m,v,y,_,b,x,e,n,s))return!0}else h+=Sr(c,d,m,v,y,_,b,x,n,s)||0;c=b,d=x;break;case hn.Q:if(i){if(pr(c,d,m,v,y,_,e,n,s))return!0}else h+=Ar(c,d,m,v,y,_,n,s)||0;c=y,d=_;break;case hn.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=ur(c,d,o,l,n,s),i){if(fr(m,v,y,k,k+w,T,e,C,s))return!0}else h+=kr(m,v,y,k,k+w,T,C,s);c=Math.cos(k+w)*y+m,d=Math.sin(k+w)*y+v;break;case hn.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(mr(u,p,o,p,e,n,s)||mr(o,p,o,l,e,n,s)||mr(o,l,u,l,e,n,s)||mr(u,l,u,p,e,n,s))return!0}else h+=ur(o,p,o,l,n,s),h+=ur(u,l,u,p,n,s);break;case hn.Z:if(i){if(mr(c,d,u,p,e,n,s))return!0}else h+=ur(c,d,u,p,n,s);c=u,d=p}}return i||(g=d,f=p,Math.abs(g-f)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Or=Symbol.for("VWindow"),Ir=Symbol.for("WindowHandlerContribution");let Pr=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new Zi(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Zs.getNamed(Ir,t.env).configure(this,t),this.actived=!0)},this._uid=mi.GenAutoIncrementId(),this.global=Ls.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Pr=Br([Bi(),Rr("design:paramtypes",[])],Pr);var Lr=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fr=function(t,e){return function(i,n){e(i,n,t)}};let jr=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ls.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Mr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:vs.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Be(Object.assign({defaultFontParams:{fontFamily:vs.fontFamily,fontSize:vs.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=Zs.get(Or),s=t.AABBBounds,r=s.width(),a=s.height(),o=-s.x1,l=-s.y1;n.create({viewBox:{x1:o,y1:l,x2:s.x2,y2:s.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=n.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Nr;jr=Lr([Bi(),Fr(0,Ei(Yi)),Fr(0,Ri(Xs)),Dr("design:paramtypes",[Object])],jr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Nr||(Nr={}));const zr=new Xt;let Vr=class{constructor(){this.matrix=new Xt}init(t){return this.mode=Nr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Nr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(zr.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(zr.a,zr.b,zr.c,zr.d,zr.e,zr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(zr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(zr.a,zr.b,zr.c,zr.d,zr.e,zr.f),this}scale(t,e,i){return this.mode===Nr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Nr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return zr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(zr.a,zr.b,zr.c,zr.d,zr.e,zr.f),this}translate(t,e){return this.mode===Nr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Nr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vr=Lr([Bi(),Dr("design:paramtypes",[])],Vr);const Hr={arc:xs,area:Ss,circle:As,line:Ts,path:Cs,symbol:Bs,text:Rs,rect:Ms,polygon:Es,richtext:Os,richtextIcon:Ps,image:Is,group:ks,glyph:ws},Gr=Object.keys(Hr);function Ur(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Wr={arc:Object.assign({},Hr.arc),area:Object.assign({},Hr.area),circle:Object.assign({},Hr.circle),line:Object.assign({},Hr.line),path:Object.assign({},Hr.path),symbol:Object.assign({},Hr.symbol),text:Object.assign({},Hr.text),rect:Object.assign({},Hr.rect),polygon:Object.assign({},Hr.polygon),richtext:Object.assign({},Hr.richtext),richtextIcon:Object.assign({},Hr.richtextIcon),image:Object.assign({},Hr.image),group:Object.assign({},Hr.group),glyph:Object.assign({},Hr.glyph)};class Yr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gr.forEach((t=>{this._defaultTheme[t]=Object.create(Wr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Gr.forEach((n=>{const s=Object.create(Wr[n]);t&&t[n]&&Ur(s,t[n]),i[n]&&Ur(s,i[n]),e[n]&&Ur(s,e[n]),this.combinedTheme[n]=s})),e.common&&Gr.forEach((t=>{Ur(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Kr=new Yr;function Xr(t,e){return t.glyphHost?Xr(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Kr.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xr(t.attachedThemeGraphic)||Kr.getTheme()}var $r=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class Zr extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=mi.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $r(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof Qr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(na(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof Qr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=na(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof Qr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=na(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Qr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=na(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Qr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=ia.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(na(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(na(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,na(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Qr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):na(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ia.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,s=i.length;n{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new sa(n,{clickInterval:a}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Qr,this.rootWheelEvent=new ta,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&y(t)&&!I(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class la{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return la.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class ha{static Avaliable(){return!0}avaliable(){return ha.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class ca{static Avaliable(){return!!Ls.global.getRequestAnimationFrame()}avaliable(){return ca.Avaliable()}tick(t,e){Ls.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var da;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(da||(da={}));class ua{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-ua.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ua.bounceIn(2*t):.5*ua.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/kt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*kt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/kt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*kt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/kt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*kt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*kt/e)*.5+1}}}ua.quadIn=ua.getPowIn(2),ua.quadOut=ua.getPowOut(2),ua.quadInOut=ua.getPowInOut(2),ua.cubicIn=ua.getPowIn(3),ua.cubicOut=ua.getPowOut(3),ua.cubicInOut=ua.getPowInOut(3),ua.quartIn=ua.getPowIn(4),ua.quartOut=ua.getPowOut(4),ua.quartInOut=ua.getPowInOut(4),ua.quintIn=ua.getPowIn(5),ua.quintOut=ua.getPowOut(5),ua.quintInOut=ua.getPowInOut(5),ua.backIn=ua.getBackIn(1.7),ua.backOut=ua.getBackOut(1.7),ua.backInOut=ua.getBackInOut(1.7),ua.elasticIn=ua.getElasticIn(1,.3),ua.elasticOut=ua.getElasticOut(1,.3),ua.elasticInOut=ua.getElasticInOut(1,.3*1.5);class pa{constructor(){this.id=mi.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===_n.END?this.removeAnimate(e):e.status===_n.RUNNING||e.status===_n.INITIAL?(this.animateCount++,e.advance(t)):e.status===_n.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const ga=new pa;class fa{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class ma extends fa{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let va=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mi.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ga;this.id=t,this.timeline=e,this.status=_n.INITIAL,this.tailAnimate=new ya(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Et(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&bn.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:yn.ANIMATE_PLAY})}runCb(t){const e=new ma((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===_n.RUNNING&&(this.status=_n.PAUSED)}resume(){this.status===_n.PAUSED&&(this.status=_n.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new ya(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===_n.RUNNING&&(this.status=_n.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=_n.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};va.mode=bn.NORMAL,va.interpolateMap=new Map;class ya{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new _a(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?ua[i]:i,s=this._addStep(e,null,n);return s.type=xn.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?ua[i]:i,r=this._addStep(e,null,s);return r.type=xn.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=xn.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xn.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new _a(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),e.propKeys=Object.keys(e.props),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return it.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class _a{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const ba=200,xa="cubicOut",Sa=1e3,Aa="quadInOut";var ka;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(ka||(ka={}));const wa=[!1,!1,!1,!1],Ta=[0,0,0,0],Ca=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Ta[0]=t[0],Ta[2]=t[0],Ta[1]=t[1],Ta[3]=t[1],Ta):t:t:0,Ea=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ma=[1,2,3,0,1,2,3,0];function Ba(t,e,i,n){for(;t>=kt;)t-=kt;for(;t<0;)t+=kt;for(;t>e;)e+=kt;Ea[0].x=i,Ea[1].y=i,Ea[2].x=-i,Ea[3].y=-i;const s=Math.ceil(t/St)%4,r=Math.ceil(e/St)%4;if(n.add(Ct(t)*i,Bt(t)*i),n.add(Ct(e)*i,Bt(e)*i),s!==r||e-t>xt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new jt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new jt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s0&&void 0!==arguments[0]?arguments[0]:La.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}La.TimeOut=1e3/60;const Da=new La,Fa=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class ja extends fa{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ft(this.fromNumber),Ft(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Na;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Na||(Na={}));class za extends fa{constructor(t,e,i,n,s){var r,a;super(t,e,i,n,s),this.newPointAnimateType=null!==(r=null==s?void 0:s.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==s?void 0:s.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new jt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=Ra(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Va extends fa{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Ha extends fa{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?ua[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function Ga(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function Ua(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function Za(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function qa(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}};function to(t,e,i){const n=t/e;let s,r;t>=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),no=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},so=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return no(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return no(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);so(s[0],n,i),so(s[1],e-n,i)}};var ro;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ro||(ro={}));class ao{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ro.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ro.Color1){const e=ao.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=re.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];ao.store1[t]=e,ao.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=ao.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=re.parseColorString(t);return s&&(ao.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],ao.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===ro.Color1){if(ao.store1[t])return;ao.store1[t]=i,ao.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ao.store255[t])return;ao.store255[t]=i,ao.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function oo(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function lo(t,e,i,n,s){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((s,r)=>ho(_(t)?t[r]:t,_(e)?e[r]:e,i,n))):ho(t,e,i,n,s)}function ho(t,e,i,n,s){if(!t||!e)return t&&oo(t)||e&&oo(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ao.Get(t,ro.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ao.Get(e,ro.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:oo(a)})))});return o?lo(r,l,i,n,s):lo(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:po(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:po(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:po(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),oo(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}ao.store255={},ao.store1={};const co=[0,0,0,0],uo=[0,0,0,0];function po(t,e,i){return ao.Get(t,ro.Color255,co),ao.Get(e,ro.Color255,uo),`rgba(${Math.round(co[0]+(uo[0]-co[0])*i)},${Math.round(co[1]+(uo[1]-co[1])*i)},${Math.round(co[2]+(uo[2]-co[2])*i)},${co[3]+(uo[3]-co[3])*i})`}const go=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=lo(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},fo=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?Za(t):[],s=Za(e);i&&n&&(i.fromTransform&&qa(n,i.fromTransform.clone().getInverse()),qa(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},vo=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],yo=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!vo.includes(s))return;const r=e[s];u(r)||u(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?ao.Get(t[s],ro.Color255):t[s],to:"string"==typeof r?ao.Get(r,ro.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class _o extends fa{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;fo(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&go(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const bo=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=mo(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=yo(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new _o({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sa,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Aa)),c};class xo extends fa{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;fo(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&go(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const So=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ia.includes(t))(i)||(e[i]=t[i])})),e},Ao=(t,e,i)=>{const n=So(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Ls.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},ko=(t,e,i)=>{const n=[],s=i?null:So(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:So(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:n}=Qa(t.attribute),s=to(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Ls.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=to(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Ls.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=to(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Ls.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return eo(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return eo(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Ls.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:io(i)}];const n=[];return so(i,e,n),n})(t,e).forEach((t=>{n.push(Ls.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return so(r,e,h),h})(t,e).forEach((t=>{n.push(Ls.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=Za(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Ls.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Ls.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&Ao(t,n,e),n};class To{static GetImage(t,e){var i;const n=To.cache.get(t);n?"fail"===n.loadState?Ls.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):To.loadImage(t,e)}static GetSvg(t,e){var i;let n=To.cache.get(t);n?"fail"===n.loadState?Ls.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},To.cache.set(t,n),n.dataPromise=Ls.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=To.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},To.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ls.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ls.global.loadBlob(t):"json"===e&&(i.dataPromise=Ls.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!To.isLoading&&To.toLoadAueue.length){To.isLoading=!0;const t=To.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(To.cache.set(i,s),s.dataPromise=Ls.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{To.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),To.loading()})).catch((t=>{console.error(t),To.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),To.loading()}))}}),0)}static loadImage(t,e){const i=Co(t,To.toLoadAueue);if(-1!==i)return To.toLoadAueue[i].marks.push(e),void To.loading();To.toLoadAueue.push({url:t,marks:[e]}),To.loading()}static improveImageLoading(t){const e=Co(t,To.toLoadAueue);if(-1!==e){const t=To.toLoadAueue.splice(e,1);To.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Co(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Ht,this._updateTag=mn.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,n;const{dx:s=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Po.x=s+(null!==(i=t.scrollX)&&void 0!==i?i:0),Po.y=r+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Po.x=s,Po.y=r;return Po}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Ls.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Ls.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Xt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mn.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mn.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mn.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mn.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mn.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&mn.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mn.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===vn.GLOBAL){const i=new jt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Bo;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Bo;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Ls.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=n&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:ba,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xa),c&&this.setAttributes(c,!1,{type:yn.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:yn.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();I(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=mn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=mn.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=mn.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&mn.UPDATE_SHAPE_AND_BOUNDS)===mn.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=mn.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=mn.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=mn.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=mn.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=mn.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=mn.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=mn.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&mn.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],n=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:n}=this.attribute;return Mo.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Mo),this.setAttributes({scaleX:t,scaleY:i,angle:n}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,s=n();i[0]=s.x1+(s.x2-s.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,s=n();i[1]=s.y1+(s.y2-s.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ps.x,y:e=ps.y,scaleX:i=ps.scaleX,scaleY:n=ps.scaleY,angle:s=ps.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ct(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=n);const y=m-i,_=v-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Ls.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ps);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Eo.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Ls.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:yn.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:yn.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=lo(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=lo(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=lo(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return Xr(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ls.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new cs).fromString(t):this.pathProxy=new cs,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Ls.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new ea(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}Do.mixin(ra);class Fo{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function jo(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function No(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",s="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let s=n.data;const r=n.index,a=s.search(/\s/);let o=s,l=!0;-1!==a&&(o=s.substr(0,a).replace(/\s\s*$/,""),s=s.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==n.data.substr(t+1))}return{tagName:o,tagExp:s,closeIndex:r,attrExpPresent:l,rawTagName:h}}const zo=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Vo{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;"string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const s=function(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=No(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=jo(t,"--\x3e",r+4,"Comment is not closed.");else{const a=No(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new Fo(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new Fo(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=c}else n+=t[r];return e.child}}function Ho(t,e){return Go(t)}function Go(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let $o=0;function Zo(){return $o++}var qo;function Jo(t){const e=[];let i=0,n="";for(let s=0;sQo.set(t,!0)));const tl=new Map;function el(t){if(Qo.has(t))return!0;if(tl.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>tl.set(t,!0)));const il=Zo(),nl=Zo(),sl=Zo(),rl=Zo(),al=Zo(),ol=Zo(),ll=Zo(),hl=Zo(),cl=Zo(),dl=Zo();Zo();const ul=Zo();Zo();const pl=Zo(),gl=Zo(),fl=Zo(),ml=Symbol.for("GraphicService"),vl=Symbol.for("GraphicCreator"),yl={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},_l=Object.keys(yl);var bl;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(bl||(bl={}));class xl extends Do{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=ol,this._childUpdateTag=mn.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Yr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yr)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===vn.GLOBAL){const i=new jt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mn.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Ls.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Ls.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ps.x,y:e=ps.y,dx:i=ps.dx,dy:n=ps.dy,scaleX:s=ps.scaleX,scaleY:r=ps.scaleY,angle:a=ps.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Xr(this).group;this._AABBBounds.clear();const i=Ls.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=Ca(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=mn.CLEAR_BOUNDS,this._childUpdateTag&=mn.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=mn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mn.UPDATE_BOUNDS||(this._childUpdateTag|=mn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Ls.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Ls.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Ls.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Ls.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Ls.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mn.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Ls.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new xl(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xl.NOWORK_ANIMATE_ATTR}}function Sl(t){return new xl(t)}xl.NOWORK_ANIMATE_ATTR=Lo;class Al extends xl{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new Yr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ls.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ls.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const kl=Symbol.for("TransformUtil"),wl=Symbol.for("GraphicUtil"),Tl=Symbol.for("LayerService"),Cl=Symbol.for("StaticLayerHandlerContribution"),El=Symbol.for("DynamicLayerHandlerContribution"),Ml=Symbol.for("VirtualLayerHandlerContribution");var Bl,Rl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ol=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Il=Bl=class{static GenerateLayerId(){return`${Bl.idprefix}_${Bl.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ls.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Zs.get(Cl):"dynamic"===t?Zs.get(El):Zs.get(Ml),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=new Al(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Bl.GenerateLayerId(),layerHandler:s})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Il.idprefix="visactor_layer",Il.prefix_count=0,Il=Bl=Rl([Bi(),Ol("design:paramtypes",[])],Il);var Pl=new vi((t=>{t(Ji).to(nn).inSingletonScope(),t(Or).to(Pr),t(wl).to(jr).inSingletonScope(),t(kl).to(Vr).inSingletonScope(),t(Tl).to(Il).inSingletonScope()}));function Ll(t,e){return!(!t&&!e)}function Dl(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Fl(t,e,i){return i&&t*e>0}function jl(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function Nl(t,e){return t*e>0}function zl(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Vl(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uB*B+R*R&&(k=T,w=C),{cx:k,cy:w,x01:-c,y01:-d,x11:k*(s/x-1),y11:w*(s/x-1)}}function Gl(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=wt(l-o),c=l>o;let d=!1;if(s=kt-bt)e.moveTo(i+s*Ct(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>bt&&(e.moveTo(i+r*Ct(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=_(u),{outerDeltaAngle:g,innerDeltaAngle:f,outerStartAngle:m,outerEndAngle:v,innerEndAngle:y,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,w=Math.max(S,x),T=Math.max(A,k);let C=w,E=T;const M=s*Ct(m),B=s*Bt(m),R=r*Ct(y),O=r*Bt(y);let I,P,L,D;if((T>bt||w>bt)&&(I=s*Ct(v),P=s*Bt(v),L=r*Ct(b),D=r*Bt(b),hbt){const t=Mt(x,C),r=Mt(S,C),o=Hl(L,D,M,B,s,t,Number(c)),l=Hl(I,P,R,O,s,r,Number(c));C0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ct(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+s*Bt(v))}else!a||a[0]?(e.moveTo(i+M,n+B),e.arc(i,n,s,m,v,!c)):e.moveTo(i+s*Ct(v),n+s*Bt(v));if(!(r>bt)||f<.001)!a||a[1]?e.lineTo(i+R,n+O):e.moveTo(i+R,n+O),d=!0;else if(E>bt){const t=Mt(k,E),s=Mt(A,E),o=Hl(R,O,I,P,r,-s,Number(c)),l=Hl(M,B,L,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),E0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ct(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+L,n+D)}else!a||a[1]?e.lineTo(i+R,n+O):e.moveTo(i+R,n+O),!a||a[2]?e.arc(i,n,r,y,b,c):e.moveTo(i+r*Ct(b),n+r*Bt(b))}return a?a[3]&&e.lineTo(i+s*Ct(o),n+s*Bt(o)):e.closePath(),d}class Ul{static GetCanvas(){try{return Ul.canvas||(Ul.canvas=Ls.global.createCanvas({})),Ul.canvas}catch(t){return null}}static GetCtx(){if(!Ul.ctx){const t=Ul.GetCanvas();Ul.ctx=t.getContext("2d")}return Ul.ctx}}class Wl extends $t{static getInstance(){return Wl._instance||(Wl._instance=new Wl),Wl._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Ul.GetCanvas(),n=Ul.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${n}`;s.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Yl{static GetSize(t){for(let e=0;e=t)return Yl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=Yl.GenKey(t,e,i,n,s),l=Yl.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=Yl.GenKey(t,e,i,n,s);Yl.cache[l]?Yl.cache[l].push({width:a,height:o,pattern:r}):Yl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}Yl.cache={},Yl.ImageSize=[20,40,80,160,320,640,1280,2560];const Kl=Symbol.for("ArcRenderContribution"),Xl=Symbol.for("AreaRenderContribution"),$l=Symbol.for("CircleRenderContribution"),Zl=Symbol.for("GroupRenderContribution"),ql=Symbol.for("PathRenderContribution"),Jl=Symbol.for("PolygonRenderContribution"),Ql=Symbol.for("RectRenderContribution"),th=Symbol.for("SymbolRenderContribution"),eh=Symbol.for("TextRenderContribution"),ih=Symbol.for("InteractiveSubRenderContribution"),nh=["radius","startAngle","endAngle",...Bo];class sh extends Do{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=rl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Xr(this).circle;this._AABBBounds.clear();const i=this.attribute,n=Ls.graphicService.updateCircleAABBBounds(i,Xr(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Ca(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xr(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,nh)}needUpdateTag(t){return super.needUpdateTag(t,nh)}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new cs;return o.arc(0,0,s,r,a),o}clone(){return new sh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sh.NOWORK_ANIMATE_ATTR}}function rh(t){return new sh(t)}function ah(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function oh(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function lh(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}sh.NOWORK_ANIMATE_ATTR=Lo;class hh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=fl,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Xr(this).text;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,n,s;const r=Xr(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:y=0,lineClamp:b}=this.attribute,x=null!==(e=Fa(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Ls.graphicUtil.textMeasure,k=new hh(a,{fontSize:h,fontWeight:f,fontFamily:a},A),w=_(t)?t.map((t=>t.toString())):[t.toString()],T=[],C=[0,0];let E=1/0;if(y>0&&(E=Math.max(Math.floor(y/x),1)),b&&(E=Math.min(E,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),C[0]=t}else{let t,e,i=0;for(let n=0,s=w.length;n{const e=t.direction===qo.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=oh(x,o),w=lh(S,b,p);return this._AABBBounds.set(w,k,w+b,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const n=Xr(this).text,{wrap:s=n.wrap}=this.attribute;if(s)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=n.fontFamily,textAlign:o=n.textAlign,textBaseline:l=n.textBaseline,fontSize:h=n.fontSize,fontWeight:c=n.fontWeight,ellipsis:d=n.ellipsis,maxLineWidth:u,stroke:p=n.stroke,lineWidth:g=n.lineWidth,whiteSpace:f=n.whiteSpace,suffixPosition:m=n.suffixPosition}=r,v=null!==(e=Fa(r.lineHeight,r.fontSize||n.fontSize))&&void 0!==e?e:r.fontSize||n.fontSize;if("normal"===f)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const y=Ls.graphicUtil.textMeasure,_=new hh(a,{fontSize:h,fontWeight:c,fontFamily:a},y).GetLayoutByLines(t,o,l,v,!0===d?n.ellipsis:d||void 0,!1,u,m),{bbox:b}=_;return this.cache.layoutData=_,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,n,s;const r=Xr(this).text,a=Ls.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:m=r.stroke,lineWidth:v=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:_=r.suffixPosition}=l,b=null!==(i=Fa(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const e=x;x=null!==(n=t.baselineMapAlign[S])&&void 0!==n?n:"left",S=null!==(s=t.alignMapBaseline[e])&&void 0!==s?s:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Et(e,o)}));const t=oh(x,o),e=this.cache.verticalList.length*b,i=lh(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>Jo(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,n=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,i,!1,_);A[e]=n.verticalList,o=n.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===qo.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Et(e,o)}));const k=oh(x,o),w=this.cache.verticalList.length*b,T=lh(S,w,g);return this._AABBBounds.set(T,k,T+w,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xr(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ch;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ch;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function uh(t){return new dh(t)}dh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Lo),dh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},dh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class ph{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function gh(t,e,i,n,s){return s?t.arc(i,n,e,0,At,!1,s):t.arc(i,n,e,0,At),!1}var fh=new class extends ph{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,s){return gh(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return gh(t,e/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var mh=new class extends ph{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,e/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,e/6,i,n,s,r)}};function vh(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var yh=new class extends ph{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return vh(t,e/2,i,n,s)}drawFitDir(t,e,i,n,s){return vh(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return vh(t,e/2+s,i,n,r)}};function _h(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var bh=new class extends ph{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return _h(t,e/2,i,n)}drawOffset(t,e,i,n,s){return _h(t,e/2+s,i,n)}};class xh extends ph{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i+e,e+n),t.lineTo(i-e,e+n),t.lineTo(i,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}(t,e/2,i,n,s)}}var Sh=new xh;var Ah=new class extends xh{constructor(){super(...arguments),this.type="triangle"}};const kh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),wh=Math.sin(At/10)*kh,Th=-Math.cos(At/10)*kh;function Ch(t,e,i,n){const s=wh*e,r=Th*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=At*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var Eh=new class extends ph{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return Ch(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Ch(t,e/2+s,i,n)}};const Mh=Rt(3);function Bh(t,e,i,n){const s=e,r=s/Mh,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var Rh=new class extends ph{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return Bh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Bh(t,e/2+s,i,n)}};function Oh(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var Ih=new class extends ph{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return Oh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Oh(t,e/2+s,i,n)}};function Ph(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Lh=new class extends ph{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return Ph(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Ph(t,e/2+s,i,n)}};const Dh=-.5,Fh=Rt(3)/2,jh=1/Rt(12);function Nh(t,e,i,n){const s=e/2,r=e*jh,a=s,o=e*jh+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(Dh*s-Fh*r+i,Fh*s+Dh*r+n),t.lineTo(Dh*a-Fh*o+i,Fh*a+Dh*o+n),t.lineTo(Dh*l-Fh*h+i,Fh*l+Dh*h+n),t.lineTo(Dh*s+Fh*r+i,Dh*r-Fh*s+n),t.lineTo(Dh*a+Fh*o+i,Dh*o-Fh*a+n),t.lineTo(Dh*l+Fh*h+i,Dh*h-Fh*l+n),t.closePath(),!1}var zh=new class extends ph{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Nh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Nh(t,e/2+s,i,n)}};var Vh=new class extends ph{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(e+i,e+n),t.lineTo(e+i,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}(t,e/2,i,n,s)}};var Hh=new class extends ph{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i-e,e+n),t.lineTo(e+i,n),t.lineTo(i-e,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}(t,e/2,i,n,s)}};var Gh=new class extends ph{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i-e,n-e),t.lineTo(i+e,n-e),t.lineTo(i,n+e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}(t,e/2,i,n,s)}};const Uh=Rt(3);function Wh(t,e,i,n){const s=e*Uh;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Yh=new class extends xh{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Wh(t,e/2/Uh,i,n)}drawOffset(t,e,i,n,s){return Wh(t,e/2/Uh+s,i,n)}};function Kh(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var Xh=new class extends ph{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return Kh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Kh(t,e/4+s,i,n)}};function $h(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var Zh=new class extends ph{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return $h(t,e/4,i,n)}drawOffset(t,e,i,n,s){return $h(t,e/4+s,i,n)}};function qh(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Jh=new class extends ph{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return qh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return qh(t,e/4+s,i,n)}};function Qh(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var tc=new class extends ph{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return Qh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Qh(t,e/4+s,i,n)}};function ec(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var ic=new class extends ph{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return ec(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return ec(t,e/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function nc(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var sc=new class extends ph{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return nc(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return nc(t,e/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function rc(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var ac=new class extends ph{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,s){return rc(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return rc(t,e/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function oc(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function lc(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var hc=new class extends ph{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return S(e)?lc(t,e,i,n):oc(t,e,i,n)}drawOffset(t,e,i,n,s){return S(e)?lc(t,e+2*s,i,n):oc(t,[e[0]+2*s,e[1]+2*s],i,n)}};const cc=new Ht;class dc{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Mn(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(Mn(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Mn(s.path.commandList,t,i,n,e,e),r&&r(s.path,s.attribute)})),!1):(Mn(this.path.commandList,t,i,n,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;cc.x1=n.bounds.x1*t,cc.y1=n.bounds.y1*t,cc.x2=n.bounds.x2*t,cc.y2=n.bounds.y2*t,e.union(cc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const uc={};[fh,mh,yh,bh,Yh,Ah,Eh,Rh,Ih,Lh,zh,Vh,Hh,Sh,Gh,Xh,Zh,Jh,tc,hc,ic,sc,ac].forEach((t=>{uc[t.type]=t}));const pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},gc=new Ht,fc=["symbolType","size",...Bo];let mc=class t extends Do{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=gl}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Xr(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,n=uc[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(i=pc[i]||i,!0===((s=i).startsWith("{const e=(new cs).fromString(t.d),i={};_l.forEach((e=>{t[e]&&(i[yl[e]]=t[e])})),r.push({path:e,attribute:i}),gc.union(e.bounds)}));const a=gc.width(),o=gc.height(),l=1/Et(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new dc(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var s;const r=(new cs).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Et(a,o);return r.transform(0,0,l,l),this._parsedPath=new dc(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xr(this).symbol;this._AABBBounds.clear();const i=this.attribute,n=Ls.graphicService.updateSymbolAABBBounds(i,Xr(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Ca(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xr(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,fc)}needUpdateTag(t){return super.needUpdateTag(t,fc)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new cs).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cs).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function vc(t){return new mc(t)}mc.userSymbolMap={},mc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Lo);const yc=["segments","points","curveType","curveTension",...Bo];let _c=class t extends Do{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=hl}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Oa(i,n,e))}doUpdateAABBBounds(){const t=Xr(this).line;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updateLineAABBBounds(e,Xr(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xr(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,yc)}needUpdateTag(t){return super.needUpdateTag(t,yc)}toCustomPath(){const t=this.attribute,e=new cs,i=t.segments,n=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bc(t){return new _c(t)}_c.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Lo);const xc=["width","x1","y1","height","cornerRadius",...Bo];class Sc extends Do{constructor(t){super(t),this.type="rect",this.numberType=ul}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xr(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updateRectAABBBounds(e,Xr(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xr(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,xc)}needUpdateTag(t){return super.needUpdateTag(t,xc)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:s}=Qa(t),r=new cs;return r.moveTo(e,i),r.rect(e,i,n,s),r}clone(){return new Sc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Sc.NOWORK_ANIMATE_ATTR}}function Ac(t){return new Sc(t)}Sc.NOWORK_ANIMATE_ATTR=Lo;class kc{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Ds[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-s:"center"===this.globalAlign&&(o=-s/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class wc{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=Fa(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof n?n>this.fontSize?n:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:s,height:r,descent:a,width:o}=Us(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=s+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Us(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==s&&"end"!==s||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Hs(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===s||"end"===s){const{width:e}=Us(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||js;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Fs;if(!i)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Hs(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=Us(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const Tc=["width","height","image",...Bo];class Cc extends Do{constructor(t){super(t),this.type="image",this.numberType=ll,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}doUpdateAABBBounds(){const t=Xr(this).image;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updateImageAABBBounds(e,Xr(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Is[t]}needUpdateTags(t){return super.needUpdateTags(t,Tc)}needUpdateTag(t){return super.needUpdateTag(t,Tc)}clone(){return new Cc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Cc.NOWORK_ANIMATE_ATTR}}Cc.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Lo);class Ec extends Cc{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Ca(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Ca(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Is.width,height:e=Is.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Mc{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Ec?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Ds[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof wc){const e=Vs.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let s=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n.overflow)continue;if(n instanceof Ec)break;if("vertical"===this.direction&&"vertical"!==n.direction){n.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";n.ellipsisStr=r;const{width:a}=Us(r,n.character),o=a||0;if(o<=this.blankWidth+t){e&&(n.ellipsis="add");break}if(o<=this.blankWidth+t+n.width){n.ellipsis="replace",n.ellipsisWidth=o,n.ellipsisOtherParagraphWidth=this.blankWidth+t;break}n.ellipsis="hide",t+=n.width}}this.paragraphs.map(((e,s)=>{if(e instanceof Ec)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===s,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof Ec)break;const{width:s}=Us(t,n.character),r=s||0;if(r<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=r;break}if(r<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=r,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof Ec?t.width:t.getWidthWithEllips(this.direction)})),i}}class Bc{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Ds[this.direction]}store(t){if(t instanceof Ec){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Mc(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof Ec?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=Hs(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new wc(i,t.newLine,t.character),new wc(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Rc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Bo];class Oc extends Do{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pl}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Os.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Os.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Os.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Os.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Os.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Os.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Os.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Os.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xr(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updateRichTextAABBBounds(e,Xr(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Os[t]}needUpdateTags(t){return super.needUpdateTags(t,Rc)}needUpdateTag(t){return super.needUpdateTag(t,Rc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:n,fontFamily:s,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:n,fontFamily:s,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:n,maxHeight:s,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,f=[],m=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,f.push(t)}}else{const e=this.combinedStyleToCharacter(m[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,y="number"==typeof s&&Number.isFinite(s)&&s>0,_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=n),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=s),x=new kc(0,0,(_?r:v?n:0)||0,(b?a:y?s:0)||0,o,l,h,c,d,u||"horizontal",!_&&v,!b&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Bc(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}getNoWorkAnimateAttr(){return Oc.NOWORK_ANIMATE_ATTR}}function Ic(t){return new Oc(t)}Oc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Lo);const Pc=["path","customPath",...Bo];class Lc extends Do{constructor(t){super(t),this.type="path",this.numberType=cl}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Xr(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cs?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cs?this.cache:t.path)}doUpdateAABBBounds(){const t=Xr(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updatePathAABBBounds(e,Xr(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new cs).fromString(t.path):t.customPath&&(this.cache=new cs,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xr(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Pc)}needUpdateTag(t){return super.needUpdateTag(t,Pc)}toCustomPath(){return(new cs).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Lc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lc.NOWORK_ANIMATE_ATTR}}function Dc(t){return new Lc(t)}Lc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Lo);const Fc=["segments","points","curveType","curveTension",...Bo];class jc extends Do{constructor(t){super(t),this.type="area",this.numberType=sl}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Xr(this).area;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updateAreaAABBBounds(e,Xr(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Oa(i,n,e))}getDefaultAttribute(t){return Xr(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Fc)}needUpdateTag(t){return super.needUpdateTag(t,Fc)}toCustomPath(){const t=new cs,e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new jc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jc.NOWORK_ANIMATE_ATTR}}function Nc(t){return new jc(t)}jc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Lo);const zc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Bo];class Vc extends Do{constructor(t){super(t),this.type="arc",this.numberType=il}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=Xr(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:s=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(s+=n,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(s-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Xr(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Ut(e),i=e+r,n&&wt(r)bt&&o>bt)return{startAngle:e-s*u*r,endAngle:i+s*u*a,sc:s*u*r,ec:s*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Xr(this).arc,{innerPadding:n=i.innerPadding,outerPadding:s=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=s,o-=n;const{padRadius:l=Rt(a*a+o*o)}=this.attribute,h=wt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>bt&&l>bt){const i=e>t?1:-1;let n=Pt(Number(l)/o*Bt(g)),s=Pt(Number(l)/a*Bt(g));return(f-=2*n)>bt?(n*=i,u+=n,p-=n):(f=0,u=p=(t+e)/2),(m-=2*s)>bt?(s*=i,c+=s,d-=s):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}doUpdateAABBBounds(t){const e=Xr(this).arc;this._AABBBounds.clear();const i=this.attribute,n=Ls.graphicService.updateArcAABBBounds(i,Xr(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Ca(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,zc)}needUpdateTag(t){return super.needUpdateTag(t,zc)}getDefaultAttribute(t){return Xr(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let n=t.innerRadius-(t.innerPadding||0),s=t.outerRadius-(t.outerPadding||0);const r=wt(i-e),a=i>e;if(s=kt-bt)o.moveTo(0+s*Ct(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>bt&&(o.moveTo(0+n*Ct(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Ct(e),r=s*Bt(e),l=n*Ct(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new Vc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vc.NOWORK_ANIMATE_ATTR}}function Hc(t){return new Vc(t)}Vc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Lo);const Gc=["points","cornerRadius",...Bo];class Uc extends Do{constructor(t){super(t),this.type="polygon",this.numberType=dl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xr(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Ls.graphicService.updatePolygonAABBBounds(e,Xr(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ca(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Oa(i,n,e))}getDefaultAttribute(t){return Xr(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Gc)}needUpdateTag(t){return super.needUpdateTag(t,Gc)}toCustomPath(){const t=this.attribute.points,e=new cs;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Uc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Uc.NOWORK_ANIMATE_ATTR}}function Wc(t){return new Uc(t)}Uc.NOWORK_ANIMATE_ATTR=Lo;class Yc extends xl{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Kc(t){return new Yc(t)}class Xc{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+(r+a)/2)}return i}}class $c extends Xc{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;Xo(i,n+(r+o)/2,!0,a)}return i}}class Zc{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Zc.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},td=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ed=function(t,e){return function(i,n){e(i,n,t)}};function id(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+v*r+e[15]),t}function nd(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function sd(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function rd(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),id(t,t,[s+o,r+l,a+h]),id(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),id(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=Jc.allocate(),n=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}id(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),id(i,i,[-n[0],-n[1],0]),sd(t,t,i)}}let ad=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Zi(["graphic"]),onSetStage:new Zi(["graphic","stage"]),onRemove:new Zi(["graphic"]),onRelease:new Zi(["graphic"]),onAddIncremental:new Zi(["graphic","group","stage"]),onClearIncremental:new Zi(["graphic","group","stage"]),beforeUpdateAABBBounds:new Zi(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Zi(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Ht,this.tempAABBBounds2=new Ht,this._rectBoundsContribitions=[new Xc],this._symbolBoundsContribitions=[new $c],this._imageBoundsContribitions=[new Xc],this._circleBoundsContribitions=[new Xc],this._arcBoundsContribitions=[new Xc],this._pathBoundsContribitions=[new Xc]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new rn(t);return Mn(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!this.updatePathProxyAABBBounds(i,n)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const s=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),s.copy(i),s}updateGlyphAABBBounds(t,e,i,n){return this._validCheck(t,e,i,n)?(n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=lh(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=oh(s,e);i.set(n,i.y1,n+e,i.y2)}}updateRichTextAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){Xo(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),zt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>kt-bt?i.set(-a,-a,a,a):Ba(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return s+=a,r-=o,sl){const t=h;h=l,l=t}return s<=bt?i.set(0,0,0,0):Math.abs(l-h)>kt-bt?i.set(-s,-s,s,s):(Ba(h,l,s,i),Ba(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Xo(d,(l+h)/Math.abs(s+r),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Xo(d,o/Math.abs(s+r)*2,!1,c+1),d.translate(n,a),e.union(d)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&zt(e,e,a)}_validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!n.valid)return i.clear(),!1;const{visible:s=e.visible}=t;return!!s||(i.clear(),!1)}};ad=Qc([Bi(),ed(0,Ei(vl)),td("design:paramtypes",[Object])],ad);const od=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let ld,hd;function cd(t){return ld||(ld=od.CreateGraphic("text",{})),ld.initAttributes(t),ld.AABBBounds}const dd={x:0,y:0,z:0,lastModelMatrix:null};class ud{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===kn.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===kn.afterFillStroke)))}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Fl(o,l,s),p=Nl(o,c),g=Ll(s,r),f=Dl(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||n||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;dd.x=s,dd.y=r,dd.z=a,dd.lastModelMatrix=d;const p=u&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=Jc.allocate(),s=Jc.allocate();rd(s,t,e),sd(n,d||n,s),dd.x=0,dd.y=0,dd.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Jc.free(s)}if(g&&!d){const n=t.getOffsetXY(e);dd.x+=n.x,dd.y+=n.y,dd.z=a,i.setTransformForCurrent()}else if(p)dd.x=0,dd.y=0,dd.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const n=t.getOffsetXY(e);dd.x+=n.x,dd.y+=n.y,this.transformWithoutTranslate(i,dd.x,dd.y,dd.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),dd.x=0,dd.y=0,dd.z=0;return dd}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,s){const{context:r}=n;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=Xr(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=Fl(d,u,h),_=Nl(d,g),b=Ll(h),x=Dl(c,p);return!f||(!b&&!x||(!(y||_||a||o)||(e.beginPath(),Mn(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,n-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,n-v,l),e.fill())),!0)))}(t,r,l,h,0,s)||(this.drawShape(t,r,l,h,n,s),this.z=0,r.modelMatrix!==d&&Jc.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const pd=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return s("linear",t.linearGradient,r)||s("radial",t.radialGradient,o)||s("conic",t.conicGradient,a)}function s(e,n,s){return function(n,r){const a=v(n);if(a){v(t.startCall)||i("Missing (");const n=function(n){const r=s();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),n}}(n)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,n,s=l();return s&&(i=[],i.push(s),n=e,v(t.comma)&&(s=l(),s?i.push(s):e=n)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let n=e();const s=[];if(n)for(s.push(n);v(t.comma);)n=e(),n?s.push(n):i("One extra comma");return s}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const n=v(e);if(n)return{type:t,value:n[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const n=t.exec(e);return n&&y(n[0].length),n}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class gd{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(gd.IsGradientStr(t))try{const e=pd(t)[0];if(e){if("linear"===e.type)return gd.ParseLinear(e);if("radial"===e.type)return gd.ParseRadial(e);if("conic"===e.type)return gd.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=xt/2,s=parseFloat(e.value)/180*xt-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+kt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=xt/2;let s="angular"===e.type?parseFloat(e.value)/180*xt:0;for(;s<0;)s+=kt;for(;s>kt;)s-=kt;let r=0,a=0,o=0,l=0;return s({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function fd(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function md(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(_(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}var vd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_d=function(t,e){return function(i,n){e(i,n,t)}};class bd{constructor(){this.time=kn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(g);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Xr(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,this.doDrawImage(e,s.data,r,v,y),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n,s){if("no-repeat"===n)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(s&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(o=i*(a/s),l=a):"repeat-y"===n&&(l=s*(r/i),o=r);const h=t.dpr,c=Mr.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Mr.free(c)}const h=t.dpr,c=t.createPattern(e,n);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const xd=new bd;let Sd=class{constructor(t){this.subRenderContribitions=t,this.time=kn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};Sd=vd([Bi(),_d(0,Ei(Yi)),_d(0,Ri(ih)),yd("design:paramtypes",[Object])],Sd);class Ad{constructor(){this.time=kn.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Mr.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Mr.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,kt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,m)}drawTexture(t,e,i,n,s,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,s,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const kd=new Ad;const wd=new class{constructor(){this.time=kn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=m;const C=!(!u||!u.stroke),E=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=fd(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T+r,innerRadius:w-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),Gl(t,e,i,n,T+r,w-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(C){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-n)/k,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=fd(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T-r,innerRadius:w+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),Gl(t,e,i,n,T-r,w+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(E){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-n)/k,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:w,startAngle:y,endAngle:_})}},Td=kd,Cd=xd;const Ed=new class{constructor(){this.time=kn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),w=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=fd(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,m+r,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=fd(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,m-r,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(w){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}},Md=kd,Bd=xd;const Rd=new class extends bd{constructor(){super(...arguments),this.time=kn.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;this.doDrawImage(e,i.data,n,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Od=xt/2;function Id(t,e,i,n,s,r){let a;if(n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),S(r,!0))a=[r=wt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=wt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=wt(t[0]),i=wt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=wt(a[0]),a[1]=wt(a[1]),a[2]=wt(a[2]),a[3]=wt(a[3])}}else a=[0,0,0,0];if(n<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],y=[h[0],h[1]-u[2]],_=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!$(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-Od,0,!1)}if(t.lineTo(y[0],y[1]),!$(v,y)){const e=y[0]-u[2],i=y[1];t.arc(e,i,u[2],0,Od,!1)}if(t.lineTo(_[0],_[1]),!$(_,b)){const e=_[0],i=_[1]-u[3];t.arc(e,i,u[3],Od,xt,!1)}if(t.lineTo(g[0],g[1]),!$(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],xt,xt+Od,!1)}return t.closePath(),t}var Pd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ld=class{constructor(){this.time=kn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Ld=Pd([Bi()],Ld);let Dd=class{constructor(){this.time=kn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke}=t.attribute;let{width:v,height:y}=t.attribute;if(v=(null!=v?v:u-g)||0,y=(null!=y?y:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),m[0]?e.lineTo(i+v,n):e.moveTo(i+v,n),m[1]?e.lineTo(i+v,n+y):e.moveTo(i+v,n+y),m[2]?e.lineTo(i,n+y):e.moveTo(i,n+y),m[3]){const t=m[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};Dd=Pd([Bi()],Dd);const Fd=new class{constructor(){this.time=kn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,opacity:v=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:A-i)||0,T=(null!=T?T:k-n)||0;const C=!(!u||!u.stroke),E=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=fd(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(a,o,w+h,T+h)):(e.beginPath(),Id(e,a,o,w+h,T+h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(C){const s=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(y-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=fd(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(a,o,w-h,T-h)):(e.beginPath(),Id(e,a,o,w-h,T-h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(E){const s=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(y-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}},jd=kd,Nd=xd;const zd=new class{constructor(){this.time=kn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=fd(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,n,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(m){const{distance:s=l.innerBorder.distance}=g,r=fd(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,n,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}},Vd=kd,Hd=xd;var Gd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ud=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wd=function(t,e){return function(i,n){e(i,n,t)}};let Yd=class extends ud{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=il,this.builtinContributions=[wd,Cd,Td],this.init(t)}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=wt(d-c),p=d>c;let g=!1;if(sbt||E>bt)&&(D=s*Ct(x),F=s*Bt(x),j=r*Ct(A),N=r*Bt(A),ubt){const t=Mt(k,B),r=Mt(w,B),a=Hl(j,N,O,I,s,t,Number(p)),o=Hl(D,F,P,L,s,r,Number(p));if(B0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+O,n+I);if(!(r>bt)||y<.001)e.lineTo(i+P,n+L),g=!0;else if(R>bt){const t=Mt(C,R),s=Mt(T,R),a=Hl(P,L,D,F,r,-s,Number(p)),o=Hl(O,I,j,N,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),R0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Ct(A),n+r*Bt(A));return g}drawShape(t,e,i,n,s,r,a,o){const l=Xr(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g,{outerPadding:_=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=_,k-=b;let w=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();wt(n-i){var e;let i=!0;if(c(t,!0)){for(let n=0;n<4;n++)wa[n]=t,i&&(i=!(null!==(e=wa[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wa[e]=!!t[e],i&&(i=!!wa[e]);else wa[0]=!1,wa[1]=!1,wa[2]=!1,wa[3]=!1;return{isFullStroke:i,stroke:wa}})(d);if((v||E)&&(e.beginPath(),Gl(t,e,i,n,A,k),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-n,l),e.fill())),y&&E&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,p-n,l),e.stroke()))),!E&&y&&(e.beginPath(),Gl(t,e,i,n,A,k,M),C||this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(wt(h-r)>=kt-bt){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),C||this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=kt;for(;i>kt;)i-=kt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),lo(o.color,l.color,h,!1)}(0,0,h,s);a||Fl&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}y&&(o||m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))}}this.afterRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}};Yd=Gd([Bi(),Wd(0,Ei(Yi)),Wd(0,Ri(Kl)),Ud("design:paramtypes",[Object])],Yd);var Kd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$d=function(t,e){return function(i,n){e(i,n,t)}};let Zd=class extends ud{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=rl,this.builtinContributions=[Ed,Bd,Md],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=Xr(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g;e.beginPath(),e.arc(i,n,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-n,l),e.fill())),y&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,p-n,l),e.stroke())),this.afterRenderStep(t,e,i,n,v,y,f,m,l,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}};function qd(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=Pn(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}function Jd(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),qd(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=Sn.ROW:"y"===n?f=Sn.COLUMN:"auto"===n&&(f=e.direction);const m=i*e.tryUpdateLength(f);let v=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tu=class extends ud{constructor(){super(...arguments),this.numberType=hl}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f,m,v,y,b;if(!e)return;t.beginPath();const x=null!==(f=this.z)&&void 0!==f?f:0;Jd(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:w,connectedY:T,connectedStyle:C}=a;if(_(o)?(k=null!==(m=null!=k?k:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,w=null!==(v=null!=w?w:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(y=null!=T?T:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,w=null!=w?w:o.connectedX,T=null!=T?T:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),Jd(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:w,zeroY:T});const f=[];_(o)?o.forEach((t=>f.push(t))):f.push(o),f.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,A-d,f),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,A-d,f),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,n,l,s,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const s=hs(t.points,v,{startPoint:e,curveTension:m});return n=s,s})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,s[g],[l,t.attribute],y,_,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,s[m],[l,t.attribute],Mt(y,1),_,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,_,i,n,t,a,o)}};function eu(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function iu(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),qd(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),qd(t,l,1,n),o=!1):o=!0}t.closePath()}tu=Qd([Bi()],tu);const nu=new class extends Ad{constructor(){super(...arguments),this.time=kn.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Pa(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Pa(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Pa(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Pa(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}},su=xd;var ru=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ou=function(t,e){return function(i,n){e(i,n,t)}};function lu(t,e,i){var n,s;switch(e){case"linear":default:return Gn(t,i);case"basis":return Yn(t,i);case"monotoneX":return Qn(t,i);case"monotoneY":return ts(t,i);case"step":return is(t,.5,i);case"stepBefore":return is(t,0,i);case"stepAfter":return is(t,1,i);case"catmullRom":return os(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return ls(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return ss(t,i)}}let hu=class extends ud{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=sl,this.builtinContributions=[nu,su],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m,v;const{points:y}=t.attribute;if(y.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=y[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t=0;t--){const i=y[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,d,null,{attribute:t.attribute}),n){const{stroke:i=l&&l.stroke}=t.attribute;if(_(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t=0;t--){const i=y[t];e.lineTo((null!==(m=i.x1)&&void 0!==m?m:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=Xr(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S,doStroke:A}=x,{clipRange:k=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;if(w&&"linear"===E&&(E="linearClosed"),1===k&&!C&&!T.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const n=C.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=lu(t.points,E,{startPoint:e,curveTension:b});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}i.length>1&&(s=lu(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const n=lu(e,E,{curveTension:b}),s=lu(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,_,r[c],[g,t.attribute],k,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,S,v,A,_,r[u],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,_,t.attribute,g,k,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let m=!1;return m=m||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),m=m||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),m}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m){var v,y,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:w}=a;const T=[];if(g&&(_(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(y=null!=A?A:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,w=null!==(x=null!=w?w:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),_(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:C,segments:E}=u.attribute;let M,B,R=Sn.ROW;if(E){const t=E[E.length-1];B=E[0].points[0],M=t.points[t.points.length-1]}else B=C[0],M=C[C.length-1];const O=wt(M.x-B.x),I=wt(M.y-B.y);R=null==M.x1?Sn.ROW:null==M.y1?Sn.COLUMN:Number.isFinite(O+I)?O>I?Sn.ROW:Sn.COLUMN:Sn.ROW,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),eu(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),eu(t,e,i,n),e.length=0,i.length=0)}s=o})),eu(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?Sn.ROW:Sn.COLUMN,Number.isFinite(u)||(h=Sn.COLUMN),Number.isFinite(p)||(h=Sn.ROW);const g=i*(h===Sn.ROW?u:p);let f=0,m=!0;const v=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gu=function(t,e){return function(i,n){e(i,n,t)}};let fu=class extends ud{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=cl,this.builtinContributions=[du,cu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Xr(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;if(e.beginPath(),t.pathShape)Mn(t.pathShape.commandList,e,i,n,1,1,g);else{Mn((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,n,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,n,y,_,m,v,d,s,a,o),_&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-n,d),e.stroke())),y&&(a?a(e,t.attribute,d):m&&(e.setCommonStyle(t,t.attribute,u-i,p-n,d),e.fill())),this.afterRenderStep(t,e,i,n,y,_,m,v,d,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};fu=uu([Bi(),gu(0,Ei(Yi)),gu(0,Ri(ql)),pu("design:paramtypes",[Object])],fu);var mu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yu=function(t,e){return function(i,n){e(i,n,t)}};let _u=class extends ud{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=ul,this.builtinContributions=[Fd,Nd,jd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xr(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:y=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:w}=t.attribute;k=(null!=k?k:b-S)||0,w=(null!=w?w:x-A)||0;const T=jl(g,f,k,w,c),C=zl(g,v,k,w),E=Ll(c,d),M=Dl(u,m);if(!t.valid||!y)return;if(!E&&!M)return;if(!(T||C||a||o||d))return;0===p||_(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,k,w)):(e.beginPath(),Id(e,i,n,k,w,p));const B={doFill:E,doStroke:M};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,E,M,T,C,h,s,a,o,B),B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-n,h),e.fill())),B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,A-n,h),e.stroke())),this.afterRenderStep(t,e,i,n,E,M,T,C,h,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).rect;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};_u=mu([Bi(),yu(0,Ei(Yi)),yu(0,Ri(Ql)),vu("design:paramtypes",[Object])],_u);var bu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Su=function(t,e){return function(i,n){e(i,n,t)}};let Au=class extends ud{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=gl,this.builtinContributions=[zd,Hd,Vd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=Xr(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const s=e.project(i,n,A),r=e.camera;e.camera=null,!1===x.draw(e,_(c)?[c[0]*p,c[1]*g]:c*p,s.x,s.y,void 0,((s,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-n,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-n)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,n,A,((s,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-n,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-n)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,y,b,m,v,h,s,a,o),y&&!x.isSvg&&(a?a(e,t.attribute,h):m&&(e.setCommonStyle(t,t.attribute,d-i,u-n,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-n)/g,h),e.stroke())),this.afterRenderStep(t,e,i,n,y,b,m,v,h,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};Au=bu([Bi(),Su(0,Ei(Yi)),Su(0,Ri(th)),xu("design:paramtypes",[Object])],Au);const ku=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ht)}allocate(t,e,i,n){if(!this.pools.length)return(new Ht).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new Ht(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const wu=new class extends bd{constructor(){super(...arguments),this.time=kn.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let w,{background:T}=t.attribute;if(!T)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),w&&e.setTransformFromMatrix(w,!0,1))};let E;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const M=g(T)&&T.background,B=t.transMatrix.onlyTranslate();if(M){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),n=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),s=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(y=T.height)&&void 0!==y?y:e.height();if(E=ku.allocate(i,n,i+s,n+r),T=T.background,!B){const t=E.width(),e=E.height();E.set((null!==(_=T.x)&&void 0!==_?_:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,B||(E=cd(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const s=t.resources.get(T);if("success"!==s.state||!s.data)return void C();e.highPerformanceSave(),B&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,l),this.doDrawImage(e,s.data,E,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:s}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=T,s?(Id(e,E.x1,E.y1,E.width(),E.height(),s),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}M&&ku.free(E),C()}};var Tu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eu=function(t,e){return function(i,n){e(i,n,t)}};let Mu=class extends ud{constructor(t){super(),this.textRenderContribitions=t,this.numberType=fl,this.builtinContributions=[wu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const d=Xr(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,whiteSpace:v=d.whiteSpace,fontSize:y=d.fontSize,verticalMode:_=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!_&&"vertical"===m){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fa(t.attribute.lineHeight,y))&&void 0!==c?c:y,w=this.valid(t,d,a,o);if(!w)return;const{fVisible:T,sVisible:C,doFill:E,doStroke:M}=w,B=!f,R=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,n,E,M,T,C,d,s,a,o),B&&this.transformUseContext2d(t,d,R,e);const O=(s,r,l,h)=>{let c=i+r;const u=n+l;if(h){e.highPerformanceSave(),c+=y;const t=qc.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),qc.free(t)}M&&(o?o(e,t.attribute,d):C&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,d),e.strokeText(s,c,u,R))),E&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-n,d),e.fillText(s,c,u,R),this.drawUnderLine(p,g,t,c,u,R,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,R),"horizontal"===m){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;M&&(o?o(e,t.attribute,d):C&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,d),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),E&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-n,d),s.lines.forEach((s=>{var a,o;e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n-(o=y,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*y,R,s.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=k*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Et(e,r)}));let a=0,o=0;"bottom"===A?o=-s:"middle"===A&&(o=-s/2),"center"===S?a-=r/2:"right"===S&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===S?l+=n/2:"right"===S&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;O(i,s-(e+1)*k+o,l,r),l+=n}))}))}else if("horizontal"===m){e.setTextStyle(t.attribute,d,R);const i=t.clipedText;let n=0;k!==y&&("top"===A?n=(k-y)/2:"middle"===A||"bottom"===A&&(n=-(k-y)/2)),O(i,0,n,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,R);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?s-=r/2:"right"===S&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;O(e,a,s,n),s+=i}))}}B&&this.restoreTransformUseContext2d(t,d,R,e),this.afterRenderStep(t,e,i,n,E,M,T,C,d,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:f=a.fillOpacity}=i.attribute,m=i.clipedWidth,v=oh(l,m),y=lh(h,c,c),_={lineWidth:0,stroke:d,opacity:u,strokeOpacity:f};if(t){_.lineWidth=t,o.setStrokeStyle(i,_,n,s,a),g&&o.setLineDash(g),o.beginPath();const e=s+y+c+p;o.moveTo(n+v,e,r),o.lineTo(n+v+m,e,r),o.stroke()}if(e){_.lineWidth=e,o.setStrokeStyle(i,_,n,s,a),o.beginPath();const t=s+y+c/2;o.moveTo(n+v,t,r),o.lineTo(n+v+m,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,f=lh("alphabetic",h,h),m={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),p&&l.setLineDash(p),l.beginPath();const e=s+f+h+v+u;l.moveTo(n+0,e,r),l.lineTo(n+0+a,e,r),l.stroke()}if(v=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+h/2+v;l.moveTo(n+0,t,r),l.lineTo(n+0+a,t,r),l.stroke()}}};function Bu(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Du=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fu=function(t,e){return function(i,n){e(i,n,t)}};let ju=class extends ud{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=dl,this.builtinContributions=[Pu,Iu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=Xr(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Bu(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Bu(t,e,i,n);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(s)?null!==(a=s[r%e.length])&&void 0!==a?a:0:s,y=v/m;const _=Ru(d,u),b=Ru(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Ou(h,y,_,d,u),A=Ou(h,y,b,p,g),k=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=Ru(k,w),C=Ou(h,Ru(y,v),T,k,w);let E=Math.atan2(S.y-C.y,S.x-C.x);const M=Math.atan2(A.y-C.y,A.x-C.x);let B=M-E;B<0&&(E=M,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),B&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,v),t.lineTo(A.x+i,A.y+n)}r||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-n,l),e.fill())),y&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,d-i,u-n,l),e.stroke())),this.afterRenderStep(t,e,i,n,v,y,f,m,l,s,a,o)}draw(t,e,i,n){const s=Xr(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}};ju=Lu([Bi(),Fu(0,Ei(Yi)),Fu(0,Ri(Jl)),Du("design:paramtypes",[Object])],ju);var Nu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vu=function(t,e){return function(i,n){e(i,n,t)}};let Hu=class{constructor(t){this.groupRenderContribitions=t,this.numberType=ol}drawShape(t,e,i,n,s,r,a,o){const l=Xr(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=jl(u,m,p,g,h),k=zl(u,v,p,g),w=Ll(h,c),T=Dl(d,x);if(!t.valid||!S)return;if(!f){if(!w&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),Id(e,i,n,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rd));const C={doFill:w,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===kn.beforeFillStroke&&r.drawShape(t,e,i,n,w,T,A,k,l,s,a,o,C)})),f&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===kn.afterFillStroke&&r.drawShape(t,e,i,n,w,T,A,k,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?s.save():s.highPerformanceSave(),s.baseGlobalAlpha*=a;const o=Xr(t,null==n?void 0:n.theme).group,l=s.modelMatrix;if(s.camera){const e=Jc.allocate(),i=Jc.allocate();rd(i,t,o),sd(e,l||e,i),s.modelMatrix=e,Jc.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&s.translate(h,c),n&&n.drawingCb&&(d=n.drawingCb()),s.modelMatrix!==l&&Jc.free(s.modelMatrix),s.modelMatrix=l,s.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};Hu=Nu([Bi(),Vu(0,Ei(Yi)),Vu(0,Ri(Zl)),zu("design:paramtypes",[Object])],Hu);const Gu=Symbol.for("IncrementalDrawContribution"),Uu=Symbol.for("ArcRender"),Wu=Symbol.for("AreaRender"),Yu=Symbol.for("CircleRender"),Ku=Symbol.for("GraphicRender"),Xu=Symbol.for("GroupRender"),$u=Symbol.for("LineRender"),Zu=Symbol.for("PathRender"),qu=Symbol.for("PolygonRender"),Ju=Symbol.for("RectRender"),Qu=Symbol.for("SymbolRender"),tp=Symbol.for("TextRender"),ep=Symbol.for("RichTextRender"),ip=Symbol.for("GlyphRender"),np=Symbol.for("DrawContribution");var sp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ap=Symbol.for("DrawItemInterceptor"),op=new Ht,lp=new Ht;class hp{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){op.copy(n.dirtyBounds),lp.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(op),n.backupDirtyBounds.copy(lp)),!0}}class cp{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let dp=class{constructor(){this.order=1,this.interceptors=[new hp,new pp,new up,new cp]}afterDrawItem(t,e,i,n,s){for(let r=0;r(e=t.numberType===nl,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=kt;for(;o<0;)o+=kt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",n.renderGroup(t,i,r),i.hack_pieFace="inside",n.renderGroup(t,i,r),i.hack_pieFace="top",n.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i,t.parent.globalTransMatrix)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&Jc.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var gp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mp=function(t,e){return function(i,n){e(i,n,t)}};const vp=Symbol.for("RenderService");let yp=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};yp=gp([Bi(),mp(0,Ei(np)),fp("design:paramtypes",[Object])],yp);var _p=new vi((t=>{t(vp).to(yp)}));const bp=Symbol.for("PickerService"),xp=Symbol.for("GlobalPickerService");var Sp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ap=Symbol.for("PickItemInterceptor");let kp=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Xr(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=qc.allocateByObj(a),u=new jt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};kp=Sp([Bi()],kp);let wp=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new jt(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}};wp=Sp([Bi()],wp);let Tp=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===nl,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=kt;for(;o<0;)o+=kt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Tp=Sp([Bi()],Tp);var Cp=new vi(((t,e,i)=>{i(bp)||(t(xp).toSelf(),t(bp).toService(xp)),t(Tp).toSelf().inSingletonScope(),t(Ap).toService(Tp),t(kp).toSelf().inSingletonScope(),t(Ap).toService(kp),t(wp).toSelf().inSingletonScope(),t(Ap).toService(wp),Xi(t,Ap)})),Ep=new vi((t=>{t(ml).to(ad).inSingletonScope(),t(vl).toConstantValue(od)}));const Mp=Symbol.for("AutoEnablePlugins"),Bp=Symbol.for("PluginService");var Rp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ip=function(t,e){return function(i,n){e(i,n,t)}};let Pp=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Zs.isBound(Mp)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Pp=Rp([Bi(),Ip(0,Ei(Yi)),Ip(0,Ri(Mp)),Op("design:paramtypes",[Object])],Pp);var Lp=new vi((t=>{t(Bp).to(Pp),function(t,e){t(Yi).toDynamicValue((t=>{let{container:i}=t;return new Ki(e,i)})).whenTargetNamed(e)}(t,Mp)})),Dp=new vi((t=>{Xi(t,qi)})),Fp=new vi((t=>{t(Xs).to($s).inSingletonScope(),Xi(t,Xs)})),jp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ls.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Qs({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};zp=jp([Bi(),Np("design:paramtypes",[])],zp);var Vp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gp=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Ls.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return null}release(){}};Gp=Vp([Bi(),Hp("design:paramtypes",[])],Gp);var Up=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yp=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Ls.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=Qs({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(a,o,l,h),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),n.nativeContext.restore()}merge(t){}};Yp=Up([Bi(),Wp("design:paramtypes",[])],Yp);var Kp=new vi((t=>{t(zp).toSelf(),t(Yp).toSelf(),t(Gp).toSelf(),t(Cl).toService(zp),t(El).toService(Yp),t(Ml).toService(Gp)}));var Xp=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function $p(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Xp(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function qp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var Jp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tg=function(t,e){return function(i,n){e(i,n,t)}};let eg=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt,this.global=Ls.global,this.layerService=Ls.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,viewBox:s,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,s.width(),s.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(o=a,l=n.dirtyBounds,h=!1,null===o?l:null===l?o:(ce=o.x1,de=o.x2,ue=o.y1,pe=o.y2,ge=l.x1,fe=l.x2,me=l.y1,ve=l.y2,h&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ve&&([me,ve]=[ve,me])),ce>=fe||de<=ge||ue>=ve||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ve)}));a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}var o,l,h;const c=i.dpr%1;(c||.5!==c)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(s.x1,s.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:bs.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,qc.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=qp(e,i,bs.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!be(t.AABBBounds,this.dirtyBounds,!1))return;let s,r=i;if(this.useDirtyBounds){s=ku.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=qc.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;n?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):$p(t,bs.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),ku.free(s),qc.free(r))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Zs.get(Gu);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ng=class extends tu{constructor(){super(...arguments),this.numberType=hl}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Xr(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=Fl(u,p,c),y=Nl(u,g),_=Ll(c),b=Dl(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};ng=ig([Bi()],ng);var sg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rg=class extends hu{constructor(){super(...arguments),this.numberType=sl}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Xr(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Fl(u,d,c),f=Ll(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};rg=sg([Bi()],rg);var ag,og=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hg=function(t,e){return function(i,n){e(i,n,t)}},cg=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(ag||(ag={}));let dg=class extends eg{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=ag.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Zi([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return cg(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:bs.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return cg(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return cg(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>cg(this,void 0,void 0,(function*(){if(2!==t.count)yield Zp(t,bs.zIndex,((i,n)=>{if(this.status===ag.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return cg(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return cg(this,void 0,void 0,(function*(){this.rendering&&(this.status=ag.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=ag.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return cg(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>cg(this,void 0,void 0,(function*(){yield Zp(t,bs.zIndex,(t=>cg(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};dg=og([Bi(),hg(0,Mi(Ku)),hg(1,Ei(ng)),hg(2,Ei(rg)),hg(3,Ei(Yi)),hg(3,Ri(ap)),lg("design:paramtypes",[Array,Object,Object,Object])],dg);var ug=new vi((t=>{t(bd).toSelf().inSingletonScope(),t(Ad).toSelf().inSingletonScope(),t(np).to(eg),t(Gu).to(dg),t(Xu).to(Hu).inSingletonScope(),t(Ku).toService(Xu),Xi(t,Zl),t(Sd).toSelf().inSingletonScope(),Xi(t,ih),Xi(t,Ku),t(dp).toSelf().inSingletonScope(),t(ap).toService(dp),Xi(t,ap)}));function pg(){pg.__loaded||(pg.__loaded=!0,Zs.load(Pl),Zs.load(Ep),Zs.load(_p),Zs.load(Cp),Zs.load(Lp),function(t){t.load(Dp),t.load(Fp),t.load(Kp)}(Zs),function(t){t.load(ug)}(Zs))}pg.__loaded=!1,pg();const gg=Zs.get(Ji);Ls.global=gg;const fg=Zs.get(wl);Ls.graphicUtil=fg;const mg=Zs.get(kl);Ls.transformUtil=mg;const vg=Zs.get(ml);Ls.graphicService=vg;const yg=Zs.get(Tl);Ls.layerService=yg;class _g{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ls.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Ls.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Ls.graphicService.hooks.onAttributeUpdate.taps=Ls.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.onSetStage.taps=Ls.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bg{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xg{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ls.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Ls.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Ls.graphicService.hooks.onAddIncremental.taps=Ls.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.onClearIncremental.taps=Ls.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ls.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class Sg{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.onRemove.unTap(this.key),Ls.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?Ls.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ls.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Le(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const s=Le(n);u(t[n])||(e[s]=i(t[n]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Xr(t).text)}getTransformOfText(t){const e=Xr(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,s=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=s,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[n]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[n]}`}}updateStyleOfWrapContainer(t,e,i,n,s){const{pointerEvents:r}=s;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",n.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=s.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=Re(h,c);o=t.x,l=t.y}const p=Ls.global.getElementTopLeft(n,!1),f=e.window.getTopLeft(!1),m=e.viewBox,v=o+f.left-p.left+m.x1,_=l+f.top-p.top+m.y1;if(a.left=`${v}px`,a.top=`${_}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(s.style)){const e=s.style({top:_,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(s.style)?a=Object.assign(Object.assign({},a),s.style):y(s.style)&&s.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),n=i[1].trim();e&&n&&(t[e]=n)}}})),t}(s.style)));Ls.global.updateDom(i,{width:s.width,height:s.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ls.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:bs.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ls.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:s,container:r}=i;if(!s)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof s?this.htmlMap[a].wrapContainer.innerHTML=s:s!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(s));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,r);t&&("string"==typeof s?t.innerHTML=s:t.appendChild(s),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ls.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const Ag=new Ht;class kg{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Ls.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Ag.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Ag,t.parent&&t.parent.globalTransMatrix)))})),Ls.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),Ls.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Ls.graphicService.hooks.beforeUpdateAABBBounds.taps=Ls.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.afterUpdateAABBBounds.taps=Ls.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.onRemove.taps=Ls.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const wg=new Ht;class Tg{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=mi.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ht}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=Xr(i).group,{display:s=n.display}=i.attribute;if("flex"!==s)return;const{flexDirection:r=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:l=n.clip}=i.attribute,{alignContent:h=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((n=>{const s=this.getAABBBounds(n);s.empty()||("column"===r||"column-reverse"===r?(e+=s.height(),t=Math.max(t,s.width())):(t+=s.width(),e=Math.max(e,s.height())),i+=s.x1,i+=s.y1,i+=s.x2,i+=s.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),n="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:n}),v+=i,y=Math.max(y,n)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>f.len?0===t?(b.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=s,e=r):(t+=s,e=Math.max(e,r))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=r;i--){t-=s[i].mainLen;const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}}layoutCross(t,e,i,n,s,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,Ls.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Ls.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&wg.copy(n)})),Ls.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(wg.equals(i)||this.tryLayout(t,!1))})),Ls.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Ls.graphicService.hooks.onAttributeUpdate.taps=Ls.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.beforeUpdateAABBBounds.taps=Ls.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.afterUpdateAABBBounds.taps=Ls.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ls.graphicService.hooks.onSetStage.taps=Ls.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const Cg=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===da.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=da.INITIAL,Ls.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Ls.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:ca},{mode:"timeout",cons:ha},{mode:"manual",cons:la}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==da.INITIAL&&(this.status=da.PAUSE,!0)}resume(){return this.status!==da.INITIAL&&(this.status=da.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===da.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===da.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=da.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=da.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Cg.addTimeline(ga),Cg.setFPS(60);class Eg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ao.Get(e,ro.Color1),this.ambient=i;const n=Rt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Mt(Et((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=y(e)?ao.Get(e,ro.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}function Mg(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Bg(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}class Rg{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Jc.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Jc.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):n&&n(),i&&Ls.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const s=n.params.ReactDOM,{element:r,container:a}=i;if(!r||!s||!s.createRoot&&!s.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])s.createRoot?this.htmlMap[o].root.render(r):s.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),s.createRoot){const i=s.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else s.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{s.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,l,h,i),this.htmlMap[o].renderId=this.renderId}}const Lg="white";class Dg extends xl{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Lg}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new Yr,this.hooks={beforeRender:new Zi(["stage"]),afterRender:new Zi(["stage"])},this.global=Ls.global,!this.global.env&&Ig()&&this.global.setEnv("browser"),this.window=Zs.get(Or),this.renderService=Zs.get(vp),this.pluginService=Zs.get(Bp),this.layerService=Zs.get(Tl),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Lg,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Cg,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pa,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new oa(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1),this.light=new Eg(f,m,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Rg(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bg))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new _g))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xg))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new kg,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Tg))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new Sg))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new Pg))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=Zs.get(bp));const i=this.pickerService.pick(this.children,new jt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Zs.get(Or),i=t?-t.x1:0,n=t?-t.y1:0,s=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:n,x2:s,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var Fg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ng=new Xt(1,0,0,1,0,0),zg={x:0,y:0};let Vg=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Xt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Xt(1,0,0,1,0,0),this.path=new cs,this._clearMatrix=new Xt(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return qc.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(qc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(qc.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},zg),function(t,e,i){return Er(t,0,!1,e,i)}(this.path.commandList,zg.x,zg.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},zg);const i=fd(this,this.lineWidth,this.dpr);return function(t,e,i,n){return Er(t,e,!0,i,n)}(this.path.commandList,i,zg.x,zg.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(Ng,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>qc.free(t))),this.stack.length=0}};Vg=Fg([Bi(),jg("design:paramtypes",[Object,Number])],Vg);var Hg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ug={WIDTH:500,HEIGHT:500,DPR:1};let Wg=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Ug.WIDTH,height:s=Ug.HEIGHT,dpr:r=Ug.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*r,this._pixelHeight=s*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=s,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};Wg.env="browser",Wg=Hg([Bi(),Gg("design:paramtypes",[Object])],Wg);var Yg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kg=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ht}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};Kg=Yg([Bi()],Kg);var Xg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$g=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zg=class{constructor(){this._uid=mi.GenAutoIncrementId(),this.viewBox=new Ht,this.modelMatrix=new Xt(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,s,r){this.modelMatrix.setValue(t,e,i,n,s,r)}getViewBoxTransform(){return this.modelMatrix}};Zg=Xg([Bi(),$g("design:paramtypes",[])],Zg);var qg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qg=function(t,e){return function(i,n){e(i,n,t)}};let tf=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Ls.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const s=i.bounds.width(),r=i.bounds.height();if(!(new Ht).setValue(0,0,s,r).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Xt(1,0,0,1,0,0);let o;for(let s=t.length-1;s>=0&&(n=t[s].isContainer?this.pickGroup(t[s],e,a,i):this.pickItem(t[s],e,a,i),!n.graphic);s--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){var n;return!!(null===(n=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===n?void 0:n.graphic)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Jc.allocate();if(nd(i,e),a){if(i){const t=Jc.allocate();r.modelMatrix=sd(t,a,i),Jc.free(i)}}else nd(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(r.isContainer){const i=new jt(e.x,e.y),a=Xr(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,s=this.pickGroup(r,i,l,n)}else{const a=new jt(e.x,e.y);l.transformPoint(a,a);const o=Xr(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,n);d&&d.graphic&&(s.graphic=d.graphic,s.params=d.params)}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&Jc.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!u||t.stage.camera||(s.group=t),qc.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};tf=qg([Bi(),Qg(0,Ei(Yi)),Qg(0,Ri(Ap)),Jg("design:paramtypes",[Object])],tf);let ef=!1;const nf=new vi((t=>{ef||(ef=!0,t(Yd).toSelf().inSingletonScope(),t(Uu).to(Yd).inSingletonScope(),t(Ku).toService(Uu),t(Kl).toService(Sd),Xi(t,Kl))}));let sf=!1;const rf=new vi((t=>{sf||(sf=!0,t(_u).toSelf().inSingletonScope(),t(Ju).to(_u).inSingletonScope(),t(Ku).toService(Ju),t(Dd).toSelf(),t(Ld).toSelf(),t(Ql).toService(Dd),t(Ql).toService(Ld),t(Ql).toService(Sd),Xi(t,Ql))}));let af=!1;const of=new vi((t=>{af||(af=!0,t(tu).toSelf().inSingletonScope(),t(ng).toSelf().inSingletonScope(),t($u).to(tu).inSingletonScope(),t(Ku).toService($u))}));let lf=!1;const hf=new vi((t=>{lf||(lf=!0,t(hu).toSelf().inSingletonScope(),t(Wu).to(hu).inSingletonScope(),t(Ku).toService(Wu),t(Xl).toService(Sd),Xi(t,Xl),t(rg).toSelf().inSingletonScope())}));let cf=!1;const df=new vi((t=>{cf||(cf=!0,t(Au).toSelf().inSingletonScope(),t(Qu).to(Au).inSingletonScope(),t(Ku).toService(Qu),t(th).toService(Sd),Xi(t,th))}));let uf=!1;const pf=new vi((t=>{uf||(uf=!0,t(Zd).toSelf().inSingletonScope(),t(Yu).to(Zd).inSingletonScope(),t(Ku).toService(Yu),t($l).toService(Sd),Xi(t,$l))}));let gf=!1;const ff=new vi((t=>{gf||(gf=!0,t(tp).to(Mu).inSingletonScope(),t(Ku).toService(tp),t(eh).toService(Sd),Xi(t,eh))}));let mf=!1;const vf=new vi((t=>{mf||(mf=!0,t(fu).toSelf().inSingletonScope(),t(Zu).to(fu).inSingletonScope(),t(Ku).toService(Zu),t(ql).toService(Sd),Xi(t,ql))}));let yf=!1;const _f=new vi((t=>{yf||(yf=!0,t(qu).to(ju).inSingletonScope(),t(Ku).toService(qu),t(Jl).toService(Sd),Xi(t,Jl))}));var bf=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sf=class extends ud{constructor(){super(),this.numberType=pl,this.builtinContributions=[wu],this.init()}drawShape(t,e,i,n,s){const r=Xr(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Fl(o,l,!0),d=Fl(o,a,!0);c&&(e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,d,c,d,r,s),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,d,c,d,r,s))}drawIcon(t,e,i,n,s){var r;const a=Xr(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(v-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,v,y)):(e.beginPath(),Id(e,i-t,n-s,v,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const n=Xr(t).richtext;this._draw(t,n,!1,i)}};Sf=bf([Bi(),xf("design:paramtypes",[])],Sf);let Af=!1;const kf=new vi((t=>{Af||(Af=!0,t(ep).to(Sf).inSingletonScope(),t(Ku).toService(ep))}));const wf=(t,e)=>(d(Cf.warnHandler)&&Cf.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Tf=(t,e,i)=>{if(!d(Cf.errorHandler))throw new Error(t);Cf.errorHandler.call(null,t,e)},Cf={silent:!1,warnHandler:!1,errorHandler:!1},Ef=Ig(),Mf=Ef&&globalThis?globalThis.document:void 0;function Bf(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ef}function Rf(t){return Of(t)||"mobile-browser"===t}function Of(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let If=0;function Pf(){return If>=9999999&&(If=0),If++}function Lf(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Df(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const Ff=(t,e,i)=>(t.fields=e||[],t.fname=i,t),jf=t=>e=>R(e,t),Nf=t=>{it.getInstance().error(t)},zf=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Nf("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Nf("Access path missing closing bracket: "+t),a&&Nf("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Ff((i&&i.get||jf)(n),[s],e||s)},Vf=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_(t)){const n=t.map((t=>zf(t,e,i)));return t=>n.map((e=>e(t)))}return zf(t,e,i)};Vf("id");const Hf=Ff((function(t){return t}),[],"identity");Ff((function(){return 0}),[],"zero"),Ff((function(){return 1}),[],"one"),Ff((function(){return!0}),[],"true"),Ff((function(){return!1}),[],"false"),Ff((function(){return{}}),[],"emptyObject");const Gf=function(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!f(e)&&!f(i))return e===i;const s=_(e)?e:e[t],r=_(i)?i:i[t];return s===r||!1!==n&&(_(r)?!(!_(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!g(r)&&!(!g(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>Gf(t,r,s)))))},Uf=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Wf=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Yf extends xl{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,Wf.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Wf.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.attribute.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const ym=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},_m=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class bm extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ia.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ia.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||ym(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=_m(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const i=ia.now(),s=this.lastMoveTime;if(i-s<100){const t=s-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=_m(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=ym(i,s),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=ia.now()-i>this.config.press.time&&_m(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Am=[0,0,0];let km=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},gs),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ms),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vs),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Xt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Xt(1,0,0,1,0,0),this._clearMatrix=new Xt(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Xt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return qc.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(qc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(qc.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=kt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Yl.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Bg(Am,[t,e,i],this.modelMatrix),t=Am[0],e=Am[1],i=Am[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Bg(Am,[t,e,i],this.modelMatrix),t=Am[0],e=Am[1],i=Am[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Bg(Am,[e,i,n],this.modelMatrix),e=Am[0],i=Am[1],n=Am[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ls.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ls.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:vs.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:vs.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Bg(Am,[e,i,n],this.modelMatrix),e=Am[0],i=Am[1],n=Am[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=md(this,l,t,i,n)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r*this.dpr,n.shadowColor=a,n.shadowOffsetX=o*this.dpr,n.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),c?(n.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=fd(this,l,this.dpr),r.strokeStyle=md(this,h,t,i,n),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ah(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ah(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>qc.free(t))),this.stack.length=0}};km.env="browser",km=xm([Bi(),Sm("design:paramtypes",[Object,Number])],km);var wm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Cm=class extends Wg{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ls.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new km(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.width=`${n}px`,t.style.height=`${s}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Em(t,e){return new vi((i=>{i(qs).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Js).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Cm.env="browser",Cm=wm([Bi(),Tm("design:paramtypes",[Object])],Cm);const Mm=Em(Cm,km);var Bm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Om=function(t,e){return function(i,n){e(i,n,t)}};let Im=class extends tf{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Mr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lm=class{constructor(){this.type="group",this.numberType=ol}contains(t,e,i){return!1}};Lm=Pm([Bi()],Lm);const Dm=new vi(((t,e,i,n)=>{Dm.__vloaded||(Dm.__vloaded=!0,t(fm).to(Lm).inSingletonScope(),t(mm).toService(fm),Xi(t,mm))}));Dm.__vloaded=!1;var Fm=Dm;const jm=new vi(((t,e,i,n)=>{i(Im)||t(Im).toSelf().inSingletonScope(),i(bp)?n(bp).toService(Im):t(bp).toService(Im)}));var Nm,zm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Hm=Nm=class extends Zg{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Nm.idprefix}_${Nm.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ls.global,this.viewBox=new Ht,this.modelMatrix=new Xt(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Nm.GenerateCanvasId(),canvasControled:!0};this.canvas=new Cm(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new Cm({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Hm.env="browser",Hm.idprefix="visactor_window",Hm.prefix_count=0,Hm=Nm=zm([Bi(),Vm("design:paramtypes",[])],Hm);const Gm=new vi((t=>{t(Hm).toSelf(),t(Ir).toDynamicValue((t=>t.container.get(Hm))).whenTargetNamed(Hm.env)}));var Um=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Ym{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Km(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Xm=class extends Kg{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,n;let s=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0,a=s,o=r}else s=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=s,i=r,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Ym(t)}return new Ht}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:s}=e;return s&&(y(s)?t.setAttribute("style",s):Object.keys(s).forEach((e=>{t.style[e]=s[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return Km(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Km(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:mi.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,n+=s.offsetLeft,s=s.offsetParent;return{top:i,left:n}}};Xm=Um([Bi(),Wm("design:paramtypes",[])],Xm);const $m=new vi((t=>{$m.isBrowserBound||($m.isBrowserBound=!0,t(Xm).toSelf().inSingletonScope(),t(qi).toService(Xm))}));function Zm(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Zm.__loaded||(Zm.__loaded=!0,t.load($m),t.load(Mm),t.load(Gm),e&&function(t){t.load(Fm),t.load(jm)}(t))}$m.isBrowserBound=!1,Zm.__loaded=!1;var qm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qm=function(t,e){return function(i,n){e(i,n,t)}};let tv=class extends tf{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Vg(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const s=this.pickerMap.get(t.numberType);if(!s)return null;const r=s.contains(t,e,n),a=r?t:null;return a?{graphic:a,params:r}:null}};tv=qm([Bi(),Qm(0,Ei(Yi)),Qm(0,Ri(Kf)),Qm(1,Ei(Yi)),Qm(1,Ri(Ap)),Jm("design:paramtypes",[Object,Object])],tv);const ev=new vi((t=>{ev.__vloaded||(ev.__vloaded=!0,Xi(t,Kf))}));ev.__vloaded=!1;var iv=ev,nv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rv=function(t,e){return function(i,n){e(i,n,t)}};let av=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=il}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};av=nv([Bi(),rv(0,Ei(Uu)),sv("design:paramtypes",[Object])],av);let ov=!1;const lv=new vi(((t,e,i,n)=>{ov||(ov=!0,t(Xf).to(av).inSingletonScope(),t(Kf).toService(Xf))}));var hv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dv=function(t,e){return function(i,n){e(i,n,t)}};let uv=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=sl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};uv=hv([Bi(),dv(0,Ei(Wu)),cv("design:paramtypes",[Object])],uv);let pv=!1;const gv=new vi(((t,e,i,n)=>{pv||(pv=!0,t($f).to(uv).inSingletonScope(),t(Kf).toService($f))}));var fv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vv=function(t,e){return function(i,n){e(i,n,t)}};let yv=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=rl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yv=fv([Bi(),vv(0,Ei(Yu)),mv("design:paramtypes",[Object])],yv);let _v=!1;const bv=new vi(((t,e,i,n)=>{_v||(_v=!0,t(Zf).to(yv).inSingletonScope(),t(Kf).toService(Zf))}));var xv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Av=function(t,e){return function(i,n){e(i,n,t)}};let kv=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=al}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,null,i))})),n}return!1}};kv=xv([Bi(),Av(0,Ei(ip)),Sv("design:paramtypes",[Object])],kv);let wv=!1;const Tv=new vi(((t,e,i,n)=>{wv||(wv=!0,t(sm).to(kv).inSingletonScope(),t(kv).toService(sm))}));var Cv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ev=class{constructor(){this.type="image",this.numberType=ll}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Ev=Cv([Bi()],Ev);let Mv=!1;const Bv=new vi(((t,e,i,n)=>{Mv||(Mv=!0,t(qf).to(Ev).inSingletonScope(),t(Ev).toService(qf))}));var Rv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ov=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iv=function(t,e){return function(i,n){e(i,n,t)}};let Pv=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=hl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Pv=Rv([Bi(),Iv(0,Ei($u)),Ov("design:paramtypes",[Object])],Pv);let Lv=!1;const Dv=new vi(((t,e,i,n)=>{Lv||(Lv=!0,t(Jf).to(Pv).inSingletonScope(),t(Kf).toService(Jf))}));var Fv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nv=function(t,e){return function(i,n){e(i,n,t)}};let zv=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=dl}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zv=Fv([Bi(),Nv(0,Ei(qu)),jv("design:paramtypes",[Object])],zv);let Vv=!1;const Hv=new vi(((t,e,i,n)=>{Vv||(Vv=!0,t(nm).to(zv).inSingletonScope(),t(Kf).toService(nm))}));var Gv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wv=function(t,e){return function(i,n){e(i,n,t)}};let Yv=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=cl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Yv=Gv([Bi(),Wv(0,Ei(Zu)),Uv("design:paramtypes",[Object])],Yv);let Kv=!1;const Xv=new vi(((t,e,i,n)=>{Kv||(Kv=!0,t(Qf).to(Yv).inSingletonScope(),t(Kf).toService(Qf))}));var $v=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qv=function(t,e){return function(i,n){e(i,n,t)}};const Jv=new Ht;let Qv=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=ul}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Jv.setValue(i.x1,i.y1,i.x2,i.y2),Jv.expand(-r/2),h=!Jv.containsPoint(e)}}return n.highPerformanceRestore(),h}};Qv=$v([Bi(),qv(0,Ei(Ju)),Zv("design:paramtypes",[Object])],Qv);let ty=!1;const ey=new vi(((t,e,i,n)=>{ty||(ty=!0,t(tm).to(Qv).inSingletonScope(),t(Kf).toService(tm))}));let iy=!1;const ny=new vi(((t,e,i,n)=>{iy||(iy=!0,t(qf).to(Ev).inSingletonScope(),t(Ev).toService(qf))}));var sy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ay=function(t,e){return function(i,n){e(i,n,t)}};let oy=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=gl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};oy=sy([Bi(),ay(0,Ei(Qu)),ry("design:paramtypes",[Object])],oy);let ly=!1;const hy=new vi(((t,e,i,n)=>{ly||(ly=!0,t(em).to(oy).inSingletonScope(),t(Kf).toService(em))}));var cy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dy=class{constructor(){this.type="text",this.numberType=fl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};dy=cy([Bi()],dy);let uy=!1;const py=new vi(((t,e,i,n)=>{uy||(uy=!0,t(im).to(dy).inSingletonScope(),t(Kf).toService(im))})),gy=new vi(((t,e,i,n)=>{i(tv)||t(tv).toSelf().inSingletonScope(),i(bp)?n(bp).toService(tv):t(bp).toService(tv)}));var fy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vy=class extends km{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Xt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};vy.env="node",vy=fy([Bi(),my("design:paramtypes",[Object,Number])],vy);var yy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let by=class extends Wg{constructor(t){super(t)}init(){this._context=new vy(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};by.env="node",by=yy([Bi(),_y("design:paramtypes",[Object])],by);const xy=Em(by,vy);var Sy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ay=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ky=function(t,e){return function(i,n){e(i,n,t)}};let wy=class extends Zg{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:mi.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new by(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new by({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};wy.env="node",wy=Sy([Bi(),ky(0,Ei(Ji)),Ay("design:paramtypes",[Object])],wy);const Ty=new vi((t=>{t(wy).toSelf(),t(Ir).toDynamicValue((t=>t.container.get(wy))).whenTargetNamed(wy.env)}));var Cy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ey=class extends Kg{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Da.call(t)}}getCancelAnimationFrame(){return t=>{Da.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};Ey=Cy([Bi()],Ey);const My=new vi((t=>{My.isNodeBound||(My.isNodeBound=!0,t(Ey).toSelf().inSingletonScope(),t(qi).toService(Ey))}));function By(t){By.__loaded||(By.__loaded=!0,t.load(My),t.load(xy),t.load(Ty))}My.isNodeBound=!1,By.__loaded=!1;var Ry=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oy=class extends km{draw(){}createPattern(t,e){return null}};Oy.env="wx",Oy=Ry([Bi()],Oy);var Iy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Py=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ly=class extends Wg{constructor(t){super(t)}init(){this._context=new Oy(this,this._dpr)}release(){}};Ly.env="wx",Ly=Iy([Bi(),Py("design:paramtypes",[Object])],Ly);const Dy=Em(Ly,Oy);var Fy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ny=function(t,e){return function(i,n){e(i,n,t)}};class zy{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Vy=class extends Zg{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new zy}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:mi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Ly(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Ly({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Vy.env="wx",Vy=Fy([Bi(),Ny(0,Ei(Ji)),jy("design:paramtypes",[Object])],Vy);const Hy=new vi((t=>{t(Vy).toSelf(),t(Ir).toDynamicValue((t=>t.container.get(Vy))).whenTargetNamed(Vy.env)}));var Gy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wy=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let Yy=class extends Kg{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s,r){return Wy(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Da.call(t)}}getCancelAnimationFrame(){return t=>{Da.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Yy=Gy([Bi(),Uy("design:paramtypes",[])],Yy);const Ky=new vi((t=>{Ky._isWxBound||(Ky._isWxBound=!0,t(Yy).toSelf().inSingletonScope(),t(qi).toService(Yy))}));function Xy(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Xy.__loaded||(Xy.__loaded=!0,t.load(Ky),t.load(Dy),t.load(Hy),e&&function(t){t.load(iv),t.load(gy),t.load(lv),t.load(gv),t.load(bv),t.load(Tv),t.load(Bv),t.load(Dv),t.load(Hv),t.load(Xv),t.load(ey),t.load(ny),t.load(hy),t.load(py)}(t))}Ky._isWxBound=!1,Xy.__loaded=!1;var $y=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qy=function(t,e){return function(i,n){e(i,n,t)}};let Jy=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=il}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=fd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Jy=$y([Bi(),qy(0,Ei(Uu)),Zy("design:paramtypes",[Object])],Jy);let Qy=!1;const t_=new vi(((t,e,i,n)=>{Qy||(Qy=!0,t(rm).to(Jy).inSingletonScope(),t(mm).toService(rm))}));var e_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},i_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,n){e(i,n,t)}};const s_=new Ht;let r_=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=ul}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=fd(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;s_.setValue(i.x1,i.y1,i.x2,i.y2),s_.expand(-r/2),h=!s_.containsPoint(e)}}return n.highPerformanceRestore(),h}};r_=e_([Bi(),n_(0,Ei(Ju)),i_("design:paramtypes",[Object])],r_);let a_=!1;const o_=new vi(((t,e,i,n)=>{a_||(a_=!0,t(cm).to(r_).inSingletonScope(),t(mm).toService(cm))}));var l_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let h_=class extends ud{};h_=l_([Bi()],h_);var c_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},d_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u_=function(t,e){return function(i,n){e(i,n,t)}};let p_=class extends h_{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=hl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=Xr(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return n.lineWidth=fd(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Jc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};p_=c_([Bi(),u_(0,Ei($u)),d_("design:paramtypes",[Object])],p_);let g_=!1;const f_=new vi(((t,e,i,n)=>{g_||(g_=!0,t(lm).to(p_).inSingletonScope(),t(mm).toService(lm))}));var m_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},v_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,n){e(i,n,t)}};let __=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=sl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;const{fillPickable:o=s.fillPickable,strokePickable:l=s.strokePickable}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=fd(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h})),n.highPerformanceRestore(),h}};__=m_([Bi(),y_(0,Ei(Wu)),v_("design:paramtypes",[Object])],__);let b_=!1;const x_=new vi(((t,e,i,n)=>{b_||(b_=!0,t(am).to(__).inSingletonScope(),t(mm).toService(am))}));var S_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},k_=function(t,e){return function(i,n){e(i,n,t)}};let w_=class extends h_{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=Xr(t).symbol,a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(n.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return n.lineWidth=fd(n,s+r,n.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Jc.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),u}};w_=S_([Bi(),k_(0,Ei(Qu)),A_("design:paramtypes",[Object])],w_);let T_=!1;const C_=new vi(((t,e,i,n)=>{T_||(T_=!0,t(dm).to(w_).inSingletonScope(),t(mm).toService(dm))}));var E_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},M_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B_=function(t,e){return function(i,n){e(i,n,t)}};let R_=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=rl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=fd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};R_=E_([Bi(),B_(0,Ei(Yu)),M_("design:paramtypes",[Object])],R_);let O_=!1;const I_=new vi(((t,e,i,n)=>{O_||(O_=!0,t(om).to(R_).inSingletonScope(),t(mm).toService(om))}));var P_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},L_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},D_=function(t,e){return function(i,n){e(i,n,t)}};let F_=class extends h_{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=Xr(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=lh(a,u,s),v=oh(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&Jc.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};F_=P_([Bi(),D_(0,Ei(tp)),L_("design:paramtypes",[Object])],F_);let j_=!1;const N_=new vi(((t,e,i,n)=>{j_||(j_=!0,t(um).to(F_).inSingletonScope(),t(mm).toService(um))}));var z_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},H_=function(t,e){return function(i,n){e(i,n,t)}};let G_=class extends h_{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=cl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return n.lineWidth=fd(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Jc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};G_=z_([Bi(),H_(0,Ei(Zu)),V_("design:paramtypes",[Object])],G_);let U_=!1;const W_=new vi(((t,e,i,n)=>{U_||(U_=!0,t(hm).to(G_).inSingletonScope(),t(mm).toService(hm))}));var Y_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},K_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},X_=function(t,e){return function(i,n){e(i,n,t)}};let $_=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=dl}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=Xr(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=fd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};$_=Y_([Bi(),X_(0,Ei(qu)),K_("design:paramtypes",[Object])],$_);let Z_=!1;const q_=new vi(((t,e,i,n)=>{Z_||(Z_=!0,t(pm).to($_).inSingletonScope(),t(mm).toService(pm))}));var J_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tb=function(t,e){return function(i,n){e(i,n,t)}};let eb=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eb=J_([Bi(),tb(0,Ei(ep)),Q_("design:paramtypes",[Object])],eb);let ib=!1;const nb=new vi(((t,e,i,n)=>{ib||(ib=!0,t(gm).to(eb).inSingletonScope(),t(mm).toService(gm))})),sb=Ig();function rb(){rb.__loaded||(rb.__loaded=!0,od.RegisterGraphicCreator("arc",Hc),Zs.load(nf),Zs.load(sb?t_:lv))}rb.__loaded=!1;const ab=rb;function ob(){ob.__loaded||(ob.__loaded=!0,od.RegisterGraphicCreator("area",Nc),Zs.load(hf),Zs.load(sb?x_:gv))}ob.__loaded=!1;const lb=ob;function hb(){hb.__loaded||(hb.__loaded=!0,od.RegisterGraphicCreator("circle",rh),Zs.load(pf),Zs.load(sb?I_:bv))}hb.__loaded=!1;const cb=hb;function db(){db.__loaded||(db.__loaded=!0,od.RegisterGraphicCreator("group",Sl))}db.__loaded=!1;const ub=db;function pb(){pb.__loaded||(pb.__loaded=!0,od.RegisterGraphicCreator("line",bc),Zs.load(of),Zs.load(sb?f_:Dv))}pb.__loaded=!1;const gb=pb;function fb(){fb.__loaded||(fb.__loaded=!0,od.RegisterGraphicCreator("path",Dc),Zs.load(vf),Zs.load(sb?W_:Xv))}fb.__loaded=!1;const mb=fb;function vb(){vb.__loaded||(vb.__loaded=!0,od.RegisterGraphicCreator("polygon",Wc),Zs.load(_f),Zs.load(sb?q_:Hv))}vb.__loaded=!1;const yb=vb;function _b(){_b.__loaded||(_b.__loaded=!0,od.RegisterGraphicCreator("rect",Ac),Zs.load(rf),Zs.load(sb?o_:ey))}_b.__loaded=!1;const bb=_b;function xb(){xb.__loaded||(xb.__loaded=!0,od.RegisterGraphicCreator("richtext",Ic),Zs.load(kf),Zs.load(sb?nb:ny))}xb.__loaded=!1;const Sb=xb;function Ab(){Ab.__loaded||(Ab.__loaded=!0,od.RegisterGraphicCreator("shadowRoot",Kc))}Ab.__loaded=!1;const kb=Ab;function wb(){wb.__loaded||(wb.__loaded=!0,od.RegisterGraphicCreator("symbol",vc),Zs.load(df),Zs.load(sb?C_:hy))}wb.__loaded=!1;const Tb=wb;function Cb(){Cb.__loaded||(Cb.__loaded=!0,od.RegisterGraphicCreator("text",uh),Zs.load(ff),Zs.load(sb?N_:py))}Cb.__loaded=!1;const Eb=Cb;function Mb(){ub(),bb()}const Bb=-.5*Math.PI,Rb=1.5*Math.PI,Ob="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var Ib;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Ib||(Ib={}));const Pb={[Ib.selectedReverse]:{},[Ib.selected]:{},[Ib.hover]:{},[Ib.hoverReverse]:{}},Lb={container:"",width:30,height:30,style:{}},Db={debounce:gt,throttle:ft};Mb();class Fb extends Yf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Fb.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===n){const t=i-this._viewPosition.y,e=ct(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ct(t-o/2,l,h);c=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===gg.env?(gg.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),gg.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=n,a=r-this._prePos,s=a/l):(r=i,a=r-this._prePos,s=a/o),[r,s]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:Db[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:n=[0,1]}=this.attribute,s=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[s[0]+a,s[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:dt(o,n[0],n[1])}),"browser"===gg.env?(gg.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),gg.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=dt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",Db[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Oe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Oe(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,e-(n+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function jb(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&jb(t,e)}))}Fb.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const Nb=t=>!u(t)&&!1!==t.visible;const zb=["#ffffff","#000000"];function Vb(t,e,i,n,s,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new re(t).toHex(),o=new re(e).toHex();return Hb(a,o,i,n,r)?a:function(t,e,i,n,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...zb);for(const s of a)if(t!==s&&Hb(s,e,i,n,r))return s}(a,o,i,n,s,r)}function Hb(t,e,i,n,s){if("lightness"===s){const i=re.getColorBrightness(new re(e));return re.getColorBrightness(new re(t))<.5?i>=.5:i<.5}return n?Gb(t,e)>n:"largeText"===i?Gb(t,e)>3:Gb(t,e)>4.5}function Gb(t,e){const i=Ub(t),n=Ub(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function Ub(t){const e=oe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function Wb(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function Yb(t,e){return[t[0]*e,t[1]*e]}function Kb(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const Xb=(t,e,i,n)=>new Be(Object.assign({defaultFontParams:Object.assign({fontFamily:Ob,fontSize:14},n),getTextBounds:i?void 0:cd,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function $b(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const n=cd({text:t,fontFamily:e.fontFamily||i.fontFamily||Ob,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:n.width(),height:n.height()}}function Zb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,n;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(n=t[e])&&void 0!==n?n:"text"}function qb(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function Jb(t){const e=Zb(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?od.richtext(qb(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.html=n,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.react=n,t.text=i,t.renderable=!1,t}(t)),od.text(t))}function Qb(t,e,i,n,s){"right"===t?"center"===i?e.setAttribute("x",n-s/2):"right"===i||"end"===i?e.setAttribute("x",n):e.setAttribute("x",n-s):"center"===i?e.setAttribute("x",n+s/2):"right"===i||"end"===i?e.setAttribute("x",n+s):e.setAttribute("x",n)}function tx(){ub(),bb(),Tb(),Sb(),Eb()}var ex=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1&&void 0!==arguments[1]?arguments[1]:"type")}({text:n})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qb(Object.assign({type:v,text:n},s))),s),{visible:p(n)&&!1!==f,x:T,y:0});R=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=ex(a,["visible"]);if(f&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!n,x:R.AABBBounds.x1,y:R.AABBBounds.y1,width:R.AABBBounds.width(),height:R.AABBBounds.height()}),"rect");if(B(null==m?void 0:m.panel)||(t.states=m.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(R.attribute,t,new cs)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(n)&&"type"in n&&"text"===n.type?n.text:n,visible:p(n)&&!1!==f,lineHeight:null==s?void 0:s.fontSize},s),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=s.fontSize),R=x.createOrUpdateChild("tag-text",o,"text"),B(null==m?void 0:m.text)||(R.states=m.text);const d=$b(o.text,s,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,E=d.height;k+=v;const M=null!==(i=r.size)&&void 0!==i?i:10,O=S(M)?M:Math.max(M[0],M[1]);w+=Math.max(E,r.visible?O:0);const{textAlign:I,textBaseline:P}=s;(p(l)||p(h))&&(p(l)&&kh&&(k=h,R.setAttribute("maxLineWidth",h-b[1]-b[2])));let L=0,D=0,F=0;"left"===I||"start"===I?F=1:"right"===I||"end"===I?F=-1:"center"===I&&(F=0),F?F<0?(L-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-C)):F>0&&x.setAttribute("x",b[3]):(L-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-C/2));const j="right"===_||"end"===_,N="left"===_||"start"===_;if((_?"center"===_:y)&&F){const t=k-b[1]-b[3],e=v+C,i=1===F?(t-e)/2+C+v/2:b[0]+C-(k/2+e/2-C)+v/2;if(R.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-C+O/2;A.setAttributes({x:t})}}if(N&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+C/2:-k+b[3]+b[1]+C,i=e+C;if(R.setAttributes({x:i,textAlign:"left"}),A){const t=e+O/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+C/2:t;if(R.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-C+O/2;A.setAttributes({x:t})}}"middle"===P?(D-=w/2,A&&A.setAttribute("y",0)):"bottom"===P?(D-=w,A&&A.setAttribute("y",-E/2),x.setAttribute("y",-b[2])):"top"===P&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",E/2));const{visible:z}=a,V=ex(a,["visible"]);if(f&&c(z)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:z&&!!n,x:L,y:D,width:k,height:w}),"rect");if(B(null==m?void 0:m.panel)||(t.states=m.panel),V.customShape){const e=V.customShape;t.pathProxy=t=>e(R.attribute,t,new cs)}this._bgRect=t}}this._textShape=R}}ix.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const nx={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},sx={poptip:j({},nx)};class rx extends Yf{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}ub(),gb();class ax extends rx{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ax.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}ax.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ub(),bb();class ox extends rx{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ox.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}ox.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const lx=new Uint32Array(33),hx=new Uint32Array(33);hx[0]=0,lx[0]=~hx[0];for(let t=1;t<=32;++t)hx[t]=hx[t-1]<<1|1,lx[t]=~hx[t];function cx(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:n=0,left:s=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+s+r+o)/o),h=~~((e+n+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&lx[31&l]&hx[1+(31&h)])return!0}else{if(i[c]&lx[31&l])return!0;if(i[d]&hx[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,lx[31&s]&hx[1+(31&r)]);else for(n(a,lx[31&s]),n(o,hx[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,hx[31&i]|lx[1+(31&n)]);else for(s(r,hx[31&i]),s(a,lx[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(l,h),c.x=t=>~~((t+s)/o),c.y=t=>~~((t+n)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function dx(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function ux(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=dx(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function px(t,e,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return px(t,e,s,o,h,c)}return!1}var u;if("moveY"===i.type){const n=(i.offset?d(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return px(t,e,s,n,h,c)}if("moveX"===i.type){const n=(i.offset?d(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return px(t,e,s,n,h,c)}return!1}const fx=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],mx=["top","inside-top","inside"];function vx(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const yx={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function _x(t,e){var i,n;return null!==(n=null===(i=yx[e])||void 0===i?void 0:i.call(yx,t))&&void 0!==n?n:{from:{},to:{}}}const bx=(t,e,i,n)=>{const s=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return W(null==n?void 0:n.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:s,to:r}};function xx(t,e,i,n){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new ja({text:t.attribute.text},{text:e.attribute.text},i,n))}const Sx={mode:"same-time",duration:300,easing:"linear"};function Ax(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function kx(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function Tx(t){return 3===t||4===t}function Cx(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}const Ex=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}},Mx=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Bx(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=t,a=Math.abs(r-s),o=e.x1;let l=o;return"end"===i?l=o+a/2+n:"start"===i&&(l=o-a/2-n),{x:l,y:e.y1}}function Rx(t,e,i,n,s,r){return Math.abs(e/t)0?s:-s),y:n+e*s/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:n+(e>0?r:-r)}}ub(),Eb(),Sb(),gb();class Ox extends Yf{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ox.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(Ib.hover,!0),jb(this,(t=>{t===e||B(t.states)||t.addState(Ib.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(jb(this,(t=>{B(t.states)||(t.removeState(Ib.hoverReverse),t.removeState(Ib.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void jb(this,(t=>{B(t.states)||(t.removeState(Ib.selectedReverse),t.removeState(Ib.selected))}));B(e.states)||(e.addState(Ib.selected,!0),jb(this,(t=>{t===e||B(t.states)||t.addState(Ib.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,n,s,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===yn.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===yn.ANIMATE_UPDATE&&(null===(n=t.detail.animationState)||void 0===n?void 0:n.isFirstFrameOfStep)){const e=null!==(r=null===(s=t.target)||void 0===s?void 0:s.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,n){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(be(t,e,!0))return;const i=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-n)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=n+o,u=s+l,p=r+h,g=u-c,f=p-d;return[Rx(g,f,c,d,a,o),Rx(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const n=od.line({points:i});if(null==n?void 0:n.customShape){const e=n.customShape;n.pathProxy=i=>e(t.attribute,i,new cs)}return e&&e.attribute.fill&&n.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(n)?n(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(s)?a=s(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return Jb(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,n,s;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let n=0;n!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),s),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let n=0;n"bound"===t.type));h&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&v.setRange(dx(m,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(dx(m,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(dx(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:n}=e;return{x1:i,x2:i,y1:n,y2:n}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==s?void 0:s.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),n.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:n}=_x(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(s=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,n,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=s.get(d);s.delete(d),n.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!_(i)){const{duration:n,easing:s,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,n,s),void(r&&xx(t,e,n,s))}i.forEach(((i,n)=>{const{duration:s,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=bx(t,e,o,i.options);B(h)||t.animate().to(h,s,r),"text"in l&&"text"in h&&a&&xx(t,e,s,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(_x(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=n}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==s?void 0:s.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)n.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=s.get(l);s.delete(l),n.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=n}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,f;const{detail:m}=o;if(!m)return{};const v=null===(p=m.animationState)||void 0===p?void 0:p.step;if(m.type!==yn.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(m.type===yn.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const y=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":m.animationState.end&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":s===e.length-1&&m.animationState.end&&(e.forEach((t=>{t.animate({onStart:y}).wait(d).to(a,h,c)})),n.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vn.LOCAL,null===(f=this.stage)||void 0===f?void 0:f.pickerService)||(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,n,s,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(n=a.brightColor)&&void 0!==n?n:"#ffffff",f=null!==(s=a.darkColor)&&void 0!==s?s:"#000000",m=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Ix.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class Px extends Ox{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Px.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),{x:c,y:d}=Re(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*n+u*l/2,y:d+p*n+p*h/2}}}Px.tag="rect-label",Px.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let Lx=class t extends Ox{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const n=t.attribute.points||[e],s="start"===i?0:n.length-1;return n[s]?{x1:n[s].x,x2:n[s].x,y1:n[s].y,y2:n[s].y}:void 0}labeling(t,e){return Bx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};Lx.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Dx{constructor(t,e,i,n,s,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class Fx extends Ox{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Fx.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let s=1/0;if(!1!==n.ellipsis){const t=this._createLabelText(n),e=this.getGraphicBounds(t);s=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,s);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(n){const i={visible:n.labelVisible,x:n.labelPosition.x,y:n.labelPosition.y,angle:n.angle,maxLineWidth:n.labelLimit,points:n.pointA&&n.pointB&&n.pointC?[n.pointA,n.pointB,n.pointC]:void 0,line:n.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,n,s,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),n.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(n[i])&&!u(s[i])){const t=n[i]?n[i]:null,r=s[i]?s[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=kx(l.endAngle-d/2),p=Ax(h.x,h.y,l.outerRadius,o),g=Ax(h.x,h.y,a+e.line.line1MinLength,o),f=new Dx(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=Ax(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),f.middleAngle),f.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=f.quadrant)||2===c?this._arcRight.set(f.refDatum,f):Tx(f.quadrant)&&this._arcLeft.set(f.refDatum,f)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var n,s;const r=e,a=r.spaceWidth,o=null!==(n=r.position)&&void 0!==n?n:"inside",l=null!==(s=r.offsetRadius)&&void 0!==s?s:-a;return t.forEach((t=>{var i,n,s;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:u+l-y,t.labelPosition=Ax(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=f,ot(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle;let a=null!==(s=r.offsetAngle)&&void 0!==s?s:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var n,s,r;const a=null!==(n=i[0].attribute.x)&&void 0!==n?n:0,o=2*(null!==(s=i[0].attribute.y)&&void 0!==s?s:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=Tx(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=Tx(n.quadrant)?{x:t.x+s.width/2+l+c,y:t.y}:{x:t.x-s.width/2-l-c,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const n=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-s),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const n of t)this._computePointB(n,h,e,i),this._computeX(n,e,i)}const d=2*a;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,l+c)||ot(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var n;const s=t.circleCenter,r=2*s.x;s.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(n=e.layout)||void 0===n?void 0:n.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;A(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const f=this.computeRadius(o,e.width,e.height),m=Tx(p)?-1:1;let v=0,y=(m>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(f+l+h)*m+s.x,y=(m>0?r-v:v)-d);const _=this._getFormatLabelText(t.refDatum,y);t.labelText=_;let b=Math.min(y,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=m>0?r-b-d:b+d;break;default:v=g.x+m*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-m*x}else{const t=0;u.x=v+t+m*(d+x)}}_computeAlign(t,e){var i,n,s,r,a,o;const l=e,h=null!==(n=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=l.textStyle)||void 0===s?void 0:s.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?Tx(t.quadrant)?"left":"right":Tx(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,n){var s;n[0].attribute.x;const r=2*(null!==(s=n[0].attribute.y)&&void 0!==s?s:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){const s=i;let r=0;n.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=s.line.line1MinLength;if("none"===s.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,s=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(s+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;A(c)?t.pointB={x:n.x+c*(Tx(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,s={width:2*n.x,height:2*n.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=s,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,u))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?at(v[0].y,v[1].y)?ot(t.middleAngle,-Math.PI)&<(t.middleAngle,0)||ot(t.middleAngle,Math.PI)&<(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-s;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;ee(t.attribute,i,new cs)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,n){return this.computeLayoutRadius(e||0,i||0)*t*(u(n)?1:n)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const n=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*n}}Fx.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class jx extends Ox{constructor(t){super(j({},jx.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var n;if("area"!==t.type)return super.getGraphicBounds(t,e);const s=(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)||[e],r="start"===i?0:s.length-1;return{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}}labeling(t,e){return Bx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}jx.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Nx extends Ox{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Nx.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return Ex(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Nx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const zx={rect:Px,symbol:Ix,arc:Fx,line:Lx,area:jx,"line-data":Nx};class Vx extends Yf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Vx.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:n=0,height:s=0,padding:r}=i||{};if(!n||!s||!A(s*n))return;this._componentMap||(this._componentMap=new Map);const a=cx(n,s,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}Vx.defaultAttributes={pickable:!1},ub(),gb(),yb(),Tb();class Hx extends Yf{getStartAngle(){return Kt(this._startAngle)}getEndAngle(){return Kt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Hx.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:s=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!s)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var s,r;const a=od.line(Object.assign(Object.assign({points:t},_(i)?null!==(s=i[e])&&void 0!==s?s:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==n?void 0:n.line)||(a.states=_(n.line)?null!==(r=n.line[e])&&void 0!==r?r:n.line[n.line.length-1]:n.line),this.add(a),this.lines.push(a)}))}else{let t=od.line;W(i)[0].cornerRadius&&(t=od.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},W(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==n?void 0:n.line)||(e.states=[].concat(n.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:n=!0}=t;let s;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),s=od.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:n?v+u:0,strokeBoundsBuffer:0}),p)),s.name=`${this.name}-${i}-symbol`,s.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(s.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(s.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(s.states=o.endSymbol),this.add(s)}return s}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const i=e.clip?e.size||10:0;n=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,s={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};n=[...n.slice(0,n.length-1),s]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],s=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[s.x-n.x,s.y-n.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}var Gx,Ux;Hx.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(Gx||(Gx={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Ux||(Ux={}));const Wx={[Ux.selectedReverse]:{},[Ux.selected]:{},[Ux.hover]:{},[Ux.hoverReverse]:{}},Yx={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},Kx=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=At;else if(t>0)for(;t>At;)t-=At;return t};function Xx(t,e,i){return!lt(t,e,0,1e-6)&&!ot(t,i,0,1e-6)}function $x(t,e,i,n){const s=cd(Object.assign({text:i},n)),r=s.width(),a=s.height(),o=Kx(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=Xx(o,-l,-h)?((o+l)/c-.5)*r:Xx(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let f=0;return f=Xx(o,-l,-h)?.5*-a:Xx(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-Kx(o-l)/c)*a,{x:p,y:g-f}}function Zx(t){const e={};return jb(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function qx(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Jx(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return Yb(r,(n?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}class Qx extends Yf{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=((t,e,i)=>{const n=t.target;return n!==i&&n.name&&!B(n.states)?(n.addState(Ib.hover,!0),jb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Ib.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(jb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Ib.hoverReverse),t.removeState(Ib.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const n=t.target;return i===n&&n.hasState(Ib.selected)?(jb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Ib.selectedReverse),t.removeState(Ib.selected))})),null):n.name&&!B(n.states)?(n.addState(Ib.selected,!0),jb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Ib.selectedReverse,!0)})),n):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=P(this.attribute);j(this.attribute,t);const i=od.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Zx(this._innerView),this.removeAllChild(!0),this._innerView=od.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,items:r}=this.attribute,a=od.group({x:0,y:0,zIndex:1});if(a.name=Gx.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),s&&s.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),n&&n.visible&&this.renderTicks(a),i&&i.visible)){const t=od.group({x:0,y:0,pickable:!1});t.name=Gx.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,r.length),this.handleLabelsOverlap(s,e,n,i,r.length),this.afterLabelsOverlap(s,e,n,i,r.length);let a=0,o=0,l="center",h="middle";s.forEach((t=>{var e;const i=t.attribute,n=null!==(e=i.angle)&&void 0!==e?e:0,s=t.AABBBounds;let r=s.width(),c=s.height();n&&(r=Math.abs(r*Math.cos(n)),c=Math.abs(c*Math.sin(n))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=od.group({x:0,y:0,pickable:!1});i.name=Gx.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=od.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=Gx.tick,r.id=this._getNodeId(t.id),B(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=Pb;else{const t=this.data[n],e=j({},Pb,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(n&&n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=od.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=Gx.subTick,r.id=this._getNodeId(`${s}`),B(n.state))r.states=Pb;else{const i=j({},Pb,n.state);Object.keys(i).forEach((n=>{d(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&d(n)&&(e=n(e,i));const s=this._transformItems(e),r=od.group({x:0,y:0,pickable:!1});return r.name=`${Gx.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=Jb(this._getLabelAttribute(t,e,s,i));if(a.name=Gx.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(n=this.attribute.label)||void 0===n?void 0:n.state))a.states=Pb;else{const n=j({},Pb,this.attribute.label.state);Object.keys(n).forEach((r=>{d(n[r])&&(n[r]=n[r](t,e,s,i))})),a.states=n}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new ix(Object.assign({},e));i.name=Gx.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return qx(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return at(t[0],0)?at(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;wt(n[0])>wt(n[1])?o=xt/2*(l.x>e.x?1:-1):h=xt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[n-1].height+R(this.attribute,"label.space",4))*n:u+=(this.axisLabelLayerSize[n-1].width+R(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,n):t.label;let{style:y}=this.attribute.label;y=d(y)?j({},Yx.label.style,y(t,e,i,n)):y;return y=j(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y)}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function tS(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}function eS(t,e){return be(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=ke(t,i),r=ke(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Ae(t),l=Ae(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Gt(t.angle);let f=i?t.angle+St:Gt(90-t.angle);const m=i?e.angle:Gt(e.angle);let v=i?e.angle+St:Gt(90-e.angle);f>kt&&(f-=kt),v>kt&&(v-=kt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(xe(s,i)+xe(s,n))/2>xe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,m,c,d)&&y((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const iS={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&nS(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function nS(t,e,i){const n=t.AABBBounds,s=e.AABBBounds;return i>Math.max(s.x1-n.x2,n.x1-s.x2,s.y1-n.y2,n.y1-s.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function sS(t,e){for(let i,n=1,s=t.length,r=t[0];n1&&e.height()>1}function aS(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},hS(t,e.attribute.angle)),{angle:lS(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},cS(t,e.attribute.angle)),{angle:lS(e.attribute.angle)}))}))}(t,e),tS(e)}function lS(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function hS(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=lS(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function cS(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=lS(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}class dS{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return Yb([n[1],-1*n[0]],t*(e?1:-1)*i)}}function uS(){ub(),gb(),Sb(),Eb()}var pS=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=y[1]>0;_=1===m?r?n?_:s?_/2:t:n?t:s?_/2:_:r?n?t:s?_/2:_:n?_:s?_/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===s?"start":"end"===s?"end":"center",u(C)&&o){C=Kb(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(k),T=this.getTextBaseline(k,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,n=Math.min(t||1/0,e||1/0);if(A(n))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=n-x;else if(C&&0!==C){const t=Math.abs(Math.sin(C));E=t<1e-6?1/0:this.attribute.end.y/t}else E=n-x}const M=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:E,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:j({},Wx,c.text),shape:j({},Wx,c.shape),panel:j({},Wx,c.background)}});return M.angle=C,l&&l.visible&&(M.shape=Object.assign({visible:!0},l.style),l.space&&(M.space=l.space)),h&&h.visible&&(M.panel=Object.assign({visible:!0},h.style)),M}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,s=(e?1:-1)*n;return at(t[1],0)?i=!at(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===s?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(["top","bottom","right","left"].includes(n)||0===t[0]&&0===t[1]){if("top"===n||"bottom"===n)return hS(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return cS(e?"left"===n?"right":"left":n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,h=t[0],c=Y(t),d=s?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,s=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=n.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-s}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,s){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,s),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:f,autoHide:m,autoHideMethod:v,autoHideSeparation:y,lastVisible:_}=a;if(d(h))h(t,e,n,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),oS(i,t),!aS(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:n,ellipsis:s="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,f="top"===r||"bottom"===r;if(f){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=n)return}const m=t.attribute.direction;if(!f){if("vertical"===m&&Math.floor(t.AABBBounds.height())<=n)return;if("vertical"!==m){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=n)return}}let v=null;if(p||g)v=f?p?n:i:"vertical"===m||g?n:i;else if(f){const{x1:e,x2:n}=t.AABBBounds,s=d/c;v=s>0&&e<=a&&i/s+e>a?(a-e)/Math.abs(c):s<0&&n>=0&&i/s+n<0?n/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);A(t.attribute.maxLineWidth)&&(v=A(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:s})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:f,orient:o,axisLength:i})}m&&function(t,e){if(B(t))return;const i=t.filter(rS);if(B(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),tS(n);const{method:s="parity",separation:r=0}=e,a=d(s)?s:iS[s]||iS.parity;if(n.length>=3&&sS(n,r)){do{n=a(n,r)}while(n.length>=3&&sS(n,r));if(n.length<3||e.lastVisible){const t=Y(i);if(!t.attribute.opacity){const e=n.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&nS(n[i],t,r);i--)n[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:y,lastVisible:_})}}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,s);let e,n;h=Math.max(h,t),"left"===a?(e=l.x2-h,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-h):"bottom"===a&&(e=l.x1,n=l.y1);const r=od.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=Gx.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(n=h.style.lineWidth)&&void 0!==n?n:1:0,m=c&&c.visible?null!==(s=c.length)&&void 0!==s?s:4:0;if(l&&l.visible&&"string"==typeof l.text){p=$b(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Oe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}}gS.defaultAttributes=Yx,U(gS,dS);class fS{isInValidValue(t){const{startAngle:e=Bb,endAngle:i=Rb}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=Bb,endAngle:i=Rb,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Wt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Jx(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var mS,vS=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=od.circle(c);d.name=Gx.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=j({},Wx,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:n,radius:s,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=vS(a,["space","textStyle","shape","background","state"]);let g=n,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=s+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:n.x,y:n.y-v}):"end"===_&&(y="top",g={x:n.x,y:n.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:j({},Wx,d.text),shape:j({},Wx,d.shape),panel:j({},Wx,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,n){return $x(t,e,i,n)}}yS.defaultAttributes=Yx,U(yS,fS);class _S extends fa{constructor(){super(...arguments),this.mode=bn.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},jb(t,(t=>{var i,n,s,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!H(t.attribute,l.attribute)){const e=P(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:1,strokeOpacity:null!==(s=e.strokeOpacity)&&void 0!==s?s:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n;const{node:s,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(n=this.params)&&void 0!==n?n:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===s.type?s.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=yt.lastIndex=_t.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=yt.exec(t))&&(n=_t.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=_t.lastIndex;return r{xS[t]=!0}));const TS=t=>-Math.log(-t),CS=t=>-Math.exp(-t),ES=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,MS=t=>10===t?ES:t===Math.E?Math.exp:e=>Math.pow(t,e),BS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),RS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),OS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function IS(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function PS(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function LS(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function DS(t,e,i,n){return 1===i&&(i=0),LS(t,i,n)*(e/(1-i))}function FS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function jS(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};class VS{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FS(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,s=this.range(),r=s[0],a=s[s.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(n)?(l-o)*i:n;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const HS=Symbol("implicit");class GS extends VS{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=mS.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=HS}clone(){const t=(new GS).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==HS)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const s=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(s):s}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class WS extends GS{constructor(t){super(),this.type=mS.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,s=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DS(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,n=e+i;this._wholeRange=[e,n]}else{const e=t[1]+i*(1-this._rangeFactorEnd),n=e-i;this._wholeRange=[n,e]}const s=this._rangeFactorStart+n<=1,r=this._rangeFactorEnd-n>=0;"rangeFactorStart"===e&&s?this._rangeFactorEnd=this._rangeFactorStart+n:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?s?this._rangeFactorEnd=this._rangeFactorStart+n:r?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):r?this._rangeFactorStart=this._rangeFactorEnd-n:s?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:US(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return US(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new WS(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YS}=le;function KS(t,e){const i=typeof e;let n;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=re.parseColorString(e)){const e=YS(re.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof ae?YS(t,e):e instanceof re?YS(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class XS extends VS{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wS,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wS;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=wS,this._piecewise=PS,this._interpolate=KS}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,J);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=vt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return this._autoClamp&&(this._clamp=ut(i[0],i[r-1])),this._piecewise=r>2?jS:PS,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:wS),this.rescale(i)):this._clamp!==wS}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const $S=Math.sqrt(50),ZS=Math.sqrt(10),qS=Math.sqrt(2),JS=[1,2,5,10],QS=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=nA(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ns+t*n))):t>0?eA(0,-(e-1)/n,n):eA((e-1)/n,0,n)},tA=ht(((t,e,i,n)=>{let s,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return QS(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QS(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=eA(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=eA(t,e,l);return s&&r.reverse(),r})),nA=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=JS[0];return i>=$S?n=JS[3]:i>=ZS?n=JS[2]:i>=qS&&(n=JS[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function sA(t,e,i){const n=(e-t)/Math.max(0,i);return nA(n)}function rA(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=sA(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function oA(t,e){const i=S(e.forceMin),n=S(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const lA=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hA=ht(((t,e,i,n,s,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=n-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cA=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=iA(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?lA(t,e,s):lA(t,e,zS(s)),h=lA(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),dA=ht(((t,e,i,n,s)=>rA(n(t),n(e),i).map((t=>zS(s(t))))));class uA extends XS{constructor(){super(...arguments),this.type=mS.Linear}clone(){return(new uA).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tA(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=iA(s[0],s[s.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rA(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,s,r=-1;if(i=+i,(s=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=oA(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aA(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aA(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aA(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function pA(t){return e=>-t(-e)}function gA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fA extends XS{constructor(){super(BS(10),MS(10)),this.type=mS.Log,this._limit=gA(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fA).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=BS(this._base),n=MS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=pA(i),this._pows=pA(n),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=TS,this.untransformer=CS):(this._logs=i,this._pows=n,this._limit=gA(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return wS}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),n=this._limit(i[0]),s=this._limit(i[i.length-1]);return hA(n,s,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cA(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dA(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=oA(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=NS(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class mA extends uA{constructor(){super(RS(1),OS(1)),this.type=mS.Symlog,this._const=1}clone(){return(new mA).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=RS(t),this.untransformer=OS(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),n=i[0],s=i[i.length-1];return hA(n,s,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cA(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=oA(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=NS(n.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class vA{constructor(){this.type=mS.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[nt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new vA).domain(this._domain).range(this._range).unknown(this._unknown)}}const yA=t=>t.map(((t,e)=>({index:e,value:t}))),_A=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=new Ht(t).expand(i/2),s=new Ht(e).expand(i/2);return n.intersects(s)};function bA(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function xA(t,e){for(let i,n=1,s=t.length,r=t[0];nit?Math.min(t-e/2,i-e):i{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(n=s.angle)&&void 0!==n?n:0;"vertical"===s.direction&&(h+=Gt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=Xb(s),f=t.range(),m=e.map(((i,n)=>{var r,l;const m=o?o(i):`${i}`,{width:v,height:y}=g.quickMeasure(m),_=Math.max(v,12),b=Math.max(y,12),x=t.scale(i),S=u*x,A=p*x;let k,w,T=S,C=A;a&&c&&0===n?T=SA(S,_,f[0],f[f.length-1]):a&&c&&n===e.length-1?T=SA(S,_,f[f.length-1],f[0]):k=null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===k?T-=_:"center"===k&&(T-=_/2),a&&d&&0===n?C=SA(A,b,f[0],f[f.length-1]):a&&d&&n===e.length-1?C=SA(A,b,f[f.length-1],f[0]):w=null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===w?C-=b:"middle"===w&&(C-=b/2);const E=(new Ht).set(T,C,T+_,C+b);return h&&E.rotate(h,S,A),E}));return m},kA=(t,e,i)=>{var n;const{labelStyle:s,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(n=s.angle)&&void 0!==n?n:0,d=Xb(s),u=e.map((e=>{var i,n;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),f=Math.max(p,12),m=t.scale(e);let v=0,y=0;const _=null!==(i=s.textAlign)&&void 0!==i?i:"center",b=null!==(n=s.textBaseline)&&void 0!==n?n:"middle",{x:x,y:S}=function(t,e,i,n,s,r,a){const o=Wt({x:0,y:0},i,t),l=qx(o,Jx(n,o,e,s));return $x(l,Jx(n||1,l,e,s),r,a)}(m,{x:0,y:0},h,a,l,r,s);return v=x+("right"===_?-g:"center"===_?-g/2:0),y=S+("bottom"===b?-f:"middle"===b?-f/2:0),(new Ht).set(v,y,v+g,y+f).rotate(c,v+g/2,y+f/2)}));return u},wA={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&bA(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},TA=(t,e,i,n)=>AA(t,e,i).map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),CA=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},EA=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=n=>{let s=!0,r=0;do{r+n{let n=t,s=e;for(;n=0?s=t:n=t+1}return n})(s,t.length,(t=>c(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!n){o=u;break}{const n=t.length-1;let s,r=0;s=t.length%u>0?t.length-t.length%u+u:t.length;do{if(s-=u,s!==n&&!CA(e[s],e[n],i))break;r++}while(s>0);if(s===n){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?EA(e[s-u],e[s]):t,d=Math.abs(t-c);if(d{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&_A(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},RA=(t,e)=>{if(SS(t.type))return((t,e)=>{if(!SS(t.type))return yA(t.domain());const i=t.range(),n=Math.abs(i[i.length-1]-i[0]);if(n<2)return yA([t.domain()[0]]);const{tickCount:s,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(s)?s({axisLength:n,labelStyle:l}):s;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(s)?s({axisLength:n,labelStyle:l}):s;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=AA(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;s.length>=3&&xA(s,i);)s=wA.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),Y(r)!==Y(h)&&r.push(Y(h))),h=r}return yA(h)})(t,e);if(kS(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?yA([n[n.length-1]]):yA([n[0]]);let f;if(p(a))f=t.stepTicks(a);else if(p(r))f=t.forceTicks(r);else if(p(s)){const e=d(s)?s({axisLength:g,labelStyle:h}):s;f=t.ticks(e)}else if(e.sampling){const s=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=X(u),a=K(u);if(n.length<=g/s){const i=(a-r)/n.length,s=TA(t,n,e,c),l=Math.min(...s.map((t=>t[2]))),h=MA(n,s,o,e.labelLastVisible,Math.floor(l/i),!1);f=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(f=f.slice(0,f.length-h.delCount)),f.push(n[n.length-1]))}else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],s=TA(t,i,e,c);let l=null;s.forEach((t=>{l?l[2]0?Math.ceil(n.length*(o+l[2])/(a-r-o)):n.length-1;f=t.stepTicks(h),!e.labelLastVisible||f.length&&f[f.length-1]===n[n.length-1]||(f.length&&Math.abs(t.scale(f[f.length-1])-t.scale(n[n.length-1])){const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return yA(t.domain());let c;if(p(s))c=t.stepTicks(s);else if(p(n))c=t.forceTicks(n);else if(p(i)){const e=t.range(),n=Math.abs(e[e.length-1]-e[0]),s=d(i)?i({axisLength:n,labelStyle:l}):i;c=t.ticks(s)}else if(e.sampling){const i=t.domain(),n=t.range(),s=kA(t,i,e),r=X(n),l=K(n),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=BA(i,s,o,Math.floor(s.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return yA(c)})(t,e)}return yA(t.domain())};function OA(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function IA(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Nt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function PA(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=OA(t,!!s),o=OA(r,!!s);const h=Nt.distancePP(n,l),c=Nt.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=IA(e,t,!1,!!s),o=IA(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=OA(t,!!s),o=OA(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class LA extends Yf{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Zx(this._innerView),this.removeAllChild(!0),this._innerView=od.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return qx(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:n,items:s,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${Gx.grid}-sub`:`${Gx.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=OA(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=IA(t,o,!1,!!a)}const u=od.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:LA.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${s}`),e.add(u)})),l&&"line"===n&&s.forEach(((t,i)=>{const{id:n,points:s}=t,o=[];o.push(s[0]);const c=s[1].x-s[0].x,u=s[1].y-s[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:s[0].x+c*g,y:s[0].y+u*g});const f=OA(o,!!a),m=wt(o[0].x-o[1].x),v=wt(o[0].y-o[1].y),y=od.path(Object.assign({path:f,z:0,alpha:m>v?(s[1].x-s[0].x>0?-1:1)*xt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:LA.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${n}`),e.add(y)})),s.length>1&&o){const t=_(o)?o:[o,"transparent"],n=e=>t[e%t.length];for(let t=0;t=2&&(s=this.data[1].value-this.data[0].value);let r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(DA,dS);var FA=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s=2&&(p=this.data[1].value-this.data[0].value),t){e=j({},c,h);const t=[],{count:n=4}=h||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}function NA(){ub(),Tb(),Eb()}U(jA,fS);const zA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};NA();class VA extends Yf{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},VA.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(KA.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,n,s;const r=t.target;if(r&&r.name&&r.name.startsWith(KA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===KA.focus||"focus"===o){const n=a.hasState(WA.focus);a.toggleState(WA.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[WA.unSelected,WA.unSelectedHover,WA.focus],t),this._setLegendItemState(e,WA.selected,t)})):(this._setLegendItemState(a,WA.selected,t),this._removeLegendItemState(a,[WA.unSelected,WA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[WA.selected,WA.selectedHover,WA.focus],t),this._setLegendItemState(e,WA.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(WA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(WA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(YA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[WA.selected,WA.selectedHover],t),this._setLegendItemState(a,WA.unSelected,t)):(this._setLegendItemState(a,WA.selected,t),this._removeLegendItemState(a,[WA.unSelected,WA.unSelectedHover],t))}else this._setLegendItemState(a,WA.selected,t),this._removeLegendItemState(a,[WA.unSelected,WA.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[WA.selected,WA.selectedHover],t),this._setLegendItemState(e,WA.unSelected,t))}))}this._dispatchLegendEvent(YA.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,WA.selected),this._removeLegendItemState(e,[WA.unSelected,WA.unSelectedHover])):(this._removeLegendItemState(e,[WA.selected,WA.selectedHover]),this._setLegendItemState(e,WA.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:n,maxHeight:s,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=HA,spaceRow:h=GA}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e;let v,{doWrap:y,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;_(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(n)&&(f&&o?(A=Math.ceil((x+g)/n),y=A>1):x+g>n&&(y=!0,x>0&&(A+=1,x=0,S+=m+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(s)&&(f&&o?(A=Math.ceil((S+m)/s),y=A>1):s<=m?(A+=1,y=!0,S=0,t>0&&(x+=k+l)):sthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,n){var s,r;const{label:a,value:o}=this.attribute.item,l=n.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:n.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(n.setAttribute("maxLineWidth",Math.max(e*(null!==(s=a.widthRatio)&&void 0!==s?s:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,n){var s,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,n),A=this._handleStyle(y,t,e,i,n),k=this._handleStyle(b,t,e,i,n),w=this._handleStyle(x,t,e,i,n),T=Oe(c);let C;!1===x.visible?(C=od.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(C,KA.item,t,C)):(C=od.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(C,KA.item,t,C,w.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?WA.selected:WA.unSelected);const E=od.group({x:0,y:0,pickable:!1});C.add(E);let M,B=0,O=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);O=_(i)?i[0]||0:i,I=R(v,"space",8);const n=od.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(n,KA.itemShape,t,C,S.state),n.addState(e?WA.selected:WA.unSelected),E.add(n)}let P=0;if(d){const e=R(g,"size",10);M=od.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(M,KA.focus,t,C),P=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=Jb(Object.assign(Object.assign({x:O/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,KA.itemLabel,t,C,A.state),D.addState(e?WA.selected:WA.unSelected),E.add(D);const F=R(y,"space",8);if(p(l)){const n=R(b,"space",d?8:0),s=b.formatMethod?b.formatMethod(l,t,i):l,r=Jb(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:s,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,KA.itemValue,t,C,k.state),r.addState(e?WA.selected:WA.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-I-F-P-n;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-P-n}):r.setAttribute("x",n+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",n+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),E.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-I-P),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);M&&(M.setAttribute("x",B),E.add(M));const j=E.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;E.forEachChildren(((i,n)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===M?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const z=j.height(),V=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],H=this._itemHeightByUser||z+T[0]+T[2];return C.attribute.width=V,C.attribute.height=H,M&&M.setAttribute("visible",!1),E.translateTo(-j.x1+T[3],-j.y1+T[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:n,maxRow:s}=this.attribute;return this._itemContext.isHorizontal?new VA(Object.assign(Object.assign({layout:1===s?"horizontal":"vertical",total:99},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:n})):new VA(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:n,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new Fb(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new Fb(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,n,s){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+s-this._pagerComponent.AABBBounds.height()/2:i+s/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?n-this._pagerComponent.AABBBounds.width():(n-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:n,totalPage:s,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(n-1)/s,n/s]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:n=!0,animationDuration:s=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let n=e[0]*this._itemContext.totalPage;return i.scrollByPosition?n+=1:n=Math.floor(n)+1,n}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:n}=t.attribute;v<_+i&&(_=0,b+=n+l,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=o+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(v,y,t,f,m)}else{if(f=this._itemMaxWidth*n+(n-1)*o,m=i,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=i-g.AABBBounds.height()-c-t,y<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:_,y:b}),b+=l+i}));const e=Math.ceil(x/n);this._itemContext.totalPage=e,this._updatePositionOfPager(v,y,t,f,m)}d>1&&(p?h.setAttribute("y",-(d-1)*(m+l)):h.setAttribute("x",-(d-1)*(f+o)));const S=od.group({x:0,y:t,width:p?v:f,height:p?m:y,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?m+l:f+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:n={},pager:s={}}=this.attribute,{spaceCol:r=HA,spaceRow:a=GA}=n,o=this._itemsContainer,{space:l=UA,defaultCurrent:h=1}=s,c=$A(s,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,f=0,m=0,v=1;if(d)p=e,g=e,f=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,f,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),f=i-t,g=this._itemMaxWidth,f<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((m+i)/f)+1,m+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,f,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(f+a)));const y=od.group({x:0,y:t,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(WA.selected)?this._setLegendItemState(t,WA.selectedHover,e):this._setLegendItemState(t,WA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===KA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(YA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(WA.unSelectedHover)||t.hasState(WA.selectedHover))&&(i=!0),t.removeState(WA.unSelectedHover),t.removeState(WA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(WA.unSelectedHover)&&!t.hasState(WA.selectedHover)||(i=!0),t.removeState(WA.unSelectedHover),t.removeState(WA.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===KA.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(YA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(YA.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==KA.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(YA.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==KA.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(YA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WA.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=j({},ZA,s)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(WA.selected),currentSelectedItems:n,currentSelected:s,event:i})}_handleStyle(t,e,i,n,s){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,n,s):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,n,s):r.state[a]=t.state[a])}))),r}};qA.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:HA,spaceRow:GA,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:UA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const JA=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return j(t,...i,{shape:s.every(u)?void 0:j({},...s),key:r.every(u)?void 0:j({},...r),value:a.every(u)?void 0:j({},...a)})},QA=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:W(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},tk={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:Ob,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:Ob,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:Ob,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ht).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ek=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];ub(),bb(),Tb(),Eb(),Sb();let ik=class t extends Yf{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:n,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Oe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:Nb(u)&&Nb(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Nb(u)&&Nb(u.value)},QA(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:Nb(u)&&Nb(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Nb(u)&&Nb(u.value)},QA(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},Lb),u.value),visible:Nb(u)&&Nb(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=Nb(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=s.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=Nb(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),n&&n.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;n.forEach(((i,n)=>{const s=t.getContentAttr(this.attribute,n);if(!Nb(s))return;const l=`tooltip-content-${n}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=s.shape.size+s.shape.spacing;let u="right"===c?(o?d:0)+(Nb(s.key)?r+s.key.spacing:0)+(Nb(s.value)?a:0):0;this._createShape("right"===c?u-s.shape.size/2:u+s.shape.size/2,s,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(s,h,l);g&&(Qb(c,g,s.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+s.key.spacing:u+=r+s.key.spacing);const f=this._createValue(s,h,l);if(f){let t="right";p(s.value.textAlign)?t=s.value.textAlign:Nb(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),Qb(c,f,t,u,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if(Nb(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=Fa(e.key.lineHeight,e.key.fontSize))&&void 0!==s?s:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var n;if(Nb(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},QA(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.key.text)&&void 0!==n?n:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},QA(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},Lb),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if(Nb(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},QA(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.value.text)&&void 0!==n?n:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},QA(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),s}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>ek.includes(t)))?(this._mergeAttributes(e,n),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&Nb(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=Nb(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=Xb(u),_=Xb(p);let b=0;if(Nb(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(Nb(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&uc[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return JA({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return JA({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function nk(t,e){const i=sk(t),n=sk(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function sk(t,e={x:0,y:0}){return Nt.distancePP(t,e)}function rk(t,e,i){let n=!1;if(e&&d(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}ik.defaultAttributes=tk;const ak=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var lk,hk;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(lk||(lk={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(hk||(hk={}));const ck="__VCHART",dk=500,uk=500,pk=`${ck}_LABEL_LIMIT`,gk=`${ck}_LABEL_ALIGN`,fk=`${ck}_LABEL_TEXT`,mk=`${ck}_LABEL_VISIBLE`,vk=`${ck}_LABEL_X`,yk=`${ck}_LABEL_Y`,_k=`${ck}_ARC_TRANSFORM_VALUE`,bk=`${ck}_ARC_RATIO`,xk=`${ck}_ARC_START_ANGLE`,Sk=`${ck}_ARC_END_ANGLE`,Ak=`${ck}_ARC_K`,kk=`${ck}_ARC_MIDDLE_ANGLE`,wk=`${ck}_ARC_QUADRANT`,Tk=`${ck}_ARC_RADIAN`,Ck=-Math.PI/2,Ek=3*Math.PI/2;var Mk,Bk,Rk,Ok,Ik,Pk,Lk,Dk,Fk,jk,Nk,zk,Vk,Hk,Gk;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(Mk||(Mk={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Bk||(Bk={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(Rk||(Rk={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(Ok||(Ok={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(Ik||(Ik={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Pk||(Pk={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Lk||(Lk={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(Dk||(Dk={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(Fk||(Fk={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jk||(jk={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(Nk||(Nk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(zk||(zk={})),t.VGRAMMAR_HOOK_EVENT=void 0,(Vk=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",Vk.AFTER_EVALUATE_DATA="afterEvaluateData",Vk.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",Vk.AFTER_EVALUATE_SCALE="afterEvaluateScale",Vk.BEFORE_PARSE_VIEW="beforeParseView",Vk.AFTER_PARSE_VIEW="afterParseView",Vk.BEFORE_TRANSFORM="beforeTransform",Vk.AFTER_TRANSFORM="afterTransform",Vk.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",Vk.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",Vk.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",Vk.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",Vk.BEFORE_STAGE_RESIZE="beforeStageResize",Vk.AFTER_STAGE_RESIZE="afterStageResize",Vk.BEFORE_VRENDER_DRAW="beforeVRenderDraw",Vk.AFTER_VRENDER_DRAW="afterVRenderDraw",Vk.BEFORE_MARK_JOIN="beforeMarkJoin",Vk.AFTER_MARK_JOIN="afterMarkJoin",Vk.BEFORE_MARK_UPDATE="beforeMarkUpdate",Vk.AFTER_MARK_UPDATE="afterMarkUpdate",Vk.BEFORE_MARK_STATE="beforeMarkState",Vk.AFTER_MARK_STATE="afterMarkState",Vk.BEFORE_MARK_ENCODE="beforeMarkEncode",Vk.AFTER_MARK_ENCODE="afterMarkEncode",Vk.BEFORE_DO_LAYOUT="beforeDoLayout",Vk.AFTER_DO_LAYOUT="afterDoLayout",Vk.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",Vk.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",Vk.BEFORE_DO_RENDER="beforeDoRender",Vk.AFTER_DO_RENDER="afterDoRender",Vk.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",Vk.AFTER_MARK_RENDER_END="afterMarkRenderEnd",Vk.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",Vk.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",Vk.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",Vk.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",Vk.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",Vk.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",Vk.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",Vk.BEFORE_ELEMENT_STATE="beforeElementState",Vk.AFTER_ELEMENT_STATE="afterElementState",Vk.BEFORE_ELEMENT_ENCODE="beforeElementEncode",Vk.AFTER_ELEMENT_ENCODE="afterElementEncode",Vk.ANIMATION_START="animationStart",Vk.ANIMATION_END="animationEnd",Vk.ELEMENT_ANIMATION_START="elementAnimationStart",Vk.ELEMENT_ANIMATION_END="elementAnimationEnd",Vk.ALL_ANIMATION_START="allAnimationStart",Vk.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(Hk||(Hk={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(Gk||(Gk={}));const Uk="__vgrammar_scene_item__",Wk=[Rk.line,Rk.area],Yk=[Rk.arc3d,Rk.rect3d,Rk.pyramid3d],Kk="key",Xk=[{}],$k=["key"],Zk=!0,qk=!0,Jk=!1,Qk=!0,tw="VGRAMMAR_IMMEDIATE_ANIMATION",ew=0,iw=1e3,nw=0,sw=0,rw=!1,aw=!1,ow="quintInOut",lw={stopWhenStateChange:!1,immediatelyApply:!0},hw="_mo_hide_";function cw(t,e){return W(t).reduce(((t,i)=>{const n=y(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function dw(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(y(i))return W(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return cw(t.dependency,e);var i;return[]}function uw(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pw(t,e,i,n){if(u(t))return t;if(d(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function gw(t,e){return fw(t)?t.output():e[t]}const fw=t=>t&&!u(t.grammarType),mw=t=>d(t)?t:e=>e[t];function vw(t){return!!(null==t?void 0:t.scale)}function yw(t){return!!(null==t?void 0:t.field)}function _w(t,e){if(!t)return[];let i=[];return t.scale&&(i=fw(t.scale)?[t.scale]:W(e.getScaleById(t.scale))),i.concat(dw(t,e))}function bw(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function xw(t,e,i,n,s){i&&(uw(i)?e.forEach((e=>{const s=pw(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=s&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case Rk.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case Rk.group:case Rk.rect:case Rk.image:return["width","height","y1"].includes(e);case Rk.path:case Rk.shape:return["path","customPath"].includes(e);case Rk.line:return"defined"===e;case Rk.area:return["x1","y1","defined"].includes(e);case Rk.rule:return["x1","y1"].includes(e);case Rk.symbol:return"size"===e;case Rk.polygon:return"points"===e;case Rk.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vw(l)){const t=gw(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=y(null==l?void 0:l.field),c=s?Vf(l.field):null;let d=s?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((n=>{var a;s&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(n.datum))),n.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(yw(l)){const t=Vf(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pw(l,n,e.datum,t)}))})))}function Sw(t,e,i,n){if(!t)return null;if(uw(t))return pw(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vw(h)){const t=gw(h.scale,n),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=y(null==h?void 0:h.field),p=d?Vf(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);s[r]=S(g)||S(c)?g+i+c:g}else if(yw(h)){const t=Vf(h.field);s[r]=t(e)}else s[r]=pw(h,n,e,i)})),s}class Aw{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return y(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=W(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let kw=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,n){return t._marks[e]?new t._marks[e](i,e,n):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,n,s){const r=t._components[e];return r?new r(i,n,s):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,n){const s=t._graphicComponents[e];return s?s(i,n):null}static registerTransform(e,i,n){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!n})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,n){t._grammars[e]={grammarClass:i,specKey:null!=n?n:e}}static createGrammar(e,i,n){var s;const r=null===(s=t._grammars[e])||void 0===s?void 0:s.grammarClass;return r?new r(i,n):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,n){const s=t._interactions[e];return s?new s(i,n):null}static hasInteraction(e){return!!t._interactions[e]}};kw._plotMarks={},kw._marks={},kw._components={},kw._graphicComponents={},kw._transforms={},kw._grammars={},kw._glyphs={},kw._animations={},kw._interactions={},kw._graphics={},kw.registerGlyph=(t,e,i,n,s)=>(kw._glyphs[t]=new Aw(e,i,n,s),kw._glyphs[t]),kw.registerAnimationType=(t,e)=>{kw._animations[t]=e},kw.getAnimationType=t=>kw._animations[t],kw.registerInteraction=(t,e)=>{kw._interactions[t]=e},kw.registerGraphic=(t,e)=>{kw._graphics[t]=e},kw.getGraphicType=t=>kw._graphics[t],kw.createGraphic=(t,e)=>{const i=kw._graphics[t];return i?i(e):null};const ww=t=>!!Rk[t];function Tw(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var n;const s=kw.getGraphicType(e)?kw.createGraphic(e,i):kw.createGraphicComponent(e,i,{skipDefault:null===(n=null==t?void 0:t.spec)||void 0===n?void 0:n.skipTheme});return s||it.getInstance().error(`create ${e} graphic failed!`),s}const Cw=t=>{t&&(t[Uk]=null,t.release(),t.parent&&t.parent.removeChild(t))},Ew=["fillOpacity"],Mw=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):[]};const Bw={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[Rk.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a),l=m(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[Rk.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return A(e)&&A(i)&&A(n)&&A(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[Rk.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const Rw=(t,e,i,n)=>{const s={},r=e?Object.keys(e):[],a=y(t)?Bw[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){const a=s.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in n&&(a[t]=n[t])})),a;const o={};return e.forEach((t=>{o[t]=n[t]})),i[t]=o,o}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(Ew.includes(r)?Mw(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{Ew.includes(t)?Mw(s,t,e):s[t]=e[t]}));return s},Ow=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),Iw=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],Pw=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(Iw);function Lw(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?Pw:Iw,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>Ow(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=Dw(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function Dw(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((n=>{i.includes(n)||(e[n]=t[n])})),e}let Fw=class{constructor(t){this.data=null,this.states=[],this.diffState=Bk.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t]),this.runtimeStatesEncoder[t]):null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));xw(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?Rw(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[Uk]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?Rw(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===Bk.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(Cw(this.graphicItem),this.graphicItem[Uk]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,n){var s;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:n},this),this.data=i;const r=mw(n);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:n},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=W(pw(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===Bk.unChange&&(this.diffState=Bk.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,hw in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[hw],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==Bk.enter&&this.diffState!==Bk.update||!this.states.length||this.useStates(this.states),this.mark.markType===Rk.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new cs))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[Mk.update],a=e[Mk.enter],o=e[Mk.exit],l=this.mark.isLargeMode()||s&&!this.mark.getSpec().enableSegments;this.diffState===Bk.enter?(a&&xw(this,t,a,n,l),r&&xw(this,t,r,n,l)):this.diffState===Bk.update?((s&&a||i)&&xw(this,t,a,n,l),r&&xw(this,t,r,n,l)):this.diffState===Bk.exit&&o&&(i&&xw(this,t,a,n,l),xw(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let n=!1,s=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!H(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?n=!0:e.push(r),this._updateRuntimeStates(r,o),s=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),s=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(s=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),n&&this.graphicItem.clearStates(),!!s&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&y(t)&&!H(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const n=this.mark.getSpec().encode,s=W(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==n?void 0:n[e])&&t.push(e),t)),this.states.slice());return s.length!==this.states.length&&(this.useStates(s),!0)}removeState(t){if(!this.graphicItem)return!1;const e=W(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var n;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const s=null===(n=this.mark.getSpec())||void 0===n?void 0:n.stateSort;s&&e.sort(s),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)Gf(n,i,t)&&I(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[Rk.line,Rk.area,Rk.largeRects,Rk.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||bw(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),n=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[Mk.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=Dw(h),e===Rk.line||e===Rk.area){const i=function(t,e,i,n){return t&&t.length&&(1!==t.length||e)?t.some((t=>bw(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(s=null==i?void 0:i[e])&&void 0!==s?s:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,n&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,n,e===Rk.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const n=!!i&&i.mark.getSpec().enableSegments;let s,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(s||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===s&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),s=!0):s=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(n){const n=Lw(e.items,e.points,i);if(n)return void n.forEach((e=>{t.push(e)}))}const s=Dw(e.items[0]);s.points=e.points,t.push(s)})),t}return n?Lw(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=Sw(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=Lw(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const n="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],s={};return Object.keys(t).forEach((e=>{n.includes(e)||(s[e]=t[e])})),s}(h,this)}else h.points=i,h.segments=null}else e===Rk.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=null!==(s=l.x)&&void 0!==s?s:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,n):e===Rk.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=null!==(s=a.x)&&void 0!==s?s:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];n[2*e]=o,n[2*e+1]=l})),n}(t,!0,n))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),s=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{s[t]=this.getGraphicAttribute(t),r[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(s),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!I(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!I(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(Cw(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?_(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class jw{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),W(t).map((t=>y(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const Nw=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const n=t&&t.getSpec(),s=n&&n.encode;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class zw extends jw{constructor(t,e){super(t,e),this.type=zw.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},zw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Nw(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:n,resetType:s}=(t=>{const e=W(t),i=[],n=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(n.push(t.replace("view:","")),i.push("view")):(n.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:n,resetType:i}})(t);return n.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=s,i}start(t){const{state:e,reverseState:i,isMultiple:n}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const n=this._statedElements&&this._statedElements.filter((e=>e!==t));n&&n.length?this._statedElements=this.updateStates(n,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(n&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}zw.type="element-select",zw.defaultOptions={state:Gk.selected,trigger:"click"};class Vw extends jw{constructor(t,e){super(t,e),this.type=Vw.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},Vw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Nw(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}Vw.type="element-highlight",Vw.defaultOptions={highlightState:Gk.highlight,blurState:Gk.blur,trigger:"pointerover",triggerOff:"pointerout"};class Hw{updateStates(t,e,i,n){return t&&t.length?(i&&n?e&&e.length?(this.toggleReverseStateOfElements(t,e,n),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,n):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((n=>{const s=i&&this._stateMarks[i]&&this._stateMarks[i].includes(n),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(n);(s||r)&&n.elements.forEach((n=>{t&&t.includes(n)?r&&n.addState(e):s&&n.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&i.elements.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const Gw=()=>{U(zw,Hw),kw.registerInteraction(zw.type,zw)},Uw=()=>{U(Vw,Hw),kw.registerInteraction(Vw.type,Vw)},Ww=(t,e)=>fw(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,Yw=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=Ww(s,e),i}),{}):t.map((t=>Ww(t,e))):t;let Kw=-1;class Xw extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++Kw}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=W(this.spec.dependency).map((t=>y(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=W(t).map((t=>y(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return W(t).filter((t=>!u(t))).forEach((i=>{var n;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return W(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(dw(this.spec[e],this.view)),this.spec[e]=t,this.attach(dw(t,this.view)),this.commit(),this}}const $w=(t,e,i)=>{var n,s;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=dw(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},Zw=(t,e)=>{const i=kw.getTransform(t.type);if(!i)return;const n={};let s=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(s=s.concat(cw(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(_(e)){const n=e.map((e=>$w(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return $w(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(s=s.concat(o.references)),n[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:n,references:s}},qw=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=Zw(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null},Jw={csv:li,dsv:oi,tsv:hi,json:function(t){if(!y(t))return W(t);try{return W(JSON.parse(t))}catch(t){return[]}}};class Qw extends Xw{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!Jw[e.type])return W(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return Jw[e.type](t,i,new fi(new pi))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],n=t.format?dw(t.format,this.view)[0]:null;if(n&&e.push(n),t.values){const n=dw(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const s=dw(t.url,this.view)[0];s&&e.push(s),i.push({type:"load",transform:this.load,options:{url:null!=s?s:t.url,format:null!=n?n:t.format}})}else if(t.source){const n=[];W(t.source).forEach((t=>{const i=fw(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const n=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const s=this.evaluateTransform(n,this._input,i),r=this._evaluateFilter(s,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Object.assign({},this.spec,{values:t,format:e});return u(t)||(n.url=void 0,n.source=void 0),i?this.parseLoad(n):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Object.assign({},this.spec,{url:t,format:e});return u(t)||(n.values=void 0,n.source=void 0),i?this.parseLoad(n):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Object.assign({},this.spec,{source:t,format:e});return u(t)||(n.values=void 0,n.url=void 0),i?this.parseLoad(n):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=W(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=qw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=qw(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(W(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=W(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const tT="window",eT="view",iT={trap:!1},nT="width",sT="height",rT="viewWidth",aT="viewHeight",oT="padding",lT="viewBox",hT="autoFit";function cT(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],a&&s&&n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function dT(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,cT(t,e,s,n)}class uT{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return cT(this.nodes,e,0,this.compare),dT(this.nodes,e,null,this.compare)}return this.nodes.push(t),cT(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),cT(this.nodes,e,0,this.compare),dT(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,dT(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class pT{constructor(t){this.list=[],this.ids={},this.idFunc=t||Hf}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class gT{constructor(){this.grammars=[],this.logger=it.getInstance(),this._curRank=0,this._committed=new pT((t=>t.uid)),this._heap=new uT(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new pT((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const fT=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===Rk.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class mT{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Ko(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ls.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,n,s,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new Dg(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(n=a.layer)&&void 0!==n?n:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&(this._dragController=new vm(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new bm(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function vT(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function yT(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return A(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),A(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&A(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&A(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function _T(t,e,i,n,s){if(s===tT){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yT(t,vT(t),!1)}))}));const e=vT(t);yT(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class bT extends Xw{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?pw(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(_(t)&&_(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,n,s;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},kT=(t,e)=>e&&e.debounce?gt(t,e.debounce):e&&e.throttle?ft(t,e.throttle):t;class wT extends Fw{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t]),this.runtimeStatesEncoder[t]):null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return xw(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[Uk]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?Rw(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const n=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===Bk.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==Bk.enter&&this.diffState!==Bk.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!u(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=Rw(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=Bw[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===Rk.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){const n=e.map((t=>Object.assign({},t,{nextAttrs:i})));return Wk.includes(t)&&this.mark.getSpec().enableSegments&&n.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),n}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&I(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),I(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),I(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)Gf(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var n,s;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(n=this.getPrevGraphicAttributes(e))&&void 0!==n?n:{},o=null!==(s=this.getFinalGraphicAttributes(e))&&void 0!==s?s:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[Uk]=null})),this.glyphGraphicItems=null),super.release()}}const TT=t=>t.markType===Rk.glyph?new wT(t):new Fw(t);function CT(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(Kk,i?t.slice().sort(i):t.slice()),{keys:$k,data:n};const s=mw(e);if(1===t.length){const e=s(t[0]);return n.set(e,[t[0]]),{keys:[e],data:n}}const r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class ET{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CT(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const MT=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,n=Object.keys(i);n.forEach((t=>{u(i[t])&&delete i[t]}));const s=bw(n,e.mark.markType)&&!p(i.segments);if(s){const n=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(n,e.mark.markType,s)}}if(t.to){const i=t.to,n=Object.keys(i);n.forEach((t=>{u(i[t])&&delete i[t]}));const s=bw(n,e.mark.markType)&&!p(i.segments);if(s){const n=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(n,e.mark.markType,s)}}return t};const BT=(t,e,i,n,s)=>d(i)?i(t.getDatum(),t,s):i;class RT extends fa{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class OT extends fa{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Lo,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const n=Object.assign({},this.from),s=Object.assign({},this.to),r=[];Object.keys(s).forEach((t=>{i.includes(t)?(n[t]=s[t],this.from[t]=s[t]):u(n[t])?n[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=n,this._toAttribute=s}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:yn.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:yn.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const n=this.step.getLastProps();Object.keys(n).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=n[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}va.mode|=bn.SET_ATTR_IMMEDIATELY;let IT=0;const PT=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof fa||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class LT{constructor(t,e,i){this.id=IT++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const n=i.animate();this.runnings.push(n),n.startAt(this.unit.initialDelay),n.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(n,i,t,e)})),n.wait(this.unit.loopDelayAfter),n.loop(this.unit.loopCount-1),A(this.unit.totalTime)&&setTimeout((()=>{n&&n.stop("end")}),this.unit.totalTime),n.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==n)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(s>0&&t.wait(s),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var s;const r=null!==(s=t.type?function(t,e,i,n){const s=d(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!kw.getAnimationType(e.type))return null;const r=kw.getAnimationType(e.type)(t,s,i);return MT(r,t)}(this.element,t,i,n):t.channel?function(t,e,i,n){const s=e.channel;let r=null;return _(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!u(null===(r=s[i])||void 0===r?void 0:r.from),l=!u(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?BT(t,0,s[i].from,0,n):void 0,e.to[i]=l?BT(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),MT(r,t)}(this.element,t,0,n):void 0)&&void 0!==s?s:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=PT(o);return u(o)||PT(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new OT(r.from,r.to,a,t.easing):void 0:new RT(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new Ha(a,e))}r>0&&t.wait(r)}}function DT(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(FT(i,t[i]))})),e}function FT(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return W(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:ew,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:aw,loop:null!==(n=h.loop)&&void 0!==n?n:rw,controlOptions:j({},lw,null!==(s=h.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:iw,delay:null!==(a=h.delay)&&void 0!==a?a:nw,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:sw,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:ow,customParameters:h.customParameters,options:h.options}]}]}}const g=W(t.timeSlices).filter((t=>t.effects&&W(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:ew,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:aw,loop:null!==(d=t.loop)&&void 0!==d?d:rw,controlOptions:j({},lw,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:nw,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:sw,effects:W(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:ow,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function jT(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class NT{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class zT{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=DT(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=DT(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==Bk.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new NT(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=FT(tw,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new NT(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=W(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=W(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=W(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var s;const r=[],a=e.filter((e=>{const s=!(e.isReserved&&e.diffState===Bk.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(s=this.mark.group)&&void 0!==s?s:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((n,s)=>{e.elementIndex=s;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,n,s,a.length,o);r.push(this.animateElement(t,l,n,e,o))}))}return r}animateElement(e,i,n,s,r){var a,o;const l=new LT(n,i,e);if(l.animate(s,r),!l.isAnimating)return;n.diffState===Bk.exit&&(n.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(n))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(n,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,n),l}getAnimationState(t){const e=pw(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=jT(t.startTime,e,s),o=jT(t.totalTime,e,s),l=jT(t.oneByOne,e,s),h=jT(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=jT(t.delay,e,s),l=jT(t.delayAfter,e,s),h=null!==(i=jT(t.duration,e,s))&&void 0!==i?i:o/n,d=W(t.effects).map((t=>Object.assign({},t,{customParameters:jT(t.customParameters,e,s)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===Bk.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===Bk.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=e.element,s=e.animationOptions,r=s.state,a=r===tw,o=this.elementRecorder.get(n).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[s.id]-=1;const l=0===this.timelineCount[s.id],h=a?this.immediateConfigs.find((t=>t.id===s.id)).originConfig:this.configs.find((t=>t.id===s.id)).originConfig;l&&(delete this.timelineCount[s.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==s.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===Bk.exit&&0===o[Bk.exit]&&this.clearElement(n));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,n)}}class VT extends Xw{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new zT(this,{}),this.differ=new ET([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=y(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=y(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===Bk.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var n;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===zk.before)return this;const s=null===(n=this.view.renderer)||void 0===n?void 0:n.stage();this.init(s,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:Xk,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===Rk.group)return;const e=CT(null!=t?t:Xk,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(y(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return y(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(Bk.update,t,e,i)}encodeState(t,e,i,n){if(t===Bk.enter&&(this._isReentered=!0),this.spec.encode[t]){const s=this.spec.encode[t];if(uw(s))this.detach(_w(s,this.view));else{const r=y(e);r&&n||!r&&i?(Object.keys(s).forEach((t=>{this.detach(_w(s[t],this.view))})),this.spec.encode[t]={}):r?this.detach(_w(s[e],this.view)):Object.keys(e).forEach((t=>{this.detach(_w(s[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),y(e)?(this.spec.encode[t][e]=i,this.attach(_w(i,this.view))):uw(e)?(this.spec.encode[t]=e,this.attach(_w(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(_w(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=qw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=qw(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return Wk.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==Bk.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===Hk.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!uw(s)&&Object.keys(s).forEach((t=>{vw(s[t])&&(e[t]=gw(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];uw(n)||Object.keys(n).forEach((t=>{yw(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[Uk];if((null==n?void 0:n.mark)===this){const i=_T(this.view,t,n,0,eT);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new zT(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gw(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==Rk.group){if(!this.graphicItem){const t=Tw(this,Rk.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||Yk.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==Rk.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=_(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=mw(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>Kk),a=mw(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>Kk),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===Bk.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(u(e))s=this.elementMap.get(n),s&&(s.diffState=Bk.exit);else if(u(i)){s=this.elementMap.has(n)?this.elementMap.get(n):TT(this),s.diffState===Bk.exit&&(s.diffState=Bk.enter,this.animate.getElementAnimators(s,Bk.exit).forEach((t=>t.stop("start")))),s.diffState=Bk.enter;const i=l?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),c.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=Bk.update;const i=l?t:a(e[0]);s.updateData(i,e,r,this.view),c.push(s)}h.delete(s)}));const d=null!=t?t:Xk;l||this.differ.setCurrentData(CT(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const n={};return this._groupKeys.forEach((s=>{const r=t.find((t=>t.groupKey===s));r&&(n[s]=Sw(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=n,n}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,n,s){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:n},this);const a=s?null:this.evaluateGroupEncode(e,i[Mk.group],n);e.forEach((t=>{this.markType===Rk.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,n),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,n),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:n},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:Tw(this,this.markType,t);if(s){if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return s}}parseRenderContext(t,e){const i=this.markType!==Rk.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=mw(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>Kk),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=TT(this);e.diffState=Bk.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=TT(this);i.diffState=Bk.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const n=this.renderContext.progressive.currentIndex;if(0===n){if(this.evaluateEncode(t,e,i),0===n&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==Rk.glyph){const e=t[0],i=e.getGraphicItem(),n=null==i?void 0:i.parent;n&&this._groupEncodeResult[e.groupKey]&&n.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,n;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const s=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=Tw(this,Rk.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,s),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),s);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(n=this._getTransformsAfterEncode())||void 0===n?void 0:n.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==Bk.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:Bw[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=Bk.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&Cw(this.graphicItem),this.detachAll(),super.release()}}let HT=class extends VT{constructor(t,e){super(t,Rk.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===Rk.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return Bw.rect}evaluateJoin(t){if(!this.elements.length){const t=TT(this);t.updateData(Kk,Xk,(()=>""),this.view),this.elements=[t],this.elementMap.set(Kk,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const n=d(e.clipPath)?e.clipPath([t]):e.clipPath;n&&n.length?i.path=n:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var n;const s=this.elements[0],r={};return xw(s,[Object.assign({},null===(n=s.items)||void 0===n?void 0:n[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,n,s){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:n},this);const a=s?null:this.evaluateGroupEncode(e,i[Mk.group],n);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,n)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,n),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:n},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,n){const s=null!=n?n:Tw(this,this.markType,e);if(s)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};function GT(t,e){if(A(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return A(t)?t*e:0}return 0}function UT(t,e){return Math.min(t<0?t+e:t-1,e)}function WT(t,e,i){let n=UT(t,i),s=UT(e,i);if(A(t)||A(e)?A(t)?A(e)||(n=UT(Math.max(0,s-1),i)):s=UT(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const YT=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>GT(t,i))),u=l.map((t=>GT(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let v=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=v;return v+=i+c,n}));return y.push(v),{rows:m,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=WT(e,i,r),{start:h,end:c}=WT(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},KT={[Ok.axis]:0,[Ok.legend]:1,[Ok.slider]:2,[Ok.player]:3,[Ok.datazoom]:4},XT=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=KT[t.componentType])&&void 0!==n?n:1/0},$T=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Uf(r.maxChildWidth,s.width()),o=Uf(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=AT(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dXT(t)-XT(e)));for(let t=0,e=m.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==Rk.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(d(r))r.call(null,t,s,a,e);else if(d(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=$T(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(rT,o),i.updateSignal(aT,l),i.updateSignal(oT,h)}else $T(t,s,a,e);else"grid"===r.display&&YT(t,s,a);ZT(s,e,i)}}))};class qT extends VT{constructor(t,e,i){super(t,Rk.glyph,i),this.glyphType=e,this.glyphMeta=kw.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!kw.getGraphicType(Rk.glyph))return;const n=kw.createGraphic(Rk.glyph,i),s=e.getMarks(),r=Object.keys(s).map((t=>{if(kw.getGraphicType(s[t])){const e=kw.createGraphic(s[t]);if(e)return e.name=t,e}}));return n.setSubGraphic(r),n}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const JT=Symbol.for("key");class QT{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new ET(t,i);return s.setCallback(((t,e,i)=>{u(e)?n.exit.push({prev:i[0]}):u(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(CT(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==Rk.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==Rk.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=CT(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=CT(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=mw(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new ET(t,i);return s.setCallback(((t,e,i)=>{u(e)?n.exit.push({prev:i}):u(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(CT(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:JT})),r=CT(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:JT}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==JT){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=pw(i.animation.delay,s,o,l),d=pw(i.animation.duration,s,o,l),u=pw(i.animation.oneByOne,s,o,l),p=pw(i.animation.splitPath,s,o,l),g=A(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?ko:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:wo)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);bo(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?ko:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:wo)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>mo(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>yo(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:yn.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new _o({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:Sa,null!==(l=i.easing)&&void 0!==l?l:Aa))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:yn.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new xo({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:Sa,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Aa))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):bo(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class tC{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=y(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),u(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),u(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class eC extends tC{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===Rk.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===Rk.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===Rk.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===Rk.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class iC{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;e.animate&&(null===(n=(i=e.animate).enableAnimationState)||void 0===n||n.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;e.animate&&(null===(n=(i=e.animate).disableAnimationState)||void 0===n||n.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class nC extends VT{addGraphicItem(t,e){const i=t&&t.limitAttrs,n=Tw(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?Rk.richtext:Rk.text,t);return super.addGraphicItem(t,e,n)}release(){super.release()}}nC.markType=Rk.text;const sC={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},rC={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},aC=Object.assign({},sC);aC.axis=Object.assign({},aC.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),aC.circleAxis=Object.assign({},aC.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),aC.grid=Object.assign({},aC.grid,{style:{stroke:"#404349"}}),aC.circleGrid=Object.assign({},aC.circleGrid,{style:{stroke:"#404349"}}),aC.rectLabel=Object.assign({},aC.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),aC.lineLabel=Object.assign({},aC.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),aC.symbolLabel=Object.assign({},aC.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),aC.title=Object.assign({},aC.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const oC={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:rC,components:aC},lC={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:rC,components:sC};let hC=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};hC._themes=new Map,hC.registerTheme("default",lC),hC.registerTheme("dark",oC);class cC extends VT{constructor(t,e,i,n){super(t,Rk.component,i),this._componentDatum={[Kk]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=n,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,n){const s=null!=n?n:kw.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,Kk)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[Kk]+=1}evaluateJoin(t){return this.spec.key=Kk,t?(t[Kk]=this._componentDatum[Kk],this._componentDatum=t):this._componentDatum={[Kk]:this._componentDatum[Kk]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class dC extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[Uk],s=_T(0,t,n,0,eT);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=W(t),i=[];return e.forEach((t=>{if(fw(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):ww(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){y(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new bT(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new Qw(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kw.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kw.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const n=y(e)?this.getMarkById(e):e;let s;switch(t){case Rk.group:s=new HT(this,n);break;case Rk.glyph:s=new qT(this,null==i?void 0:i.glyphType,n);break;case Rk.component:s=kw.hasComponent(null==i?void 0:i.componentType)?kw.createComponent(null==i?void 0:i.componentType,this,n,null==i?void 0:i.mode):new cC(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case Rk.text:s=new nC(this,t,n);break;default:s=kw.hasMark(t)?kw.createMark(t,this,n):new VT(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(Rk.group,t)}glyph(t,e){return this.mark(Rk.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(Rk.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Rk.component,t,{componentType:Ok.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Rk.component,t,{componentType:Ok.grid,mode:e})}legend(t){return this.mark(Rk.component,t,{componentType:Ok.legend})}slider(t){return this.mark(Rk.component,t,{componentType:Ok.slider})}label(t){return this.mark(Rk.component,t,{componentType:Ok.label})}datazoom(t){return this.mark(Rk.component,t,{componentType:Ok.datazoom})}player(t){return this.mark(Rk.component,t,{componentType:Ok.player})}title(t){return this.mark(Rk.component,t,{componentType:Ok.title})}scrollbar(t){return this.mark(Rk.component,t,{componentType:Ok.scrollbar})}customized(t,e){const i=kw.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=y(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&ST.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(Cw(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,n,s,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++xT;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(hC.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(n=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==n?n:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(nT,t.width),this.updateSignal(sT,t.height))}(null===(s=e.signals)||void 0===s?void 0:s.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=kw.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=zk.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var n,s,r,a,o;return[{id:nT,value:null!==(n=t[nT])&&void 0!==n?n:0},{id:sT,value:null!==(s=t[sT])&&void 0!==s?s:0},{id:oT,value:AT(null!==(a=null!==(r=t[oT])&&void 0!==r?r:e[oT])&&void 0!==a?a:null==i?void 0:i.padding)},{id:rT,update:{callback:(t,e)=>{const i=AT(e[oT]);return e[nT]-i.left-i.right},dependency:[nT,oT]}},{id:aT,update:{callback:(t,e)=>{const i=AT(e[oT]);return e[sT]-i.top-i.bottom},dependency:[sT,oT]}},{id:lT,update:{callback:(t,e)=>{const i=AT(e[oT]);return(t||new Vt).setValue(i.left,i.top,i.left+e[rT],i.top+e[aT])},dependency:[rT,aT,oT]}},{id:hT,value:null!==(o=t[hT])&&void 0!==o?o:e[hT]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===Rk.glyph?{glyphType:t.glyphType}:t.type===Rk.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,n,s,r,a;y(t)?this._theme=null!==(e=hC.getTheme(t))&&void 0!==e?e:hC.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(n=null!=o?o:this._options.background)&&void 0!==n?n:this._theme.background),this.padding(null!==(s=null!=l?l:this._options.padding)&&void 0!==s?s:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(nT);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(sT);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(rT);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(aT);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(oT);if(arguments.length){const i=AT(t);return this.updateSignal(e,i),i}return AT(e.output())}autoFit(t){const e=this.getSignalById(hT);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(lT);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=zk.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===Rk.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZT;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{fT(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),fT(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const n=(t=>{var e,i,n,s,r;const{reuse:a=Zk,morph:o=qk,morphAll:l=Jk,animation:h={},enableExitAnimation:c=Qk}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:ow,delay:null!==(i=h.delay)&&void 0!==i?i:nw,duration:null!==(n=h.duration)&&void 0!==n?n:iw,oneByOne:null!==(s=h.oneByOne)&&void 0!==s?s:aw,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),s=this._cachedGrammars.size()>0;s&&(this.reuseCachedGrammars(n),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=zk.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=zk.reevaluate,this._dataflow.evaluate()),this._layoutState=zk.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!ST.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return fT(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=Ie(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;return t!==this.width()&&(n=!0,this.updateSignal(nT,t)),e!==this.height()&&(n=!0,this.updateSignal(sT,e)),n&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eT;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):ww(t)?(i.markType=t,i.source=e):i.source=t===tT?tT:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((_=h).markId)?t=>t&&t.mark.id()===_.markId:u(_.markName)?t=>t&&t.mark.name()===_.markName:u(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,f=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:y(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=cw(l,this),v=kT(((t,e)=>{const n=c===eT&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===tT&&(t=_T(0,t,e,0,tT));let s=!1;if((!i||i(t))&&(!p||p(e))&&f.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});f.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.run()}),{throttle:s,debounce:r});var _;if(c===eT){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||g(n)&&!n[i])}(this._eventConfig,eT,d))return this.addEventListener(d,v,iT),()=>{this.removeEventListener(d,v)}}else if(c===tT)return gg.addEventListener(d,v),this._eventListeners.push({type:d,source:gg,handler:v}),()=>{gg.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===gg&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);y(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=kw.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var n;return u(e)?y(t)?i.type===t:t?i===t:void 0:(null===(n=i.options)||void 0===n?void 0:n.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new mT(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new tC((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new eC((t=>t.id())),this._options.logger&&it.setInstance(this._options.logger),this.logger=it.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new gT,this.animate=new iC(this),this._morph=new QT,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[eT,tT]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:hC.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&gg.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=zk.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==Rk.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gg.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gg.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),kw.unregisterRuntimeTransforms(),it.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}class uC extends cC{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=y(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const pC=(t,e,i,n,s,r)=>{var a;const o=t.getCoordinateAxisPosition();s&&"auto"===s.position&&(s.position=i?"content":o);const l=t.getCoordinateAxisPoints(n);if(l){const n={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();n.center=e.origin(),n.startAngle=t[0],n.endAngle=t[1]}return n}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class gC extends uC{constructor(t,e,i){super(t,Ok.axis,e),this.spec.componentType=Ok.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=kw.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,n)}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=Sw(s,e,i,n);const h=pw(this.spec.inside,n,e,i),c=pw(this.spec.baseValue,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(pC(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=pw(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case Pk.lineAxis:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.axis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p);case Pk.circleAxis:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.circleAxis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?Pk.circleAxis:Pk.lineAxis,this._axisComponentType}}gC.componentType=Ok.axis;let fC=class extends cC{constructor(t,e){super(t,Ok.label,e),this.spec.componentType=Ok.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=W(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=W(t).map((t=>y(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r,a,o;const l=W(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t)),h=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let c=pw(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},s),{labelIndex:e}),u=null!==(a=pw(n,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case Rk.line:case Rk.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case Rk.rect:case Rk.rect3d:case Rk.interval:g=p.rectLabel;break;case Rk.symbol:case Rk.circle:case Rk.cell:g=p.symbolLabel;break;case Rk.arc:case Rk.arc3d:g=p.arcLabel;break;case Rk.polygon:case Rk.path:default:g=p.pointLabel}const f=null!==(o=u.data)&&void 0!==o?o:[],m=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};f&&f.length>0?f.forEach(((e,n)=>{if(t.elements[n]){const s=Sw(i,e,t.elements[n],d);j(e,m,s)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const n=Sw(i,t,e,d);f.push(j({},m,n))}));else{const t=Sw(i,e.getDatum(),e,d),n=j({},m,t);f.push(n)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return j({},g,{data:f,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return j({},o,{size:e,dataLabels:l})}(l,c,n,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};fC.componentType=Ok.label;class mC extends uC{constructor(t,e,i){super(t,Ok.grid,e),this.spec.componentType=Ok.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=y(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=y(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=kw.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,n)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=Sw(n,t,e,i);const d=pw(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(s=this._targetAxis.getSpec())||void 0===s?void 0:s.scale;h=y(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case Lk.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case Lk.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const n=pw(this.spec.inside,i,t,e),s=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);s&&(c=Object.assign(pC(h,s,n,d,this.spec.layout,!0),c))}this._getGridComponentType()===Lk.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=pw(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case Lk.lineAxisGrid:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.grid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p);case Lk.circleAxisGrid:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.circleGrid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=Lk.circleAxisGrid:this._gridComponentType=Lk.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case Pk.circleAxis:this._gridComponentType=Lk.circleAxisGrid;break;case Pk.lineAxis:default:this._gridComponentType=Lk.lineAxisGrid}else if(this.spec.scale){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?Lk.lineAxisGrid:Lk.circleAxisGrid:Lk.lineAxisGrid}else this._gridComponentType=Lk.lineAxisGrid;return this._gridComponentType}}mC.componentType=Ok.grid;const vC=(t,e,i)=>e.filter((e=>t.callback(e,i))),yC=(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!u(s)){if(u(t))return;t[s]=e}return e})),e;const r=n(e,i);return u(s)||u(e)?r:(e[s]=r,e)};function _C(t){return t.reduce(((t,e)=>t+e),0)}const bC={min:X,max:K,average:function(t){return 0===t.length?0:_C(t)/t.length},sum:_C};function xC(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function SC(t,e,i,n,s){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function AC(t,e,i,n){return SC(t,e,i,"min",n)}function kC(t,e,i,n){return SC(t,e,i,"max",n)}function wC(t,e,i,n){return SC(t,e,i,"average",n)}function TC(t,e,i,n){return SC(t,e,i,"sum",n)}const CC=(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:s,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=xC;if("min"===s?l=AC:"max"===s?l=kC:"average"===s?l=wC:"sum"===s&&(l=TC),e.length){const t={};if(a){for(let i=0,n=e.length;i{const r=t[s];if(r.length<=i){const t=r.map((t=>t.i));n=n.concat(t)}else{const t=l(i,r,!0,o);n=n.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const EC=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(hw)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(hw,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(hw,!0),t.setGraphicAttribute("visible",!1)):s=c,r=e}))}}(a,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},MC=()=>{kw.registerTransform("filter",{transform:vC,markPhase:"beforeJoin"},!0)},BC=()=>{kw.registerTransform("map",{transform:yC,markPhase:"beforeJoin"},!0)},RC=()=>{kw.registerTransform("sampling",{transform:CC,markPhase:"afterEncode"},!0)},OC=()=>{kw.registerTransform("markoverlap",{transform:EC,markPhase:"afterEncode"},!0)},IC=(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},PC=(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},LC=(t,e,i)=>{var n,s,r,a;const o=null!==(n=t.getFinalAnimationAttributes())&&void 0!==n?n:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(s=o.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},DC=(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},FC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("width");return{from:p(n)?{x:e+n/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:n}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),n=t.getFinalAnimationAttribute("height");return{from:p(n)?{y:e+n/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:n}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("width"),s=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(n)?(o.x=e+n/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=s+a/2,o.height=0,o.y1=void 0):(o.y=(s+r)/2,o.y1=(s+r)/2,o.height=void 0),{from:o,to:{x:e,y:s,x1:i,y1:r,width:n,height:a}}}}},jC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("width");return{to:p(n)?{x:e+n/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),n=t.getFinalAnimationAttribute("height");return{to:p(n)?{y:e+n/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+n)/2,o.x1=(e+n)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+s)/2,o.y1=(i+s)/2,o.height=void 0),{to:o}}}};const NC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:s,x1:r,width:a}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("x"),s=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{from:{x:t,x1:u(s)?void 0:t,width:u(r)?void 0:0},to:{x:n,x1:s,width:r}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{from:{x:a,x1:u(s)?void 0:a,width:u(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)};const zC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(s)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("x"),s=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{to:{x:t,x1:u(s)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{to:{x:a,x1:u(s)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const VC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:s,y1:r,height:a}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{from:{y:t,y1:u(s)?void 0:t,height:u(r)?void 0:0},to:{y:n,y1:s,height:r}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{from:{y:a,y1:u(s)?void 0:a,height:u(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)};const HC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(s)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{to:{y:t,y1:u(s)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{to:{y:a,y1:u(s)?void 0:a,height:u(r)?void 0:0}}}(t,e)},GC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s,endAngle:s},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==n?void 0:n.endAngle},to:{startAngle:null==n?void 0:n.startAngle}}:{from:{endAngle:null==n?void 0:n.startAngle},to:{endAngle:null==n?void 0:n.endAngle}}})(t,e)},UC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==n?void 0:n.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==n?void 0:n.startAngle}}})(t,e)},WC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAnimationAttributes(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:s,outerRadius:s},to:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:null==n?void 0:n.innerRadius}}:{from:{outerRadius:null==n?void 0:n.innerRadius},to:{outerRadius:null==n?void 0:n.outerRadius}}})(t,e)},YC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==n?void 0:n.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==n?void 0:n.innerRadius}}})(t,e)},KC=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,e&&e.center&&(A(e.center.x)&&(s.x=e.center.x),A(e.center.y)&&(s.y=e.center.y)),"area"===t.mark.markType&&(s.x1=s.x,s.y1=s.y),n.map((t=>Object.assign({},t,s)))},XC=(t,e,i)=>({from:{points:KC(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),$C=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:KC(t,e)}}),ZC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var n;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),qC=(t,e,i)=>({from:{points:ZC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),JC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:ZC(t,e,i)}}),QC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var n;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),tE=(t,e,i)=>({from:{points:QC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),eE=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:QC(t,e,i)}}),iE=(t,e,i)=>{var n,s;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),u=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&A(p.x)?p.x:c,f=p&&A(p.y)?p.y:u,m=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:m}};case"y":return{from:{y:f},to:{y:v}};default:return{from:{x:g,y:f},to:{x:m,y:v}}}},nE=(t,e,i)=>{var n,s;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(n=null==h?void 0:h.width())&&void 0!==n?n:i.width,u=null!==(s=null==h?void 0:h.height())&&void 0!==s?s:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,f=d(l)?l.call(null,t.getDatum(),t,i):l,m=f&&A(f.x)?f.x:p,v=f&&A(f.y)?f.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:m}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:m,y:v}}}},sE=(t,e,i)=>{var n,s,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=null==o?void 0:o.scaleX)&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=null==o?void 0:o.scaleY)&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},rE=(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},aE={symbol:["_mo_hide_","visible"]},oE=(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());let r;e&&W(e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),t.mark&&t.mark.markType&&(r=aE[t.mark.markType])&&r.forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{Gf(t,n,s)&&(delete n[t],delete s[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(n).forEach((t=>{u(s[t])&&(u(a[t])||H(n[t],a[t])?delete n[t]:s[t]=a[t])})),{from:n,to:s}},lE=(t,e,i)=>{var n;const s=null!==(n=t.getFinalAnimationAttribute("angle"))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},hE=(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},cE=()=>{kw.registerAnimationType("clipIn",IC)},dE=()=>{kw.registerAnimationType("clipOut",PC)},uE=()=>{kw.registerAnimationType("fadeIn",LC)},pE=()=>{kw.registerAnimationType("fadeOut",DC)},gE=()=>{kw.registerAnimationType("growCenterIn",FC)},fE=()=>{kw.registerAnimationType("growCenterOut",jC)},mE=()=>{kw.registerAnimationType("growHeightIn",VC)},vE=()=>{kw.registerAnimationType("growHeightOut",HC)},yE=()=>{kw.registerAnimationType("growWidthIn",NC)},_E=()=>{kw.registerAnimationType("growWidthOut",zC)},bE=()=>{kw.registerAnimationType("growPointsIn",XC)},xE=()=>{kw.registerAnimationType("growPointsOut",$C)},SE=()=>{kw.registerAnimationType("growPointsXIn",qC)},AE=()=>{kw.registerAnimationType("growPointsXOut",JC)},kE=()=>{kw.registerAnimationType("growPointsYIn",tE)},wE=()=>{kw.registerAnimationType("growPointsYOut",eE)},TE=()=>{kw.registerAnimationType("growAngleIn",GC)},CE=()=>{kw.registerAnimationType("growAngleOut",UC)},EE=()=>{kw.registerAnimationType("growRadiusIn",WC)},ME=()=>{kw.registerAnimationType("growRadiusOut",YC)},BE=()=>{kw.registerAnimationType("moveIn",iE)},RE=()=>{kw.registerAnimationType("moveOut",nE)},OE=()=>{kw.registerAnimationType("scaleIn",sE)},IE=()=>{kw.registerAnimationType("scaleOut",rE)},PE=()=>{kw.registerAnimationType("rotateIn",lE)},LE=()=>{kw.registerAnimationType("rotateOut",hE)},DE=()=>{kw.registerAnimationType("update",oE)},FE=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var jE,NE,zE;t.ChartEvent=void 0,(jE=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",jE.rendered="rendered",jE.renderFinished="renderFinished",jE.animationFinished="animationFinished",jE.regionSeriesDataFilterOver="regionSeriesDataFilterOver",jE.afterInitData="afterInitData",jE.afterInitEvent="afterInitEvent",jE.afterInitMark="afterInitMark",jE.rawDataUpdate="rawDataUpdate",jE.viewDataFilterOver="viewDataFilterOver",jE.viewDataUpdate="viewDataUpdate",jE.viewDataStatisticsUpdate="viewDataStatisticsUpdate",jE.markDeltaYUpdate="markDeltaYUpdate",jE.viewDataLabelUpdate="viewDataLabelUpdate",jE.scaleDomainUpdate="scaleDomainUpdate",jE.scaleUpdate="scaleUpdate",jE.dataZoomChange="dataZoomChange",jE.drill="drill",jE.layoutStart="layoutStart",jE.layoutEnd="layoutEnd",jE.layoutRectUpdate="layoutRectUpdate",jE.playerPlay="playerPlay",jE.playerPause="playerPause",jE.playerEnd="playerEnd",jE.playerChange="playerChange",jE.playerForward="playerForward",jE.playerBackward="playerBackward",jE.scrollBarChange="scrollBarChange",jE.brushStart="brushStart",jE.brushChange="brushChange",jE.brushEnd="brushEnd",jE.brushClear="brushClear",jE.legendSelectedDataChange="legendSelectedDataChange",jE.legendFilter="legendFilter",jE.legendItemClick="legendItemClick",jE.legendItemHover="legendItemHover",jE.legendItemUnHover="legendItemUnHover",jE.tooltipShow="tooltipShow",jE.tooltipHide="tooltipHide",jE.tooltipRelease="tooltipRelease",jE.afterResize="afterResize",jE.afterRender="afterRender",jE.afterLayout="afterLayout",t.Event_Source_Type=void 0,(NE=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",NE.window="window",NE.canvas="canvas",t.Event_Bubble_Level=void 0,(zE=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",zE.chart="chart",zE.model="model",zE.mark="mark";const VE=`${ck}_waterfall_default_seriesField`,HE=`${ck}_CORRELATION_X`,GE=`${ck}_CORRELATION_Y`,UE=`${ck}_CORRELATION_SIZE`,WE=`${ck}_MEASURE_CANVAS_ID`,YE=`${ck}_DEFAULT_DATA_INDEX`,KE=`${ck}_DEFAULT_DATA_KEY`,XE=`${ck}_DEFAULT_DATA_SERIES_FIELD`,$E=`${ck}_DEFAULT_SERIES_STYLE_NAME`;var ZE;t.AttributeLevel=void 0,(ZE=t.AttributeLevel||(t.AttributeLevel={}))[ZE.Default=0]="Default",ZE[ZE.Theme=1]="Theme",ZE[ZE.Chart=2]="Chart",ZE[ZE.Base_Series=3]="Base_Series",ZE[ZE.Series=4]="Series",ZE[ZE.Mark=5]="Mark",ZE[ZE.User_Chart=6]="User_Chart",ZE[ZE.User_Series=7]="User_Series",ZE[ZE.User_Mark=8]="User_Mark",ZE[ZE.User_SeriesStyle=9]="User_SeriesStyle",ZE[ZE.Built_In=99]="Built_In";const qE=`${ck}_STACK_KEY`,JE=`${ck}_STACK_START`,QE=`${ck}_STACK_END`,tM=`${ck}_STACK_START_PERCENT`,eM=`${ck}_STACK_END_PERCENT`,iM=`${ck}_STACK_START_OffsetSilhouette`,nM=`${ck}_STACK_END_OffsetSilhouette`,sM=`${ck}_STACK_TOTAL`,rM=`${ck}_STACK_TOTAL_PERCENT`,aM=`${ck}_STACK_TOTAL_TOP`,oM=`${ck}_SEGMENT_START`,lM=`${ck}_SEGMENT_END`;var hM,cM;t.LayoutZIndex=void 0,(hM=t.LayoutZIndex||(t.LayoutZIndex={}))[hM.Axis_Grid=50]="Axis_Grid",hM[hM.CrossHair_Grid=100]="CrossHair_Grid",hM[hM.Region=450]="Region",hM[hM.Mark=300]="Mark",hM[hM.Node=400]="Node",hM[hM.Axis=100]="Axis",hM[hM.MarkLine=500]="MarkLine",hM[hM.MarkArea=100]="MarkArea",hM[hM.MarkPoint=500]="MarkPoint",hM[hM.DataZoom=500]="DataZoom",hM[hM.ScrollBar=500]="ScrollBar",hM[hM.Player=500]="Player",hM[hM.Legend=500]="Legend",hM[hM.CrossHair=500]="CrossHair",hM[hM.Indicator=500]="Indicator",hM[hM.Title=500]="Title",hM[hM.Label=500]="Label",hM[hM.Brush=500]="Brush",hM[hM.CustomMark=500]="CustomMark",hM[hM.Interaction=700]="Interaction",t.LayoutLevel=void 0,(cM=t.LayoutLevel||(t.LayoutLevel={}))[cM.Indicator=10]="Indicator",cM[cM.Region=20]="Region",cM[cM.Axis=30]="Axis",cM[cM.DataZoom=40]="DataZoom",cM[cM.Player=40]="Player",cM[cM.ScrollBar=40]="ScrollBar",cM[cM.Legend=50]="Legend",cM[cM.Title=70]="Title",cM[cM.CustomMark=70]="CustomMark";const dM=["linear","radial","conical"],uM={x0:0,y0:0,x1:1,y1:1},pM={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},gM={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},fM={linear:uM,radial:pM,conical:gM},mM={label:{name:"label",type:"text"}},vM=`${ck}_rect_x`,yM=`${ck}_rect_x1`,_M=`${ck}_rect_y`,bM=`${ck}_rect_y1`,xM={data:!0},SM={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},AM=Object.assign(Object.assign({},mM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),kM=Object.assign(Object.assign({},mM),{bar3d:{name:"bar3d",type:"rect3d"}}),wM={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},TM=Object.assign(Object.assign({},mM),wM),CM=Object.assign(Object.assign({},mM),{point:{name:"point",type:"symbol"}}),EM=Object.assign(Object.assign(Object.assign({},mM),wM),{area:{name:"area",type:"area"}}),MM=Object.assign(Object.assign(Object.assign({},mM),wM),{area:{name:"area",type:"area"}}),BM=Object.assign(Object.assign({},mM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),RM=Object.assign(Object.assign({},mM),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),OM=Object.assign(Object.assign({},mM),{rose:{name:"rose",type:"arc"}}),IM=Object.assign(Object.assign({},mM),{area:{name:"area",type:"path"}}),PM=Object.assign(Object.assign({},mM),{group:{name:"group",type:"group"}}),LM=Object.assign(Object.assign({},PM),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),DM=Object.assign(Object.assign({},mM),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),FM=Object.assign(Object.assign({},mM),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),jM=Object.assign(Object.assign({},mM),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),NM=Object.assign(Object.assign({},mM),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),zM=Object.assign(Object.assign({},mM),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),VM=Object.assign(Object.assign({},mM),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),HM=Object.assign(Object.assign({},AM),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),GM=Object.assign(Object.assign({},mM),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),UM=Object.assign(Object.assign({},mM),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),WM=Object.assign(Object.assign({},mM),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),YM=Object.assign(Object.assign({},PM),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),KM=Object.assign(Object.assign({},mM),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),XM=Object.assign(Object.assign({},mM),{sunburst:{name:"sunburst",type:"arc"}}),$M=Object.assign(Object.assign({},AM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),ZM=Object.assign(Object.assign({},kM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),qM=Object.assign(Object.assign({},mM),{circlePacking:{name:"circlePacking",type:"arc"}}),JM=Object.assign(Object.assign({},mM),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),QM=Object.assign(Object.assign({},mM),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),tB=Object.assign({},EM),eB=Object.assign(Object.assign({},mM),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),iB=Object.assign(Object.assign({},mM),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var nB;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(nB||(nB={}));const sB={[lk.bar]:AM,[lk.bar3d]:kM,[lk.line]:TM,[lk.scatter]:CM,[lk.area]:EM,[lk.radar]:MM,[lk.pie]:BM,[lk.pie3d]:RM,[lk.rose]:OM,[lk.geo]:mM,[lk.map]:IM,[lk.circularProgress]:LM,[lk.link]:DM,[lk.dot]:FM,[lk.wordCloud]:jM,[lk.wordCloud3d]:jM,[lk.funnel]:NM,[lk.funnel3d]:zM,[lk.linearProgress]:VM,[lk.waterfall]:HM,[lk.boxPlot]:GM,[lk.treemap]:UM,[lk.sankey]:WM,[lk.gauge]:YM,[lk.gaugePointer]:KM,[lk.sunburst]:XM,[lk.rangeColumn]:$M,[lk.rangeColumn3d]:ZM,[lk.circlePacking]:qM,[lk.heatmap]:JM,[lk.correlation]:QM,[lk.rangeArea]:tB,[lk.liquid]:eB,[lk.venn]:iB};function rB(t){var e,i;const{type:n}=t;return n===lk.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const aB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},oB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function lB(t,e){var i;if(!t)return[];const n=fB(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?pB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>uB(i)?cB(t,i,e):i)).filter(p)}))):i.map((i=>uB(i)?cB(t,i,e):i)).filter(p):[]}return[]}function hB(t,e){var i,n;return pB(t)?null!==(n=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function cB(t,e,i){var n;const s=fB(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=aB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=oB[e];return n?t[n]:void 0}(a,e.key))&&void 0!==n?n:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new re(r);if(p(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=qt(t,i,n),a=Zt(s,r,e.l),l=new re(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const dB=(t,e,i)=>{if(e&&uB(t)){const n=cB(e,t,i);if(n)return n}return t};function uB(t){return t&&"palette"===t.type&&!!t.key}function pB(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function gB(t){return _(t)?{dataScheme:t}:t}function fB(t,e){var i,n;const{type:s}=null!=e?e:{};let r;if(!e||u(s))r=null==t?void 0:t.default;else{const a=rB(e);r=null!==(n=null!==(i=null==t?void 0:t[`${s}_${a}`])&&void 0!==i?i:null==t?void 0:t[s])&&void 0!==n?n:null==t?void 0:t.default}return r}class mB extends GS{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!pB(this._range))return void super.range(this._range);const t=hB(this._range,this._domain);super.range(t)}}const vB={linear:uA,band:WS,point:class extends WS{constructor(t){super(!1),this.type=mS.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:GS,threshold:vA,colorOrdinal:mB};function yB(t){const e=vB[t];return e?new e:null}function _B(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function bB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function xB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function SB(t){return!!y(t)&&(!!t.endsWith("%")&&Lf(t.substring(0,t.length-1)))}function AB(t,e,i,n=0){var s,r;return S(t)?t:SB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(s=t.percent)&&void 0!==s?s:0)+(null!==(r=t.offset)&&void 0!==r?r:0):n}function kB(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((n=>{o[n]=AB(t[n],e.size,i)}))})),o}function wB(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||SB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function TB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const CB=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i},EB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],MB={default:{dataScheme:EB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},BB="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",RB={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:BB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:BB,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},OB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},IB=Object.assign(Object.assign({},OB),{label:{space:0}}),PB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},LB="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",DB={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:LB,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:LB,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},FB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},jB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},NB={horizontal:Object.assign(Object.assign({},FB),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:jB}),vertical:Object.assign(Object.assign({},FB),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:jB})},zB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},VB={horizontal:Object.assign(Object.assign({},FB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:zB}),vertical:Object.assign(Object.assign({},FB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:zB})},HB={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},GB={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},UB={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function WB(t,e){return t&&e.key in t?t[e.key]:e.default}function YB(t){return t&&"token"===t.type&&!!t.key}const KB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},XB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:MB,token:KB,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:RB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:NB,sizeLegend:VB,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:OB,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:IB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:GB,markArea:HB,markPoint:UB,polarMarkLine:GB,polarMarkArea:HB,polarMarkPoint:UB,geoMarkPoint:UB,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:DB,crosshair:PB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},$B={name:"dark",colorScheme:{default:{dataScheme:EB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},ZB=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>ZB(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>ZB(t[i],e[i])))),qB=(t,e,i)=>{if(u(e))return t;const n=e[0];return u(n)?t:1===e.length?(t[n]=i,t):(u(t[n])&&("number"==typeof e[1]?t[n]=[]:t[n]={}),qB(t[n],e.slice(1),i))};function JB(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let n;if(!p(i)||"object"!=typeof i)return i;if(i instanceof fi||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}(i))return i;const s=_(i),r=i.length;n=s?new Array(r):"object"==typeof i?{}:c(i)||S(i)||y(i)?i:x(i)?new Date(+i):void 0;const a=s?void 0:Object.keys(Object(i));let o=-1;if(n)for(;++o<(a||i).length;){const t=a?a[o]:o,s=i[t];(null==e?void 0:e.includes(t.toString()))?n[t]=s:n[t]=JB(s,e)}return n}function QB(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];p(n[r])&&"object"==typeof n[r]&&!_(t[r])?tR(t,e,r,i):eR(t,r,n[r])}}}}function tR(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(_(r)){if(n)a=[];else if(_(s))a=s;else if(b(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{if(g(e))e.type===s&&(_(t[s])?t[s].length>=e.index&&(t[s][e.index]=n?iR({},t[s][e.index],i):i):t[s]=n?iR({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?iR({},t[s][r],i):i)}else t.id===e&&(t[s]=n?iR({},t[s],i):i)}))}function sR(t,...e){return iR(rR(t),...e.map(rR))}function rR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const n=t[i];return e[i]=gB(n),e}),{}));return t}(t.colorScheme),{series:n}=t,{mark:s,markByName:r}=t;let a;return(s||r)&&(a=Object.keys(sB).reduce(((t,e)=>{var i;const a=null!==(i=null==n?void 0:n[e])&&void 0!==i?i:{};return t[e]=aR(a,e,s,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function aR(t,e,i,n){if(!sB[e])return t;const s={};return Object.values(sB[e]).forEach((({type:e,name:r})=>{s[r]=iR({},null==i?void 0:i[W(e)[0]],null==n?void 0:n[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),s)}const oR=["animationThreshold","colorScheme","name","padding"];function lR(t,e,i,n){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((r=>{const a=t[r];oR.includes(r)?s[r]=a:m(a)?uB(a)?s[r]=dB(a,e,n):YB(a)?s[r]=WB(i,a):s[r]=lR(a,e,i,n):s[r]=a})),s}const hR={[XB.name]:XB},cR=XB.name,dR=new Map(Object.keys(hR).map((t=>[t,hR[t]]))),uR=new Map(Object.keys(hR).map((t=>[t,lR(hR[t])]))),pR=new Map(Object.keys(hR).map((t=>[t,t===cR]))),gR=(t,e)=>{if(!t)return;const i=yR(e);dR.set(t,i),uR.set(t,lR(i)),pR.set(t,!0)},fR=(t=cR,e=!1)=>(pR.has(t)&&!pR.get(t)&&gR(t,dR.get(t)),e?uR.get(t):dR.get(t)),mR=t=>dR.delete(t)&&uR.delete(t)&&pR.delete(t),vR=t=>!!y(t)&&dR.has(t),yR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:cR;return sR({},fR(i),t)};class _R{static registerInstance(t){_R.instances.set(t.id,t)}static unregisterInstance(t){_R.instances.delete(t.id)}static getInstance(t){return _R.instances.get(t)}static instanceExist(t){return _R.instances.has(t)}static forEach(t,e=[],i){const n=W(e);return _R.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}_R.instances=new Map;class bR{static registerTheme(t,e){gR(t,e)}static getTheme(t,e=!1){return fR(t,e)}static removeTheme(t){return mR(t)}static themeExist(t){return vR(t)}static getDefaultTheme(){return bR.themes.get(cR)}static setCurrentTheme(t){bR.themeExist(t)&&(bR._currentThemeName=t,_R.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return bR.getTheme(bR._currentThemeName,t)}static getCurrentThemeName(){return bR._currentThemeName}}function xR(t,e){return y(t)?bR.themeExist(t)?bR.getTheme(t,e):{}:g(t)?t:{}}function SR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=SR(t[n],e)}return i}return _(t)?t.map((t=>SR(t,e))):t}function AR(t,e){if(!t)return t;if(m(t)){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(y(t[n])&&e.getFunction(t[n])){i[n]=e.getFunction(t[n]);continue}i[n]=AR(t[n],e)}return i}return _(t)?t.map((t=>AR(t,e))):t}bR.themes=dR,bR._currentThemeName=cR;function kR(t,e){for(let i=0;it.key===e))}function TR(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}function CR(t,e,i){const n=t.getStackSort(),s={};let r=null;return n&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var n;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(s[o]=null!==(n=s[o])&&void 0!==n?n:{nodes:{}},OR(t,a,s[o],l,e,r))})),n?ER(s):s}function ER(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):ER(t[e].nodes);return t}function MR(t,e){if("values"in t&&t.values.length){const i=function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return A(n)&&(t+=n),t}),0)}(t.values,e),n=function(t,e){const i=[];return t.forEach((t=>{const n=+t[e];A(n)&&i.push(n)})),0===i.length?null:K(i)}(t.values,eM);t.values.forEach((t=>{t[sM]=i,t[rM]=n,delete t[aM]}));const s=t.values.reduce(((t,e)=>e[QE]>t[QE]?e:t));s[aM]=!0}else for(const i in t.nodes)MR(t.nodes[i],e)}function BR(t){if(!t.values.length)return;const e=t.values[t.values.length-1][QE]/2;for(let i=0;i0){let n=0,s=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[JE]=n,n+=r[QE],r[QE]=n):(r[JE]=s,s+=r[QE],r[QE]=s),r[qE]=t.key}if(i)for(let i=0;i=0?n:s;r=a>=0?1:-1,l[tM]=0===h?0:Math.min(1,l[JE]/h)*r,l[eM]=0===h?0:Math.min(1,l[QE]/h)*r}}for(const n in t.nodes)RR(t.nodes[n],e,i)}function OR(t,e,i,n,s,r,a){if("values"in e)if(s&&e.values.forEach((t=>t[QE]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[n]))),i.series.push({s:t,values:e.values}),r){const n=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:n?r[n].sort[e[n]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),OR(t,e.nodes[o],i.nodes[o],n,s,r,l)}}function IR(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,n,s)=>LR(t.style(e,i,n,s)):B(t.style)||(e.style=LR(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,n,s,r)=>LR(t.state[e](i,n,s,r)):B(t.state[e])||(i[e]=LR(t.state[e]))})),e.state=i}return e}function PR(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,n,s,r)=>LR(t[i](e,n,s,r)):B(t[i])||(e[i]=LR(t[i]))})),e}function LR(t){return(null==t?void 0:t.angle)&&(t.angle=Gt(t.angle)),t}class DR{static registerChart(t,e){DR._charts[t]=e}static registerSeries(t,e){DR._series[t]=e}static registerComponent(t,e,i){DR._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){DR._marks[t]=e}static registerRegion(t,e){DR._regions[t]=e}static registerTransform(t,e){DR.transforms[t]=e}static registerLayout(t,e){DR._layout[t]=e}static registerAnimation(t,e){DR._animations[t]=e}static registerImplement(t,e){DR._implements[t]=e}static registerChartPlugin(t,e){DR._chartPlugin[t]=e}static registerComponentPlugin(t,e){DR._componentPlugin[t]=e}static createChart(t,e,i){if(!DR._charts[t])return null;return new(0,DR._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!DR._charts[t])return null;const i=DR._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!DR._regions[t])return null;return new(0,DR._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!DR._regions[t])return null;return new(0,DR._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!DR._series[t])return null;return new(0,DR._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!DR._series[t])return null;return new(0,DR._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!DR._marks[t])return null;const n=new(0,DR._marks[t])(e,i);return"group"===n.type&&n.setInteractive(!1),n}static getComponents(){return Object.values(DR._components)}static getComponentInKey(t){return DR._components[t].cmp}static getLayout(){return Object.values(DR._layout)}static getLayoutInKey(t){return DR._layout[t]}static getSeries(){return Object.values(DR._series)}static getSeriesInType(t){return DR._series[t]}static getRegionInType(t){return DR._regions[t]}static getAnimationInKey(t){return DR._animations[t]}static getImplementInKey(t){return DR._implements[t]}static getSeriesMarkMap(t){return DR._series[t]?DR._series[t].mark:{}}static getChartPlugins(){return Object.values(DR._chartPlugin)}static getComponentPlugins(){return Object.values(DR._componentPlugin)}static getComponentPluginInType(t){return DR._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}DR._charts={},DR._series={},DR._components={},DR._marks={},DR._regions={},DR._animations={},DR._implements={},DR._chartPlugin={},DR._componentPlugin={},DR.transforms={fields:Ze,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},DR.dataParser={csv:li,dsv:oi,tsv:hi},DR._layout={};const FR=(t,e)=>{var i,n;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},jR=(t,e,i,n)=>{var s;const r=kS(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=W(n(l)),o=null===(s=l.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r){const e=[],n=[];o.forEach(((s,r)=>{var a;(null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(s),n.push(r))})),a.push({series:l,datum:e,key:NR(l,n)})}else if(p(i[1])){const e=[],n=[];o.forEach(((s,r)=>{var a;((null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(s[i[0]])&&p(s[i[1]])&&t>=s[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=s[0]&&a<=s[1]&&(r.push(e),h.push(n))}}));else{let e=1/0,n=0;o.forEach(((s,a)=>{if(p(s[i[0]])){const o=Math.abs(s[i[0]]-t),l=Math.sign(s[i[0]]-t);o`${t.id}_${e.join("_")}`,zR=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(W(e.layout.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))})(t,n,i)));return n.length?n:null},VR=(t,e)=>{if(!t)return null;if(!ak(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:n}=e,s=zR(t,(t=>"angle"===t.getOrient()),e),r=zR(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return s&&s.forEach((t=>{var e;const s=t.getScale();if(s&&kS(s.type)){const l=s.domain(),h=s.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:n-t.getLayoutStartPoint().y-c.y};let p=nk({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,n=X(e),s=K(e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,h);const g=sk(d),f=null===(e=r[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=jR(v,t,"polar",o);a.push({index:y,value:v,position:s.scale(v),axis:t,data:_})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&kS(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:n-t.getLayoutStartPoint().y-h.y};let d=nk({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=sk(c),g=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=r.invert(p);if(u(m))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=jR(m,t,"polar",o);a.push({index:v,value:m,position:r.scale(m),axis:t,data:y})}})),a.length?a:null};function HR(t){return"bottom"===t||"top"===t}function GR(t){return"left"===t||"right"===t}function UR(t){return"z"===t}function WR(t,e){return xB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function YR(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?HR(t)?"linear":"band":HR(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const KR=t=>t.fieldX[0],XR=t=>t.fieldY[0],$R=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},ZR=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},qR=(t,e)=>t?e?KR:$R:e?XR:ZR,JR=(t,e,i)=>{var n,s;if(!t)return null;if(!ak(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(n=zR(t,(t=>HR(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=zR(t,(t=>GR(t.getOrient())),e))&&void 0!==s?s:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{kS(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((n=>{if(d.size>0){if(d.has(n)){const s=QR(n,i,t,qR(e,kS(n.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(n)){const r=QR(n,i,t,qR(e,s));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},QR=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return tO(t,a,n)},tO=(t,e,i)=>{const n=t.getScale();if(u(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=jR(e,t,"cartesian",null!=i?i:HR(t.getOrient())?KR:XR);return{index:s,value:e,position:n.scale(e),axis:t,data:r}};class eO{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,n;(null!==(n=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:Tf)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Tf)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=JR(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=VR(this.chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),s=n.filter((t=>kS(t.getScale().type))),r=s.length?s:n.filter((t=>{const e=t.getOrient();return HR(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=tO(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var iO;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(iO||(iO={}));const nO={[iO.dimensionHover]:class extends eO{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!FR(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:n.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:n.slice()})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),Rf(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Rf(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[iO.dimensionClick]:class extends eO{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:n.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let sO=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(nO[t]){const e=new nO[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(nO[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class rO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const aO={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class oO{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),n=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let n=null;i.elements&&(n=i.elements);const s={event:t.event,chart:e,items:n,datums:n&&n.map((t=>t.getDatum()))};this.dispatch(t.type,s)},this.globalInstance=t,this._compiler=e}register(e,i){var n,s,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new rO);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var n,s,r,a;let o=!1;const l=this.getEventBubble((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const n=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,n),h.delete(e)}return this}dispatch(e,i,n){const s=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!s)return this;let r=!1;if(n){const t=s.getHandlers(n);r=this._invoke(t,e,i)}else{const n=s.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(n,e,i),!r){const n=s.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(n,e,i)}if(!r){const n=s.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(n,e,i)}if(!r){const n=s.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(n,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const n=this.getEventBubble(i).get(t);n&&n.getAllHandlers().forEach((t=>{e&&t.callback===e||n.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var n,s,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return aO[a]&&(a=aO[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(n=t.query)||void 0===n?void 0:n.consume;return o&&(null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return n.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const n=e.query;(null==n?void 0:n.throttle)?e.wrappedCallback=ft(e.callback,n.throttle):(null==n?void 0:n.debounce)&&(e.wrappedCallback=gt(e.callback,n.debounce));let s=this._getQueryLevel(n),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==n?void 0:n.nodeName)&&(o=n.nodeName),(null==n?void 0:n.markName)&&(l=n.markName),!(null==n?void 0:n.type)||s!==t.Event_Bubble_Level.model&&s!==t.Event_Bubble_Level.mark||(r=n.type),(null==n?void 0:n.source)&&(a=n.source),p(null==n?void 0:n.id)&&(h=null==n?void 0:n.id,s=t.Event_Bubble_Level.model),e.filter={level:s,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==n?void 0:n.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return FE.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kw.hasInteraction(e)}}function lO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function hO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const cO=new Map;function dO(t,e=!1){let i=e;return t.latestData instanceof fi&&(i=!1),i?P(t.latestData):t.latestData.slice()}const uO=(t,e)=>0===t.length?[]:1===t.length?dO(t[0],null==e?void 0:e.deep):t.map((t=>dO(t,null==e?void 0:e.deep)));function pO(t,e,i){lO(e=e instanceof pi?e:t.dataSet,"copyDataView",uO);const n=new fi(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView",level:mO.copyDataView}),n}function gO(t,e,i=[],n={}){var s,r,a;if(t instanceof fi)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?P(t.parser):{clone:!0},p=P(t.fields);let g;u.clone=!(!1===u.clone);const f=i.find((t=>t.name===o));if(f)g=f;else{const t={name:o};if(p&&(t.fields=p),g=new fi(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(s=n.onError)&&void 0!==s?s:Tf)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=n.onError)&&void 0!==r?r:Tf)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!y(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),wf("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function fO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var mO;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(mO||(mO={}));const vO=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._view)return;const s=new it(null!==(t=this._option.logLevel)&&void 0!==t?t:et.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&s.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new dC(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(n=this._container.canvas)&&void 0!==n?n:null,hooks:this._option.performanceHook},this._option),{mode:SO(this._option.mode),autoFit:!1,eventConfig:{gesture:Rf(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:s,logLevel:s.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const n=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,s=t[n];t[n]=s?Object.assign(Object.assign(Object.assign({},s),e),{selector:[...s.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const n=this._compileChart.getRegionsInIds([t[e].regionId])[0];n&&n.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(gg.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=gg.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,n){var s,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};n.call(null,g)}.bind(this);this._viewListeners.set(n,{type:i,callback:t}),null===(s=this._view)||void 0===s||s.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const s={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};n.call(null,s)}.bind(this);this._windowListeners.set(n,{type:i,callback:t});const s=this._getGlobalThis();null==s||s.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const s={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};n.call(null,s)}.bind(this);this._canvasListeners.set(n,{type:i,callback:t});const s=null===(r=this.getStage())||void 0===r?void 0:r.window;null==s||s.addEventListener(i,t)}}removeEventListener(e,i,n){var s,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(s=this._viewListeners.get(n))||void 0===s?void 0:s.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(n)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(n))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(n)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(n))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(n)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),n=t.grammarType;u(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(u(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return Bf(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function kO(t,e){var n;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(n=null==e?void 0:e.onError)&&void 0!==n?n:Tf)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function wO(t){t.crosshair=W(t.crosshair||{}).map((e=>iR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function TO(t,e,i){var n;const{width:s,height:r}=t;if(p(s)&&p(r))return{width:s,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Ie(l,i.width,i.height);a=t,o=e}else if(h&&Bf(e.mode)){let t;t=y(h)?gg.getElementById(h):h;const{width:e,height:n}=Ie(t,i.width,i.height);a=e,o=n}else if(Of(e.mode)&&(null===(n=e.modeParams)||void 0===n?void 0:n.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=s?s:a,o=null!=r?r:o,{width:a,height:o}}function CO(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme")}),t}function EO(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(bO||(bO={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(xO||(xO={}));class MO{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},MO.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=W(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}MO.defaultMarkInfo={};class BO{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new MO,this._markReverse=new MO,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(bO.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(bO.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(bO.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(bO.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(bO.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(bO.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[bO.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[bO.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(iO.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct();if(!s||!s.elements)return;const r=s.elements.filter((i=>{const n=i.getDatum();let s;return s=_(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s}));i.push(...r)}))}))})),i}}const RO={};Object.values(bO).forEach((t=>{RO[t]=!0}));const OO={[bO.STATE_HOVER]:bO.STATE_HOVER_REVERSE,[bO.STATE_SELECTED]:bO.STATE_SELECTED_REVERSE,[bO.STATE_DIMENSION_HOVER]:bO.STATE_DIMENSION_HOVER_REVERSE};function IO(t){return OO[t]}class PO{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const n=IO(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;if(this._disableTriggerEvent)return;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=IO(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=IO(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=IO(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class LO{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class DO extends LO{constructor(){super(...arguments),this.id=Pf(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class FO extends DO{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=_O.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class jO extends LO{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new FO(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class NO extends jO{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){if(t&&(j(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class zO extends NO{constructor(){super(...arguments),this.id=Pf(),this.stateKeyToSignalName=t=>`${ck}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===yO.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===yO.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?yO.none:yO.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?yO.exit:"update"===e.diffState?yO.update:yO.appear}}}}class VO{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>iR({},i,n,t);return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class HO extends LO{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=VO,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new MO,this._lastLayoutRect=null,this.id=Pf(),this.userId=t.id,this._spec=t,this.effect={},this.event=new sO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var n;null===(n=this._layout)||void 0===n||n.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${ck}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:n}=t,s=DR.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class GO{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var n;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(n=null==e?void 0:e.getSpec)||void 0===n?void 0:n.call(e)}_setLayoutAttributeFromSpec(t,e){var i,n,s,r;if(this._spec&&!1!==this._spec.visible){const a=kB(wB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:AB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:AB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:AB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:AB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:AB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:AB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=AB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=AB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,s,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=AB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(n)||(r.width-=n),u(s)||(r.width-=s),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(n)?u(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,s,r,a;A(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class UO extends HO{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new GO(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&H(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(n=this._spec.orient)&&void 0!==n?n:this._orient,this.layoutLevel=null!==(s=this._spec.layoutLevel)&&void 0!==s?s:this.layoutLevel}}class WO extends VO{_initTheme(t,e){return{spec:t,theme:this._theme}}}class YO extends UO{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var n;super(e,i),this.transformerConstructor=WO,this.modelType="region",this.specKey="region",this.type=YO.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new PO,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(n=e.coordinate)&&void 0!==n?n:"cartesian",this._option.animation&&(this.animate=new zO({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,n){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(n);const o=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return H(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||W(t.userId).includes(e.userId))&&(!p(t.specIndex)||W(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new BO(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in xO)B(t.stateStyle[xO[e]])||this.interaction.registerMark(xO[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function KO(t){const e=[],i=[],n=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&n.push(t)})),{startItems:e,endItems:n,middleItems:i}}function XO(t,e,i){e?t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+s})}))})):t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+s,y:t.getLayoutStartPoint().y})}))}))}function $O(t,e,i,n){let s;t.forEach(((t,r)=>{t.length>1&&(s=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?s-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):s-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+n*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+n*a*r})})))}))}function ZO(t,e,i,n,s){if(t.length){let r=0;const a="right"===s,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const n=e.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(n);t.setLayoutRect(s);const p=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),$O(c,!0,u,o),n&&XO(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function qO(t,e,i,n){if(t.length){let i=0;const s="right"===n,r=s?-1:1;let a=s?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const n=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(n);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=s?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const n=e.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(n);t.setLayoutRect(s);const p=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=r?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),$O(c,!1,u,a),n&&XO(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function QO(t,e,i,n){if(t.length){const i="top"===n,s=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const n=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(n);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),n=t.filter((t=>"region-relative-overlap"===t.layoutType)),s=i.concat(n),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:s,overlapItems:r}}layoutItems(t,e,i,n){this._layoutInit(t,e,i,n),this._layoutNormalItems(e);const s={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,s),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r){if(s.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(s,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,n))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=KO(t);n.length&&ZO(n,e,i,!1,"left"),s.length&&ZO(s,e,i,!0,"left"),r.length&&qO(r,e,0,"left")}(e,this,a),n.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=KO(t);n.length&&JO(n,e,i,!1,"top"),s.length&&JO(s,e,i,!0,"top"),r.length&&QO(r,e,0,"top")}(n,this,r),i.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=KO(t);n.length&&ZO(n,e,i,!1,"right"),s.length&&ZO(s,e,i,!0,"right"),r.length&&qO(r,e,0,"right")}(i,this,a),s.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=KO(t);n.length&&JO(n,e,i,!1,"bottom"),s.length&&JO(s,e,i,!0,"bottom"),r.length&&QO(r,e,0,"bottom")}(s,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);e.rect.width=Math.max(n.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(n.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),s=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:s,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let s=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",n.left),this._layoutRelativeOverlap("right",n.right),s=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",n.top),this._layoutRelativeOverlap("bottom",n.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,s,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-s})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.getModelId()===e));return n||(null!==(i=this._onError)&&void 0!==i?i:Tf)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const n="left"===t.layoutOrient||"right"===t.layoutOrient,s=t.getLastComputeOutBounds(),r=this._getOutInLayout(s,t,e);n?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:n,y:s}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+r+t.x2-i.right,top:i.top-(s-t.y1),bottom:s+a+t.y2-i.bottom}}}tI.type="base";const eI=["line","area","trail"];function iI(t){return eI.includes(t)}class nI extends NO{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];p(n.domain)&&(s.domain=n.domain),p(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=c(iI)?n:!t.mark||iI(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),a=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),a=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!RO[t])).map((t=>[t,10])),n=!t.mark||iI(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(_(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(ck)));n=t.datums.some((t=>i&&_(null==t?void 0:t.items)?e.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(ck)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(SS(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class sI extends DO{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=_O.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const n=this.getVGrammarView();if(!n||!t)return;const s=this.getProductId();this._product=null===(i=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.call(n,t))||void 0===i?void 0:i.id(s),this._compiledProductId=s}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class rI extends sI{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${ck}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class aI extends DO{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,n){super(e),this.grammarType=_O.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=n,this.key=e.key,this.state=new nI(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new sO(n.getOption().eventDispatcher,n.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new rI(t)}stateKeyToSignalName(t){return`${ck}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=bO.STATE_NORMAL,n=t[i];e(t,["symbol"==typeof i?i:i+""]);const s=this._option.noSeparateStyle?null:{},r={};return Object.keys(n).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!d(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,n,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:s[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:s,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=bO.STATE_NORMAL;t[i];const n=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:s,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",s,!0),Object.keys(n).forEach((t=>{const e={};Object.keys(n[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,n,s;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(n=(i=this.model).getRegion)||void 0===n?void 0:n.call(i);r=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var n;return null===(n=i[r])||void 0===n?void 0:n.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===yO.appear&&this.runAnimationByState(yO.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(yO.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),n={mark:null,parent:null,element:null};return(t,e)=>(n.mark=e.mark,n.parent=e.mark.group,n.element=e,i(t,n))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class oI extends aI{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,n=i.range();return i.range(n.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Gt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(u(t))return;void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);if(s)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,i)(e,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;p(a)&&a<=n&&iR(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(AS(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=yB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];n||(n=this.stateStyle.normal[t]);const s=this._computeStateAttribute(n,t,e),r=d(null==n?void 0:n.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=s(r,a);return o=n.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>n.postProcess(s(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(n,r)=>i(t,n,e,r,s(n,r))}return s}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):dM.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):AS(null===(n=t.style.scale)||void 0===n?void 0:n.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,n){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const s=e.state;s&&Object.keys(s).forEach((e=>{const n=s[e];if("style"in n){const s=n.style;let r={stateValue:e};"level"in n&&(r.level=n.level),"filter"in n&&(r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r)),this.state.addStateInfo(r),this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,n;const{gradient:s,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=hB(lB(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(i=this.model).getSpec)||void 0===n?void 0:n.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},fM[s]),o);return(t,e)=>{const i={},n=this.getDataView();return Object.keys(u).forEach((s=>{const r=u[s];"stops"===s?i.stops=r.map((i=>{const{opacity:s,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,n)),p(s)&&(o=re.SetOpacity(o,s)),{offset:d(a)?a(t,this._attributeContext,e,n):a,color:o||c[0]}})):d(r)?i[s]=r(t,this._attributeContext,e,n):i[s]=r})),i.gradient=s,i}}_computeBorderAttr(t){const{scale:i,field:n}=t,s=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(s).forEach((i=>{const n=s[i];d(n)?l[i]=n(t,this._attributeContext,e,this.getDataView()):l[i]=n})),"stroke"in l)dM.includes(null===(o=s.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(s.stroke)(t,e));else{const e=hB(lB(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let s=i,o=n;if(!(i&&n||"series"!==this.model.modelType)){const{scale:n,field:r}=this.model.getColorAttribute();i||(s=n),o||(o=r),l.stroke=(null==s?void 0:s.scale(t[o]))||e[0]}}return l}}}class lI extends oI{constructor(){super(...arguments),this.type=lI.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(wf("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(wf("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}lI.type="group";const hI=()=>{kb(),ub(),kw.registerGraphic(Rk.group,Sl),DR.registerMark(lI.type,lI)},cI={type:"fadeIn"};function dI(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return cI;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const uI={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},pI={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},gI=()=>{DR.registerAnimation("scaleInOut",(()=>pI))},fI=(t,e)=>({appear:dI(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:za,duration:uI.update.duration,easing:uI.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),mI=()=>{DR.registerAnimation("line",fI)},vI=()=>{dC.useRegisters([bE,xE,SE,AE,kE,wE,cE,dE])},yI={measureText:(t,e,i,n)=>((t,e,i)=>Xb(t,e,i,{fontFamily:KB.fontFamily,fontSize:KB.fontSize}))(e,i,n).measure(t)};class _I{static instance(){return _I.instance_||(_I.instance_=new _I),_I.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class bI{constructor(){this.id=Pf(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?wf("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class xI extends bI{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class SI{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>DR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>DR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>DR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return DR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>DR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){DR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&_I.instance().registerFunction(t,e)}static unregisterFunction(t){t&&_I.instance().unregisterFunction(t)}static getFunction(t){return t?_I.instance().getFunction(t):null}static getFunctionList(){return _I.instance().getFunctionNameList()}static registerMap(t,e,i){const n=DR.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=DR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,cO.get(e);var e}static hideTooltip(t=[]){_R.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return it.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,n){var s,r,a,o,l,h;this.id=Pf(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=gt(((...t)=>{this._doResize()}),100),this._option=j(this._option,{animation:!1!==i.animation},n),this._onError=null===(s=this._option)||void 0===s?void 0:s.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:f}=c,m=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=Bf(p);v?Zm(Zs):"node"===p&&By(Zs),v&&d&&(this._container=y(d)?gg.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=bR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new AO({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==f?["poptipForText"]:[]},m),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new oO(this,this._compiler),this._event=new sO(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),_R.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=iR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=SR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;SI.getFunctionList()&&SI.getFunctionList().length&&(t=AR(t,SI)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=DR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(n=this._chartSpecTransformer)||void 0===n?void 0:n.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=DR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,n,s;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(n=this._option)||void 0===n||n.onError("chart is already initialized"));const r=DR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return TO(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:dk,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:uk})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof pi?t:new pi,hO(this._dataSet,"dataview",ci),hO(this._dataSet,"array",n),lO(this._dataSet,"stackSplit",vO),lO(this._dataSet,"copyDataView",uO);for(const t in DR.transforms)lO(this._dataSet,t,DR.transforms[t]);for(const t in DR.dataParser)hO(this._dataSet,t,DR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,n,s,r,a,o,l,h;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(n=this._currentTheme)||void 0===n?void 0:n.fontFamily)),null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(r=this._option)||void 0===r?void 0:r.animation)||!1===(null===(a=this._spec)||void 0===a?void 0:a.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily)),t.reCompile&&(null===(l=this._compiler)||void 0===l||l.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(h=this._compiler)||void 0===h||h.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,n,s,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const n=t?yO.appear:yO.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(n,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(n,!0)}))}}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(n=this._compiler)||void 0===n||n.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,_R.unregisterInstance(this)}updateData(t,e,n,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n,s)}))}_updateDataById(t,e,i){const n=this._spec.data.find((e=>e.name===t||e.id===t));n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=W(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,n){return u(this._dataSet)?this:this._chart?((null==n?void 0:n.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=W(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const n=W(this._spec.data);return W(t).forEach((t=>{var e;const{id:i,values:s,parser:r,fields:a}=t,o=n.find((t=>t.name===i));if(o)o instanceof fi?(o.setFields(P(a)),o.parse(s,P(r))):(o.values=s,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=gO(t,this._dataSet,n,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});_(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,s);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,n){const s=this._updateSpec(t,e,n);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var n,s;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;H(r.theme,this._spec.theme)||(a.changeTheme=!0);const o=this._shouldChartResize(r);if(a.reSize=o,null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=CO(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,n=!1,s){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||nR(this._spec,t,e,n),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,n,s)}return this}))}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||nR(this._spec,t,e,i),this._chart){const s=this._chart.getModelInFilter(t);if(s)return this._updateModelSpec(s,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,s){n&&(e=iR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:s,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,n;return this._beforeResize(t,e)?(null===(n=(i=this._compiler).resize)||void 0===n||n.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,n,s,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e,!1),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(n=this._event)||void 0===n||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const n=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));n>=0&&(this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const n=this._option.theme,s=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(n)&&B(s))this._currentTheme=xR(this._currentThemeName,!0);else if(y(n)&&(!s||y(s))||y(s)&&(!n||y(n))){const t=sR({},xR(this._currentThemeName,!0),xR(n,!0),xR(s,!0));this._currentTheme=t}else{const t=sR({},xR(this._currentThemeName),xR(n),xR(s));this._currentTheme=lR(t)}var r;r=R(this._currentTheme,"component.poptip"),j(sx.poptip,nx,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(n=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(n=!0);const s=this._autoSize;return this._autoSize=!!Bf(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==s&&(n=!0),n}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return xR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!bR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!bR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const n=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==n?void 0:n.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);n&&n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield kO(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,n;return i(this,void 0,void 0,(function*(){if(!Bf(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(n=this._option)||void 0===n||n.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?gg.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,n){var s;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o){const e=Object.keys(t),s=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=s?o.dataToPosition(s,n):o.dataToPosition(t,n),a?TB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||u(t)||B(e))return null;if(!_(t)){const{axisId:s,axisIndex:r}=e;let a;if(p(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):p(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return wf("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?TB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(wf("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return _I.instance().getFunction(t)}registerFunction(t,e){t&&e&&_I.instance().registerFunction(t,e)}unregisterFunction(t){t&&_I.instance().unregisterFunction(t)}getFunctionList(){return _I.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);n&&n[t]&&n[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier({regionIndex:t})[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier({regionId:t})[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=DR.getChartPlugins();t.length>0&&(this._chartPlugin=new xI(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}SI.InstanceManager=_R,SI.ThemeManager=bR,SI.globalConfig={uniqueTooltip:!0},SI.Utils=yI,SI.vglobal=gg;DR.registerRegion("region",YO),DR.registerLayout("base",tI),hI(),dC.useRegisters([MC,BC]),dC.useRegisters([OE,IE,uE,pE,BE,RE,PE,LE,DE]),Uw(),Gw(),gR($B.name,$B),it.getInstance(et.Error);const AI=(t="chart",e,i)=>{var n,s,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(n=e.region)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(s=e.series)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(lk).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=DR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:n}=f,s=W(null!==(h=null===(l=i.component)||void 0===l?void 0:l[n])&&void 0!==h?h:[]);null===(d=W(null!==(c=e[n])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const n=s[i];n.type===t&&f.modelInfo.push(Object.assign(Object.assign({},n),{spec:e}))}))}else{const n=DR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(n.length>0){f.modelType="component";const s=t;f.specKey=s;const r=W(null!==(p=null===(u=i.component)||void 0===u?void 0:u[s])&&void 0!==p?p:[]);W(null!==(g=e[s])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];n.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},kI=(t,e,i,n)=>{const{spec:s,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,n,s,r)=>{const a=AI(t,s,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||W(e).some((e=>d(e)?e(t,i,n):ZB(t.spec,e)))))})})(a,r,t,e,i,n);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=iR({},i),m=d(s)?s(g,t,e):s;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:iR(f,m),hasChanged:!0};const i=iR({},t,m);qB(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}};class wI{constructor(t){this.id=Pf(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const TI=t=>{DR.registerChartPlugin(t.type,t)};class CI extends wI{constructor(){super(CI.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[CI.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,n)=>{n?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[CI.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let n,s;switch(i){case"render":case"updateModelSpec":n=!1,s=!0;break;case"updateSpec":case"setCurrentTheme":n=!0,s=!1;break;case"updateSpecAndRecompile":n=!1,s=!1}if(n&&this.release(),this._initialized||this.onInit(t,e),n||s){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,n){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,n))}_applyQueries(t,e){const i=[],n=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:s}=this._check(t);e&&(s?i.push(t):n.push(t))})),!i.length&&!n.length)return!1;let s,r;this._baseChartSpec||(this._baseChartSpec=JB(this._option.globalInstance.getSpec(),["data",CI.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return n.length>0?(s=JB(this._baseChartSpec,["data",CI.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(n.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,s,r);s=e.chartSpec})),a=!0):(s=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,s,r);s=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(s,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const n in t)switch(n){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const s=kI(t,n,e,i);e=s.chartSpec,r||(r=s.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=JB(i,["data",CI.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let n=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,n||(n=e.hasChanged)})),n&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}CI.pluginType="chart",CI.specKey="media",CI.type="MediaQueryPlugin";const EI=/\{([^}]+)\}/,MI=/\{([^}]+)\}/g,BI=/:/;class RI extends wI{constructor(){super(RI.type),this.type="formatterPlugin",this._timeModeFormat={utc:De.getInstance().timeUTCFormat,local:De.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ue.getInstance().format,this._numericSpecifier=Ue.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:n}=t;if(!n)return;this._spec=null!==(i=null==e?void 0:e[RI.specKey])&&void 0!==i?i:{};const{timeMode:s,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:s&&this._timeModeFormat[s]&&(this._timeFormatter=this._timeModeFormat[s]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),DR.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,n)=>{const s=_(i)?i[n]:i;return s?this._formatSingleLine(t,e,s):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let n;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?n=this._isNumericFormatterCache.get(i):(n=EI.test(i),this._isNumericFormatterCache.set(i,n))),n){const t=i.replace(MI,((t,i)=>{if(!BI.test(i)){const n=e[i.trim()];return void 0!==n?n:t}const n=i.split(":"),s=e[n.shift()],r=n.join(":");return this._formatSingleText(s,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ve.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}RI.pluginType="chart",RI.specKey="formatter",RI.type="formatterPlugin";const OI=()=>{TI(RI)};function II(t){return 2===t.length&&A(t[0])&&A(t[1])&&t[1]>=t[0]}function PI(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!A(a.min),extendable_max:!A(a.max)}}function LI(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function DI(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function FI(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function jI(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const NI=(t,e)=>{var i,n,s,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const f=c.domain(),m=f[1]-f[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return m*e+f[0]}));return yA(v)};class zI extends wI{constructor(){super(zI.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!SS(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const n=this._checkEnableSync(i);if(!n)return;if(!n.zeroAlign)return;const s=this._getTargetAxis(i,n);s&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===s.id},(()=>{((t,e)=>{var i,n,s,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(s=null===(n=(i=t).getDomainAfterSpec)||void 0===n?void 0:n.call(i))&&void 0!==s?s:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&II(c)&&II(d)))return;const u=PI(t,c),p=PI(e,d),{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!DI(u,p))return}else if(0===_&&0===b){if(!DI(p,u))return}else if(y||A)if(y&&!A){if(!LI(u,p))return}else if(A&&!y){if(!LI(p,u))return}else{if(f===b)return;if(f>b){if(!FI(u,p))return}else if(!FI(p,u))return}else{if(0===f&&0===_){if(!jI(u,p))return}else if(0===b&&0===g&&!jI(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){lO(e.getOption().dataSet,"tickAlign",NI);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}zI.pluginType="component",zI.type="AxisSyncPlugin";const VI=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,HI=(t,e)=>{var i;let n,s;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(n=t.split("\n"),n=n.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(s=t.text,n=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s},hd||(hd=od.CreateGraphic("richtext",{})),hd.setAttributes(a),hd.AABBBounds);var a;return{width:r.width(),height:r.height(),text:n}},GI="vchart-tooltip-container",UI={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function WI(t,e){return R(e,`component.${t}`)}function YI(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=DR.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const KI={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function XI(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function $I(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function ZI(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const qI=(t,e,i)=>{var n;const s=null!==(n="band"===e?WI("axisBand",i):["linear","log","symlog"].includes(e)?WI("axisLinear",i):{})&&void 0!==n?n:{},r=HR(t)?WI("axisX",i):GR(t)?WI("axisY",i):WI("axisZ",i);return iR({},WI("axis",i),s,r)},JI=(t,e,i)=>{var n;const s=null!==(n="band"===e?WI("axisBand",i):"linear"===e?WI("axisLinear",i):{})&&void 0!==n?n:{},r=WI("angle"===t?"axisAngle":"axisRadius",i);return iR({},WI("axis",i),s,r)},QI=t=>"band"===t||"ordinal"===t||"point"===t;function tP(t,e){return{id:t,label:t,value:e,rawValue:t}}function eP(t,e,i,n){for(let s=0,r=t.length;s=e)return r}}return null}const iP=(t=3,e,i,n,s,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,f=0,m=0;if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!n.size&&Number.isFinite(f),y=!!s.size&&Number.isFinite(m),_=o&&!v&&p(l),b=o&&!y&&p(h);let x,S,A;c&&(x=_?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:y,axis:g});let k,w=0,T=0;if(r&&n.forEach((({axis:t,value:i})=>{var n;i=null!=i?i:"";let s=null;const a=t.getScale();if(kS(a.type))A=a.bandwidth(),0===A&&a.step&&(w=a.step());else if(SS(a.type)){const n=e.fieldX[0],r=e.fieldX2,a=eP(e.getViewData().latestData,+i,n,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[n]} ~ ${a[r]}`):A=1,f=t}s=t.niceLabelFormatter}if(x&&(null===(n=r.label)||void 0===n?void 0:n.visible)&&!_){const e=XI(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=s,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=s,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&s.forEach((({axis:t,value:i})=>{var n;i=null!=i?i:"";let s=null;const r=t.getScale();if(kS(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(SS(r.type)){const n=e.fieldY[0],r=e.fieldY2,a=eP(e.getViewData().latestData,+i,n,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[n]} ~ ${a[r]}`):k=1,m=t}s=t.niceLabelFormatter}if(S&&(null===(n=a.label)||void 0===n?void 0:n.visible)&&!b){const e=XI(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=s,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=s,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!_){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(sP(t,n),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=f+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&nP(t,"top",r.label),e.visible&&nP(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(sP(t,s),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=m+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&nP(t,"left",a.label),e.visible&&nP(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:w,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},nP=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=YI(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},sP=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},rP=(t,e,i,n)=>{const{x:s,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:s+i/2,y:r},end:{x:s+i/2,y:r+a}};else if("rect"===o){const o=oP(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(s-o/2-n/2,h),y:r},end:{x:Math.min(s+i+o/2+n/2,c),y:r+a}}}return l},aP=(t,e,i,n)=>{const{leftPos:s,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:s,y:a+i/2},end:{x:s+r,y:a+i/2}};else if("rect"===o){const o=oP(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:s,y:Math.max(a-o/2-n/2,h)},end:{x:s+r,y:Math.min(a+i+o/2+n/2,c)}}}return l},oP=(t,e,i)=>{var n,s,r;let a=0;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(s=t.style)||void 0===s?void 0:s.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const n=i.getLayoutRect();a=t.style.size(n,i)-e}return a},lP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const n=t(e);S(n)&&(i=n)}return i},hP={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},cP=(t,e)=>{var i,n;return null!==(n=null===(i=hP[t])||void 0===i?void 0:i[0])&&void 0!==n?n:e},dP=(t,e)=>{var i,n;return null!==(n=null===(i=hP[t])||void 0===i?void 0:i[1])&&void 0!==n?n:e},uP=(t,e,i)=>{const n=new Map,s=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?n.set(t.getSpecIndex(),{value:e,axis:t}):s.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!n.size,type:"rect"},a={visible:!!s.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=iP(3,e,i,n,s,r,a);return o?rP(r,o,d,h):l?aP(a,l,u,c):void 0},pP={fontFamily:KB.fontFamily,spacing:10,wordBreak:"break-word"};function gP(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:pP),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const fP=t=>{var e;const{backgroundColor:i,border:n,shadow:s}=t,r={lineWidth:null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0,shadow:!!s};(null==n?void 0:n.color)&&(r.stroke=n.color),i&&(r.fill=i),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=null!=n?n:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},mP=(t,e)=>p(e)?t.map((t=>e[t])):void 0,vP=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),yP=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function _P(e,i,n){var s,r,a;const o=Object.assign({regionIndex:0},i),l=n.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=bP(e,h),d=null!==(s=o.activeType)&&void 0!==s?s:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),f=h.getLayoutRect(),m=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),y=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>vP(i,n)(t)&&vP(s,r)(t)&&(u(a)||vP([a],[o])(t))));return l},_=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),f.width),y:Math.min(Math.max(t.y,0),f.height)}))(t),s=null!==(e=o.x)&&void 0!==e?e:g.x+n.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+n.y;return{canvasX:s,canvasY:r,clientX:v.x+s,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const s=new Map;c.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>y(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:_({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};n.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return SI.globalConfig.uniqueTooltip&&SI.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const s=Object.assign(Object.assign({},y(i)),e),r=[{datum:[s],series:i.series}],o=[{value:s[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:s,model:i.series,source:t.Event_Source_Type.chart,event:_(i.pos),item:void 0,itemMap:new Map};n.processor.mark.showTooltip({datum:s,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return SI.globalConfig.uniqueTooltip&&SI.hideTooltip(u.id),d}return"none"}const bP=(t,e)=>{const i=e.getSeries(),n=[];return i.forEach((e=>{var i,s,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(s=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=mP(c,t);let y=mP(d,t);const _=yP(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(vP(c,v));if(!_&&(y=mP(d,i),!yP(y)))return;const s=e.type===lk.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(s)||isNaN(s.x)||isNaN(s.y)||n.push({pos:s,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=kS(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",s=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];s.length>0&&s.forEach((([t,i])=>{var n,s,a,o;const l=null!==(o=null===(a=null===(s=null===(n=e.getViewDataStatistics)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var n;const s=null!==(n=null==t?void 0:t.slice())&&void 0!==n?n:[];s[i]=e,h.push(s)}))})),r=h})),r.forEach((s=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(vP(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=mP(d,o),!yP(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:c,dimensionData:s,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(vP(c,s));if(!_&&(y=mP(d,r),!yP(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:c,dimensionData:s,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===lk.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(vP(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=mP(d,i),!yP(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:s},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),n},xP=t=>{var e,i,n;if(!1===(null==t?void 0:t.visible))return[];const s={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(n=null==t?void 0:t.group)||void 0===n?void 0:n.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(s).forEach((e=>{var i;s[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(s).filter((t=>s[t]))};const SP=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null};class AP{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class kP extends AP{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?W(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const n=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[n]},this._getSeriesStyle=(t,e,i)=>{var n;for(const i of W(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let n=this._seriesCacheInfo.dimensionFields;return i[0]&&(n=n.filter((t=>t!==i[0]))),n.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:TP(e.title,{seriesId:this.series.id},!0),content:CP(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=xP(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}}return null}}const wP=(t,e,i)=>{const n=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),n):Object.assign(Object.assign({},n),t)},TP=(t,e,i)=>p(t)?d(t)?(...n)=>wP(t(...n),e,i):wP(t,e,i):void 0,CP=(t,e,i)=>{const n=p(t)?W(t).map((t=>d(t)?(...n)=>W(t(...n)).map((t=>wP(t,e,i))):wP(t,e,i))):void 0;return n},EP=(t,e,i)=>{var n;let s={};switch(t){case"mark":case"group":e&&(s=null!==(n=SP(e,t))&&void 0!==n?n:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=SP(n,"dimension",s);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...W(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}}return s},MP=(t,e,i)=>{var n,s;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=i[t]?P(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=BP(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&xP(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...W(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},BP=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),RP=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},OP=(t,e,i,n,s)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==n?void 0:n[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==n?void 0:n[0],s].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let s;if(s=d(t)?t(e,i):t,n){const{formatFunc:i,args:r}=YI(void 0,n,t,e);i&&r&&(s=i(...r))}return s},PP=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class LP{}LP.dom=`${ck}_TOOLTIP_HANDLER_DOM`,LP.canvas=`${ck}_TOOLTIP_HANDLER_CANVAS`;const DP=20,FP={key:"其他",value:"..."},jP=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const n=De.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?n.timeFormat:n.timeUTCFormat)(e,t)},NP=(t,e,i)=>{var n,s,r,a;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const o={title:{},content:[]},l=PP(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:f,hasShape:m,valueFormatter:v}=null!=l?l:{},y=!1!==IP(h,e,i);if(l&&y){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:jP(IP(c,t,i,v),p,g),valueStyle:IP(f,t,i),hasShape:m}}else o.title={hasShape:!1,visible:!1};const _=((t,e,i)=>{if(u(t))return t;let n=[];return W(t).forEach((t=>{d(t)?n=n.concat(W(t(e,i))):n.push(t)})),n})(t.content,e,i),{maxLineCount:b=DP}=t,x=t.othersLine?Object.assign(Object.assign({},FP),t.othersLine):FP,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=_?_:[]){const n=zP(e,t,i);if(!1!==n.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},n),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===n.id)))&&void 0!==a?a:[];for(const n of e){for(const e of t){const t=zP(n,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},zP=(t,e,i)=>{const n=jP(IP(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),s=jP(IP(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==IP(e.visible,t,i)&&(p(n)||p(s)),a=IP(e.isKeyAdaptive,t,i),o=IP(e.spaceRow,t,i),l=IP(e.shapeType,t,i),h=IP(e.shapeColor,t,i),c=IP(e.shapeFill,t,i),d=IP(e.shapeStroke,t,i),u=IP(e.shapeLineWidth,t,i),g=IP(e.shapeHollow,t,i),f=IP(e.keyStyle,t,i),m=IP(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:f,valueStyle:m,spaceRow:o,datum:t}};class VP extends wI{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:n}=i;return n?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,n,s;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(s=null===(n=(i=a.handler).showTooltip)||void 0===n?void 0:n.call(i,h,e,t))&&void 0!==s?s:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var n,s,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,f=null===(n=e.dimensionInfo)||void 0===n?void 0:n[0],m={x:1/0,y:1/0};let{offsetX:v,offsetY:y}=this._option;if(!u)return this._cacheTooltipPosition=void 0,m;const{activeType:_,data:b}=t,x=u[_],k=PP(x.position,b,e),w=null!==(s=PP(x.positionMode,b,e))&&void 0!==s?s:"mark"===_?"mark":"pointer",T=this._getParentElement(u),{width:C=0,height:E=0}=null!=i?i:{},M="canvas"===u.renderMode,B=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),R=null!==(a=null==B?void 0:B.width)&&void 0!==a?a:dk,O=null!==(o=null==B?void 0:B.height)&&void 0!==o?o:uk;let I=!1;const P={width:0,height:0};let L={x:0,y:0},D={x:0,y:0},F=1,j=1;if(Bf(this._env)&&!u.confine){if(P.width=window.innerWidth,P.height=window.innerHeight,!M){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:m;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();L={x:e.x-D.x,y:e.y-D.y},F=VI(t,e),j=VI(T,D)}}else P.width=R,P.height=O;const N=j/F;let z,V,H,G,U=k,W=k;const Y=({orient:t,mode:i,offset:n})=>{var s;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=n?n:v,"mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(s=null==f?void 0:f.axis)||void 0===s?void 0:s.getCoordinateType())){I=!0;const t=uP(e.dimensionInfo,ak(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else U=t;if(I)switch(cP(t)){case"left":z=r-C*N-v;break;case"right":z=a+v;break;case"center":z=(r+a)/2-C*N/2;break;case"centerLeft":z=(r+a)/2-C*N-v;break;case"centerRight":z=(r+a)/2+v}},K=({orient:t,mode:i,offset:n})=>{var s;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(y=null!=n?n:y,"mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(s=null==f?void 0:f.axis)||void 0===s?void 0:s.getCoordinateType())){I=!0;const t=uP(e.dimensionInfo,ak(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else W=t;if(I)switch(dP(t)){case"top":V=r-E*N-y;break;case"bottom":V=a+y;break;case"center":V=(r+a)/2-E*N/2;break;case"centerTop":V=(r+a)/2-E*N-y;break;case"centerBottom":V=(r+a)/2+y}};if(g(k)){if(g(X=k)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:n}=k;z=lP(t,c),V=lP(i,c),H=lP(e,c),G=lP(n,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(k)){const{x:t,y:e}=k;S(t)||d(t)?z=lP(t,c):Y(t),S(e)||d(e)?V=lP(e,c):K(e)}}else p(k)&&(Y({orient:k,mode:w}),K({orient:k,mode:w}));var X;let $,Z;const{canvasX:q,canvasY:J}=c;if(A(z))$=z;else if(A(H))$=R-C*N-H;else{const t=q;switch(cP(U,"right")){case"center":$=t-C*N/2;break;case"left":case"centerLeft":$=t-C*N-v;break;case"right":case"centerRight":$=t+v}}if(A(V))Z=V;else if(A(G))Z=O-E*N-G;else{const t=J;switch(dP(W,"bottom")){case"center":Z=t-E*N/2;break;case"top":case"centerTop":Z=t-E*N-y;break;case"bottom":case"centerBottom":Z=t+y}}$*=F,Z*=F,Bf(this._env)&&($+=L.x,Z+=L.y),$/=j,Z/=j;const{width:Q,height:tt}=P,et=()=>$*j+D.x<0,it=()=>($+C)*j+D.x>Q,nt=()=>Z*j+D.y<0,st=()=>(Z+E)*j+D.y>tt,rt=()=>{et()&&(I?$=-D.x/j:"center"===cP(k,"right")?$+=v+C/2:$+=2*v+C)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(I?$=(Q-D.x)/j-C:"center"===cP(k,"right")?$-=v+C/2:$-=2*v+C)},lt=()=>{it()&&($=(Q-D.x)/j-C)},ht=()=>{nt()&&(I?Z=-D.y/j:"center"===dP(k,"bottom")?Z+=y+E/2:Z+=2*y+E)},ct=()=>{nt()&&(Z=0-D.y/j)},dt=()=>{st()&&(I?Z=(tt-D.y)/j-E:"center"===dP(k,"bottom")?Z-=y+E/2:Z-=2*y+E)},ut=()=>{st()&&(Z=(tt-D.y)/j-E)};switch(cP(k,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(dP(k,"bottom")){case"center":case"centerTop":case"centerBottom":nt()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:Z};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:C,height:E},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},UI),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:UI.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:UI.offsetY})}_getTooltipBoxSize(t,e){var i,n,s;if(!e||u(this._attributes)){const e=null!==(n=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==n?n:{};this._attributes=((t,e,i)=>{var n,s,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,maxContentHeight:y,align:_}=l,b=Oe(d.padding),x=wB(d.padding),S=gP(Object.assign({textAlign:"right"===_?"right":"left"},u),i),A=gP(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=gP(m,i),w={fill:!0,size:null!==(n=null==g?void 0:g.size)&&void 0!==n?n:8,spacing:null!==(s=null==g?void 0:g.spacing)&&void 0!==s?s:6},T={panel:fP(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:w,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:y,enterable:h,transitionDuration:c,align:_},{title:C={},content:E=[]}=t;let M=x.left+x.right,B=x.top+x.bottom,R=x.top+x.bottom,O=0;const I=E.filter((t=>(t.key||t.value)&&!1!==t.visible)),P=!!I.length;let L=0,D=0,F=0,j=0;if(P){const t=[],e=[],i=[],n=[];let s=0;T.content=I.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,C={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=iR({},A,gP(b,void 0,{})),{width:n,height:s,text:r}=HI(h,i);C.key=Object.assign(Object.assign({width:n,height:s},i),{text:r}),y?e.push(n):t.push(n),o=Math.max(o,s)}if(p(m)){const t=iR({},k,gP(x,void 0,{})),{width:e,height:n,text:s}=HI(m,t);C.value=Object.assign(Object.assign({width:e,height:n},t),{text:s}),i.push(e),o=Math.max(o,n)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,C.shape=t;const i=null!=f?f:w.size;o=Math.max(i,o),n.push(i)}else C.shape={visible:!1};return C.height=o,s+=o,aY.autoWidth&&!1!==Y.multiLine;if(H){Y=iR({},S,gP(U,void 0,{})),X()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:P?Math.ceil(O):void 0);const{text:t,width:e,height:i}=HI(G,Y);T.title.value=Object.assign(Object.assign({width:X()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),N=T.title.value.width,z=T.title.value.height,V=z+(P?T.title.spaceRow:0)}return B+=V,R+=V,T.title.width=N,T.title.height=z,X()?M+=O||N:M+=Math.max(N,O),P&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-x.left-x.right-j-L-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=M,T.panel.height=B,T.panelDomHeight=R,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(s=this._attributes)&&void 0!==s?s:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:n,canvasY:s}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(Bf(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,n=null==t?void 0:t.getBoundingClientRect();h={x:n.x-c.x,y:n.y-c.y},d=VI(t,n),u=VI(l,c)}return n*=d,s*=d,Bf(this._env)&&(n+=h.x,s+=h.y),n/=u,s/=u,{x:n,y:s}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:n=0,y:s}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(r,{x1:n,y1:s,x2:n+e,y2:s+i},!1))return!0;const a={x:n,y:s},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Te([c,a,o],r.x,r.y)||Te([c,l,h],r.x,r.y)||Te([c,a,h],r.x,r.y)||Te([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}VP.specKey="tooltip";const HP=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",GP=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let UP;const WP=(t=document.body)=>{if(u(UP)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),UP=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return UP};function YP(t){var e,i,n;const{panel:s={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:f="left"}=null!=t?t:{},{fill:m,shadow:v,shadowBlur:y,shadowColor:_,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:w=0,width:T=0}=s,{value:C={}}=o,{shape:E={},key:M={},value:B={}}=l,R=function(t,e){if(!t)return;const{size:i}=iR({},e,t),n={};return n.width=HP(i),n}(E),O=KP(M),I=KP(B),{bottom:P,left:L,right:D,top:F}=wB(h),j="right"===f?"marginLeft":"marginRight";return{align:f,panel:{width:HP(T+2*w),minHeight:HP(g+2*w),paddingBottom:HP(P),paddingLeft:HP(L),paddingRight:HP(D),paddingTop:HP(F),borderColor:k,borderWidth:HP(w),borderRadius:HP(A),backgroundColor:m?`${m}`:"transparent",boxShadow:v?`${b}px ${x}px ${y}px ${S}px ${_}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?HP(null==r?void 0:r.spaceRow):"0px"},KP(iR({},C,null==r?void 0:r.value))),content:{},shapeColumn:{common:R,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return XP.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=XP.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,n){const s=null==Mf?void 0:Mf.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(XP.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}XP.type="tooltipModel";const $P={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},ZP={boxSizing:"border-box"},qP={display:"inline-block",verticalAlign:"top"},JP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},tL={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},eL={lineHeight:"normal",boxSizing:"border-box"};class iL extends XP{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const m=()=>c?e(c):f,v=GP(u),_=t=>new mc({symbolType:t,size:v,fill:!0});let b=_(l);const x=b.getParsedPath();x.path||(b=_(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let w=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,n]=w.split(" ").map((t=>Number(t))),s=Number(p.slice(0,-2));w=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}if(!h||y(h)||d)return f=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){f=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(n=h.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class nL extends XP{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sL={overflowWrap:"normal",wordWrap:"normal"};class rL extends XP{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=J(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=J(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(iR({},qP,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[],o=(t,e)=>{var i,n;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=s,c=iR({},o?QP:JP,Object.assign(Object.assign(Object.assign({height:HP(l)},sL),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return y(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:n}=a[e],{valueColumn:r}=s;return iR({},tL,Object.assign(Object.assign(Object.assign({height:HP(n)},sL),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,n,r,l;const{height:h}=a[e],{shapeColumn:c}=s,d=o(t,e),u=`calc((${null!==(n=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==n?n:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return iR({},eL,Object.assign(Object.assign({height:HP(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=y(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=y(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n;const s=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(n=t.shapeFill)&&void 0!==n?n:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class aL extends XP{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new rL(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(iR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:n}=this._option.getTooltipAttributes();if(p(n)&&et+GP(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WP(this._option.getContainer())}px`,maxHeight:HP(n),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class oL extends XP{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new iL(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new nL(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(iR({},$P,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(n=r.shapeColumn.common)||void 0===n?void 0:n.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(s=this.textSpan)||void 0===s||s.setStyle({color:"inherit"})}setContent(){var t,e,i,n,s,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(n=this.textSpan)||void 0===n||n.setContent(null==h?void 0:h.value,null===(r=null===(s=l.title)||void 0===s?void 0:s.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const lL="99999999999999";class hL extends XP{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:lL,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new oL(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new aL(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(iR({},ZP,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const cL=t=>{DR.registerComponentPlugin(t.type,t)};class dL extends VP{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(dL.type),this.type=LP.dom,this._tooltipContainer=null==Mf?void 0:Mf.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Mf&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,n;const{tooltipActual:s,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=s,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=s.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(n=this._cacheCustomTooltipPosition)&&void 0!==n?n:{x:t,y:o}),r.updateElement(a,s,e);const i=this._getActualTooltipPosition(s,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=YP(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),n=t.relatedTarget;"html"===e&&i&&(u(n)||n!==this._compiler.getCanvas()&&!Pe(n,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}dL.type=LP.dom;class uL extends VP{constructor(){super(uL.type),this.type=LP.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ik({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:n}=e,s=n.position;e.changePositionOnly?p(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),s)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}uL.type=LP.canvas;const pL=()=>{cL(uL)},gL=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},fL={min:t=>t.length?X(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?X(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},mL=(t,e)=>{var i,n;let s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return{};s=kR([],s);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(n=(i=t[0]).getFields)||void 0===n?void 0:n.call(i);return vL(a,s,o)},vL=(t,e,i)=>{const n={};let s=[],r=[];return e.forEach((e=>{const a=e.key;n[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;s.length=0,t.forEach((t=>{t&&s.push(t[a])}));const d=s.length;if(h){r.length=0,s.forEach(((t,e)=>{Lf(t)&&r.push(t)}));const t=s;s=r,r=t,c=s.length===d}else s=l.some((t=>"array-min"===t||"array-max"===t))?s.reduce(((t,e)=>(e&&e.forEach((e=>{Lf(e)&&t.push(e)})),t)),[]):s.filter((t=>void 0!==t));e.filter&&(s=s.filter(e.filter)),l.forEach((t=>{if(e.customize)n[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(n[a][t]=o.domain.slice())}else if("allValid"===t)return;n[a][t]=fL[t](s),"array-max"===t&&(n[a].max=n[a][t]),"array-min"===t&&(n[a].min=n[a][t])}})),h&&(n[a].allValid=c)})),n},yL=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||s&&s.length&&t.forEach((t=>{s.forEach((e=>{Lf(t[e])||(t[e]=0)}))})),t};class _L extends sI{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}function bL(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function xL(t,e,i){t&&(i.needDefaultSeriesField&&(t[XE]=i.defaultSeriesField),t[YE]=e,t[KE]=i.getKey(t,e,i))}const SL=["appear","enter","update","exit","disappear","normal"];function AL(t={},e,i){const n={};for(let s=0;s{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var n;let s=t;return EL(s)&&delete s.type,s.oneByOne&&(s=wL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:TL,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=iR({},o[e],a);return EL(s)&&delete s.type,s.oneByOne&&(s=wL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:TL,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n.state=n.update,n}function kL(t,e,i){var n,s,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(n=e.animationAppear[t])&&void 0!==n?n:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(s=e.animationDisappear[t])&&void 0!==s?s:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=P(t),ML(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function wL(t,e,i){const{oneByOne:n,duration:s,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(s)?s(t,i,a):A(s)?s:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(n)?n(t,i,a):n;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(s)?s(t,r,o):A(s)?s:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(n)?n(t,r,o):n;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function TL(t,e){var i,n;return null!==(i=null==t?void 0:t[YE])&&void 0!==i?i:null===(n=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===n?void 0:n.elementIndex}function CL(t,e){var i,n,s,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(s=null===(n=t.animationAppear)||void 0===n?void 0:n[e])&&void 0!==s?s:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function EL(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function ML(t,e){if(_(t))t.forEach(((i,n)=>{t[n]=e(t[n],n),ML(t[n],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),ML(t[i],e)}function BL(t){var e,i,n,s;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(s=null===(n=t.getRawData())||void 0===n?void 0:n.latestData)||void 0===s?void 0:s.length)>=a)}class RL extends VO{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=W(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,n,s;const r=rB(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=aR(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return iR({},c,d,(null!==(s=null!==(n=this.stack)&&void 0!==n?n:null==d?void 0:d.stack)&&void 0!==s?s:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s,r){if(!t)return;W(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=s?s:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[n])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:n,innerRadius:s,direction:r}=t;return p(n)&&(i.outerRadius=n),p(s)&&(i.innerRadius=s),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>{const e=iR({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>iR({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}class OL extends HO{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${ck}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=RL,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=BL(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(lO(this._rawData.dataSet,"invalidTravel",yL),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,n;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=gO(s,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(n=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===n||n.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=pO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=pO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new _L(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(n=this._rawData.getFields())||void 0===n?void 0:n[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=X(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=vL(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(s=this._rawStatisticsCache[t])&&void 0!==s?s:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){lO(this._dataSet,"dimensionStatistics",mL);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new fi(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&kR(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){lO(this._dataSet,"dimensionStatistics",mL);const n=new fi(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=kR(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&kR(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new fi(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:n}=i,s=this._getSeriesDataKey(t);return void 0===n.get(s)?(n.set(s,0),s):(n.set(s,n.get(s)+1),`${s}_${n.get(s)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(lO(this._rawData.dataSet,"addVChartProperty",gL),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bL.bind(this),call:xL}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,n,s){var r;const a=this._createMark({type:t.type,name:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:s.depend,key:t.dataKey});if(a){if(s.hasAnimation){const e=AL({},kL(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${n}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,s)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(n=this._option.mode)===t.RenderModeEnum["desktop-browser"]||n===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Rf(n)||Of(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var n;let s=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?s.enable=a:g(a)&&(s.enable=!0,s=iR(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=iR(r,o));const l=[];if(s.enable){const t=this._parseSelectorOfInteraction(s,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:s.trigger,triggerOff:s.triggerOff,blurState:bO.STATE_HOVER_REVERSE,highlightState:bO.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,n=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:n,reverseState:bO.STATE_SELECTED_REVERSE,state:bO.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,n=this._parseDefaultInteractionConfig(t);n&&n.length&&n.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const n=null!==(e=this._seriesField)&&void 0!==e?e:XE;this.getMarksWithoutRoot().forEach((e=>{const s={},r={},a={};i.forEach((t=>{var i;const n=null===(i=t[e.name])||void 0===i?void 0:i.style;n&&(s[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(n).forEach((e=>{r[e]=!0,a[t.name][e]=n[e]})))})),e.state.addStateInfo({stateValue:$E,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][n]]:!0===s[t[n]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var s,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(s=a[i[0][n]])||void 0===s?void 0:s[t]}return o=null===(r=a[i[n]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,$E,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,n;(null===(n=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new kP(this)}_compareSpec(t,e,i){var n,s;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return H(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},xM),SM),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(W(t.extensionMark).length!==W(e.extensionMark).length||(null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((n=>{var s,r;return i[n.name]=!0,(null===(s=e[n.name])||void 0===s?void 0:s.visible)!==(null===(r=t[n.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>SM[i]&&!H(t[i],e[i])))&&(r.reCompile=!0),a.some((n=>!i[n]&&!H(t[n],e[n])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof fi||fO(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();BL(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const n=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));n>=0&&this._rawData.transformsArr.splice(n,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:XE,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new mB).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return lB(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:XE}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,n,s,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:f,parent:m,isSeriesMark:v,depend:y,progressive:_,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:w=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:w});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(m)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==m&&m.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,f),c(l)&&T.setSkipBeforeLayouted(l),p(y)&&T.setDepend(...W(y));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(n=a.morph)||void 0===n?void 0:n.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(s=a.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(_)||T.setProgressiveConfig(_),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,iR({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KE}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const n=this.getSeriesField();return n&&!i.includes(n)&&(e+=`_${t[n]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==QE&&t!==eM&&t!==JE&&t!==tM||(t=this.getStackValueField()),null!==(e=TR(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=sB[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Lf(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),n=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=n?n:[]}_forEachStackGroup(t,e){var i,n;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(n=e.values)||void 0===n?void 0:n.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:XE]}}function IL(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();SS(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n.index(t[e])-n.index(i[e]))*(s?-1:1)))}function PL(t){return{dataIndex:e=>{var i,n;const s="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[s],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(n=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==n?n:[]).indexOf(r)||0},dataCount:()=>{var e,i,n;const s="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(n=(null!==(i=null===(e=null==s?void 0:s.domain)||void 0===e?void 0:e.call(s))&&void 0!==i?i:[]).length)&&void 0!==n?n:0}}}OL.mark=mM,OL.transformerConstructor=RL;class LL extends OL{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=W(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=W(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&W(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const n={key:i,operations:[]},s=e.axisHelper.getScale(0);SS(s.type)?(n.operations=["max","min"],"log"===s.type&&(n.filter=t=>t>0)):n.operations=["values"],t.push(n)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${ck}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?W(this._spec.xField)[0]:W(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(eM),this.setFieldX2(tM)):(this.setFieldY(eM),this.setFieldY2(tM))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(nM),this.setFieldX2(iM)):(this.setFieldY(nM),this.setFieldY2(iM))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=W(this._spec.xField),this._specYField=W(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(W(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,n,s,r){const a=s();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,n);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(W(this.getDatumPositionValues(t,o)),this._scaleConfig)))),s()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(IL("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const DL="monotone";class FL{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],n=this._fieldY,s=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:n[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,n;return this._lineMark=this._createMark(wM.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(n=this._spec.line)||void 0===n?void 0:n.stateSort}),this._lineMark}initLineMarkStyle(e,i){var n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:"linear",closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,o=a===DL?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(wM.point,{morph:CL(this._spec,wM.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new fi(this._option.dataSet,{name:`${ck}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(iO.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const n in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][n]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:bO.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[wM.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(iO.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,iR({},this._spec[wM.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:bO.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var n,s,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(s=null===(n=e.stateStyle.normal)||void 0===n?void 0:n[i])||void 0===s?void 0:s.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class jL extends oI{setStyle(t,e="normal",i=0,n=this.stateStyle){if(u(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||s.includes(l))return;a&&r.includes(l)&&(AS(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,n);this.setAttribute(l,c,e,i,n)})),o&&this.setEnableSegments(o)}}class NL extends jL{constructor(){super(...arguments),this.type=NL.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===lk.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NL.type="line";const zL=()=>{DR.registerMark(NL.type,NL),kb(),gb(),kw.registerGraphic(Rk.line,bc),vI()};class VL extends oI{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class HL extends VL{constructor(){super(...arguments),this.type=HL.type}}HL.type="symbol";const GL=()=>{DR.registerMark(HL.type,HL),kb(),Tb(),kw.registerGraphic(Rk.symbol,vc)};class UL extends RL{_transformLabelSpec(t){var e,i,n;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class WL extends bI{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function YL(t,e,i,n){switch(t){case r.cartesianBandAxis:return qI(WR(i,["z"]),"band",e);case r.cartesianLinearAxis:return qI(WR(i,["z"]),"linear",e);case r.cartesianLogAxis:return qI(WR(i,["z"]),"log",e);case r.cartesianSymlogAxis:return qI(WR(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return qI(WR(i),void 0,e);case r.polarBandAxis:return JI(i.orient,"band",e);case r.polarLinearAxis:return JI(i.orient,"linear",e);case r.polarAxis:return JI(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=W(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(n=WI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>HR(t.orient)));let d;d=p(c)?iR({},QI(c.type)?a:o,l):l;const u=s.find((t=>GR(t.orient)));let g;return g=p(u)?iR({},kS(u.type)?a:o,h):h,{xField:d,yField:g}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=W(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(n=WI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>"angle"===t.orient));let d;d=p(c)?iR({},QI(c.type)?a:o,l):l;const u=s.find((t=>"radius"===t.orient));let g;return g=p(u)?iR({},kS(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,n);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return KL(i,WI(t,e));default:return WI(t,e)}}const KL=(t,e)=>{var i;const n=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],s=iR({},e,n);return delete s.horizontal,delete s.vertical,s};class XL extends VO{getTheme(t,e){return YL(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},wB(e)),{[n]:0}))}}class $L extends UO{static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]);return new this(n,Object.assign(Object.assign({},i),s))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new WL(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=XL,this._delegateEvent=(e,i,n,s=null,r=null)=>{var a,o;i instanceof ea||this.event.emit(n,{model:this,node:e,event:i,item:s,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new zO({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!H(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}$L.transformerConstructor=XL;class ZL extends oI{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(Rk.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}ZL.type="component";const qL=()=>{DR.registerMark(ZL.type,ZL)},JL=t=>t;class QL extends $L{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return W(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,n,s,r,a,o,l,h,d,u,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Lk.circleAxisGrid:Lk.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(s=null===(n=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===n?void 0:n.zIndex)&&void 0!==s?s:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=AL(null===(o=DR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new sI(this._option,t)]}collectData(t,e){const i=[];return rk(this._regions,(n=>{var s;let r=this.collectSeriesField(t,n);if(r=_(r)?SS(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=n.getFieldAlias(r[0])),r){const t=n.getViewData();if(e)r.forEach((t=>{i.push(n.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(s=n.getViewDataStatistics)||void 0===s?void 0:s.call(n);r.forEach((e=>{var n;(null===(n=null==t?void 0:t.latestData)||void 0===n?void 0:n[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return rk(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;p(t)&&(this._seriesUserId=W(t)),p(i)&&(this._regionUserId=W(i)),p(e)&&(this._seriesIndex=W(e)),p(n)&&(this._regionIndex=W(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),rk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&H(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(rk(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;t{var n,s;return(null===(n=null==e?void 0:e[i])||void 0===n?void 0:n.visible)!==(null===(s=null==t?void 0:t[i])||void 0===s?void 0:s.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var n;if(t.domainLine&&t.domainLine.visible?i.line=((n=IR(n=t.domainLine)).startSymbol=IR(n.startSymbol),n.endSymbol=IR(n.endSymbol),n):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,n,s)=>{var r;const a=t.label.style(e.rawValue,i,e,n,s);return LR(iR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:LR(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,n,s,r)=>LR(t[i](e.rawValue,n,e,s,r)):B(t[i])||(e[i]=LR(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,n,s)=>{var r;const a=t.tick.style(e,i,n,s);return LR(iR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:LR(t.tick.style)),t.tick.state&&(i.tick.state=PR(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,n,s)=>{var r;const a=t.subTick.style(e,i,n,s);return LR(iR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:LR(t.subTick.style)),t.subTick.state&&(i.subTick.state=PR(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const n=t.title,{autoRotate:s,angle:r,style:a={},background:o,state:l,shape:h}=n,c=e(n,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||s&&u(p)&&(p="left"===t.orient?-90:90,d=KI[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Gt(p):null,textStyle:iR({},d,LR(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:LR(h.style)}),h.state&&(i.title.state.shape=PR(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:LR(o.style)}),o.state&&(i.title.state.background=PR(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=PR(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=LR(t.background.style)),t.background.state&&(i.panel.state=PR(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var n,s;const r=t.grid.style(null===(n=e.datum)||void 0===n?void 0:n.rawValue,i,e.datum);return LR(iR({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:LR(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:LR(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=YI(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){hO(this._option.dataSet,"scale",JL),lO(this._option.dataSet,"ticks",RA);return new fi(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:n,tickStep:s,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:n,tickStep:s,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var n;null===(n=null==i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}QL.specKey="axes";const tD=()=>{kw.registerGraphicComponent(Pk.lineAxis,((t,e)=>new gS(t,e))),kw.registerGraphicComponent(Pk.circleAxis,(t=>new yS(t))),kw.registerComponent(Ok.axis,gC),kw.registerGraphicComponent(Lk.lineAxisGrid,((t,e)=>new DA(t,e))),kw.registerGraphicComponent(Lk.circleAxisGrid,((t,e)=>new jA(t,e))),kw.registerComponent(Ok.grid,mC),qL(),DR.registerAnimation("axis",(()=>({appear:{custom:bS},update:{custom:_S},exit:{custom:Va}})))},eD=[zI];class iD extends QL{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,n){super(i,n),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),rk(this._regions,(t=>{const e=this.getOrient();HR(e)?t.setXAxisHelper(this.axisHelper()):GR(e)?t.setYAxisHelper(this.axisHelper()):UR(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:n}=i,s=e(i,["grid"]),r=this._axisMark.getProduct(),a=iR({x:t.x,y:t.y},this._axisStyle,s);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(iR({x:t.x,y:t.y},this._getGridAttributes(),n))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=HR(this.getOrient()),s=t=>{var e;return(n?!HR(t.getOrient()):HR(t.getOrient()))&&SS(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>s(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=WR(i,["z"]),UR(this._orient)&&(this.layoutType="absolute"),this._dataSet=n.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!ZI(e))return null;const{axisType:t,componentName:n}=YR(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:n}]}const n=e.filter((t=>"z"===t.orient))[0];let s=!0;if(n){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>GR(t.orient)))[0];s=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));s||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!ZI(t))return;const{axisType:n,componentName:s}=YR(t,i);t.type=n,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:s})})),a}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]),r=DR.getComponentInKey(s.type);return r?new r(n,Object.assign(Object.assign({},i),s)):(i.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:n,right:s,top:r,bottom:a}=this._innerOffset;let o=[];HR(this.getOrient())?A(e)&&(o=this._inverse?[e-s,n]:[n,e-s]):UR(this.getOrient())?A(e)&&(o=this._inverse?[e-s,n]:[n,e-s],this._scale.range(o)):A(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(eD.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){HR(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!HR(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!UR(this.getOrient())&&this._spec.innerOffset){const t=this._spec;GR(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=AB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=AB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=HR(this.getOrient())?t.fieldX:UR(this.getOrient())?t.fieldZ:t.fieldY,SS(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:SS(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(HR(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=HR(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:X(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return rk(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,n;let s;return s=t>0?null===(n=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===n?void 0:n[t]:HR(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:UR(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();rk(this._regions,(e=>{HR(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):GR(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):UR(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=HR(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const n={skipLayout:!1},s=HR(this.getOrient());this.pluginService&&(s?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),n=iR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(n);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,s))}return i}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return tP(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=$I(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(X(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=nD?10:s>=sD?5:s>=rD?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const n=this._scale.domain();if(this.extendDomain(n),this.includeZero(n),this.setDomainMinMax(n),this.niceDomain(n),this._scale.domain(n,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,n=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*n)/n:t}}class oD extends iD{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uA}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}oD.type=r.cartesianLinearAxis,oD.specKey="axes",U(oD,aD);const lD=()=>{tD(),DR.registerComponent(oD.type,oD)};class hD extends iD{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new WS}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DS(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:n,bandSizeLevel:s=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};s=Math.min(s,this._scales.length-1);for(let t=s;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===s?a:0;if(u(r)||t1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((n,s)=>{var r;const a=this._tickDataMap[s],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):n.domain();if(l&&l.length)if(i&&i.length){const n=[],s=[];i.forEach((e=>{l.forEach((i=>{const r=W(e).concat(i);if(s.push(r),o){const e=tP(i,this._getNormalizedValue(r,t));n.push(e)}}))})),o&&e.push(n.filter((t=>t.value>=0&&t.value<=1))),i=s}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>tP(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}});const cD=()=>{tD(),DR.registerComponent(hD.type,hD)};class dD extends oD{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),rk(this._regions,(t=>{HR(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=iR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new fi(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new sI(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,n,s,r,a,o;const l=De.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(n=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===n?void 0:n.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(s=this._spec.layers)||void 0===s?void 0:s[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const n=[],s=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();s&&s.length&&n.push(s.map((e=>tP(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&n.push(r.map((e=>tP(e.value,this._getNormalizedValue([e.value],t))))),n}transformScaleDomain(){}}dD.type=r.cartesianTimeAxis,dD.specKey="axes";class uD extends oD{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fA}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}uD.type=r.cartesianLogAxis,uD.specKey="axes",U(uD,aD);class pD extends oD{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new mA}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}pD.type=r.cartesianSymlogAxis,pD.specKey="axes",U(pD,aD);class gD extends LL{constructor(){super(...arguments),this.type=lk.line,this.transformerConstructor=UL,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(AL(null===(i=DR.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),kL("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=PL(this);this._symbolMark.setAnimationConfig(AL(null===(n=DR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),kL("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}gD.type=lk.line,gD.mark=TM,gD.transformerConstructor=UL,U(gD,FL);class fD{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=W(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{fO(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof fi)return;const n=this.getSeriesData(t.id,i);n&&e(t,n,i)}))}getSeriesData(t,e){var i,n;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(n=this._onError)||void 0===n||n.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class mD{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{Df(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{kR(e,[{key:t,operations:SS(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&kR(e,[{key:i.field,operations:SS(s.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?yB("colorOrdinal"):yB(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Df(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(H(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!H(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Df(n.domain)?e.reRender=!0:H(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Df(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=SS(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=SS(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,n);e&&(n?(u(s[0])?s[0]=e.min:s[0]=Math.min(e.min,s[0]),u(s[1])?s[1]=e.max:s[1]=Math.max(e.max,s[1])):e.values.forEach((t=>{s.add(t)})))}))}));const r=s;SS(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(SS(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=SS(e.type),r=n.getRawDataStatisticsByField(t.field,s);if(!B(r))return"expand"===t.changeDomain?(s?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(s?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));SS(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:s})),s}}class vD{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const n=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),s=n||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=CR(t,!0);for(const e in a)for(const i in a[e].nodes)RR(a[e].nodes[i],t.getStackInverse(),s);if(r)for(const t in a)for(const e in a[t].nodes)BR(a[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&MR(a[i],n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class yD extends LO{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,n,s,r;super(e),this.type="chart",this.id=Pf(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:dk,height:uk},this._viewRect={width:dk,height:uk},this._viewBox={x1:0,y1:0,x2:dk,y2:uk},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>W(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=wB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new sO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new fD(this._dataSet,null===(n=this._option)||void 0===n?void 0:n.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new vD(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=N(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=DR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]),r=new t(n,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]);let r;if(p(n.regionId)?r=this.getRegionsInUserId(n.regionId):p(n.regionIndex)&&(r=this.getRegionsInIndex([n.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(n,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:n.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var n;if((null!==(n=i.specKey)&&void 0!==n?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let n=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(n=!0);const s=DR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:n?"layout3d":"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,n,s,r;if(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===n||n.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===r||r.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof HO)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const n=this.getComponentByUserId(t);return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof oI))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof oI)return e}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&(s.markRunning(),s.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){W(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),W(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&fO(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=TO(this._spec,this._option,{width:dk,height:uk})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const n=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=lB(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new mD(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){CO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=lB(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),n=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(n))return e.reMake=!0,e;for(let n=0;n{CO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n,s;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(n=this._spec[a])&&void 0!==n?n:{};_(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,CO(t,i.updateSpec(null!==(s=o[i.getSpecIndex()])&&void 0!==s?s:{},o))):CO(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];CO(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:n=0,x2:s,y2:r}=e;i={width:s-t,height:r-n}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=kB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(B(t[n]))continue;const s=t[n];let r={stateValue:n};r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(bO.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(bO.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(bO.STATE_SELECTED)}clearHovered(){this.clearState(bO.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?W(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||d(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=i.slice();o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.startInteraction(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===iO.dimensionHover||n===iO.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>kS(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{var e,s,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(s=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===s?void 0:s[o])&&void 0!==a?a:n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const _D=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=W(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return W(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class bD{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,n)=>{const{spec:s,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(s,t,n);qB(t,r,l.spec),qB(n,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,n;e||(e=(e,i,n)=>{const{spec:s,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));qB(n,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(s,t)}))});const s={};return this.forEachRegionInSpec(t,e,s),this.forEachSeriesInSpec(t,e,s),null===(i=s.series)||void 0===i||i.forEach(((t,e)=>{var i,n;const r=(null!==(n=null!==(i=_D(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,s),Object.values(null!==(n=s.component)&&void 0!==n?n:{}).forEach((t=>t.forEach(((t,e)=>{var i,n,r;if(t){if(!t.regionIndexes){const e=null!==(n=null!==(i=_D(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const n=t.spec,{seriesId:s,seriesIndex:r}=n;if(p(s)){const t=W(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return W(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,s);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,n;const r=null===(i=s.region)||void 0===i?void 0:i[t];null===(n=null==r?void 0:r.seriesIndexes)||void 0===n||n.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),s}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,n,s;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(s=(n=this._option).getTheme)||void 0===s?void 0:s.call(n).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var n;return(null!==(n=t.region)&&void 0!==n?n:[]).map(((t,n)=>e(DR.getRegionInType("region"),{spec:t,specPath:["region",n],type:"region",regionIndexes:[n]},i)))}forEachSeriesInSpec(t,e,i){var n;return(null!==(n=t.series)&&void 0!==n?n:[]).map(((t,n)=>e(DR.getSeriesInType(t.type),{spec:t,specPath:["series",n],type:t.type,seriesIndexes:[n]},i)))}forEachComponentInSpec(t,e,i){var n,s,a;const o=[],l=DR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=DR.getComponentInKey(t.type);o.push(e(n,t,i))})))}if(c&&!g){const n=c.getSpecInfo(t,i);(null==n?void 0:n.length)>0&&(g=!0,n.forEach((t=>{const n=DR.getComponentInKey(t.type);o.push(e(n,t,i))})))}return d&&!g&&(null===(s=d.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((n=>{var s;null===(s=n.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(n,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const n="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],s=i.find((i=>{if(!n.includes(i.orient))return!1;if(p(i.seriesId)){if(W(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(W(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return s}_applyAxisBandSize(t,e,i){const{barMaxWidth:n,barMinWidth:s,barWidth:r,barGapInGroup:a}=i;let o=!1;S(s)?(t.minBandSize=s,o=!0):S(r)?(t.minBandSize=r,o=!0):S(n)&&(t.minBandSize=n,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class xD extends bD{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:n}=i;"top"!==n&&"bottom"!==n||(e.x=!0),"left"!==n&&"right"!==n||(e.y=!0),"z"===n&&(e.z=!0),R(i,"trimPadding")&&iR(i,EO(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class SD extends xD{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),wO(t)}}class AD extends yD{constructor(){super(...arguments),this.transformerConstructor=SD,this.type="line",this.seriesType=lk.line,this._canStack=!0}}AD.type="line",AD.seriesType=lk.line,AD.transformerConstructor=SD;function kD(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const wD=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:kD(t,e)}),TD=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:kD(t,e)}),CD={type:"fadeIn"},ED={type:"growCenterIn"};function MD(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CD;case"scaleIn":return ED;default:return wD(t)}}class BD extends oI{constructor(){super(...arguments),this.type=BD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}BD.type="rect";const RD=()=>{DR.registerMark(BD.type,BD),kb(),bb(),kw.registerGraphic(Rk.rect,Ac),dC.useRegisters([mE,vE,yE,_E,gE,fE])};function OD(t,e,i){var n,s;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):_B(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[yM]):_B(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_M]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):_B(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bM]):_B(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},LD.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:CL(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(LD.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const n=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let s;if(lO(this._option.dataSet,"addVChartProperty",gL),n){const t=([t],{scaleDepth:e})=>{var i,n;let s=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[n,s]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[n]}-${t[s]}`;r[e]||(r[e]={[n]:t[n],[s]:t[s]},i.push(r[e]))})),i};lO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();s=new fi(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:bL.bind(this),call:xL}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new _L(this._option,s)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,s,r,a;e._bar_series_position_calculated=!0,t?(i=bM,n=_M,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=yM,n=vM,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=CR(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)OD(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:s,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,n;let s,r,a;e?(s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(n=(i=this[a]).getScale)||void 0===n?void 0:n.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=_B(this[s](t),o),d=_B(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,n;if(!this._spec.stackCornerRadius)return;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,n=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[JE],s=t[QE],r=t[tM],h=t[eM];i=Math.min(i,e,s),n=Math.max(n,e,s),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[JE]:i,[QE]:n}),a?{[tM]:o,[eM]:l}:void 0);t.push(Ac(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,s),x1:this._getBarXEnd(h,s),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,n,s;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>_B(this._dataToPosY(t),a),y1:t=>_B(this._dataToPosY1(t),a)}:{y:t=>_B(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>_B(this._dataToPosX(t),r),x1:t=>_B(this._dataToPosX1(t),r)}:{x:t=>_B(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,n,s,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,s=PL(this);this._barMark.setAnimationConfig(AL(null===(e=DR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),kL(this._barMarkName,this._spec,this._markAttributeContext),s))}_getBarWidth(t,e){var i,n;const s=this._groups?this._groups.fields.length:1,r=u(e)?s:Math.min(s,e),a=null!==(n=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==n?n:6,o=void 0!==this._spec.barWidth&&r===s,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=CB(this._spec.barWidth,a)),l&&(c=Math.max(c,CB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,CB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,n){var s,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===n?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===n?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(s=h.getBandwidth)||void 0===s?void 0:s.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=W(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=CB(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(n+=u*y+(u-1)*p,s+=g*(y+p)):(s+=g*(n+p),n+=n+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-n/2+s}const _=SS(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],n=this._fieldY,s=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:n[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._barBackgroundViewData)||void 0===n||n.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}LD.type=lk.bar,LD.mark=AM,LD.transformerConstructor=PD;const DD=()=>{RC(),RD(),DR.registerAnimation("bar",((t,e)=>({appear:MD(t,e),enter:wD(t,!1),exit:TD(t,!1),disappear:TD(t)}))),cD(),lD(),DR.registerSeries(LD.type,LD)};class FD extends xD{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),wO(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const n=t.series.some((t=>"horizontal"===t.direction)),s=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(n?["left","right"]:["top","bottom"]).includes(t.orient)));if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(s,e,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class jD extends yD{constructor(){super(...arguments),this.transformerConstructor=FD,this.type="bar",this.seriesType=lk.bar,this._canStack=!0}}jD.type="bar",jD.seriesType=lk.bar,jD.transformerConstructor=FD;class ND extends jL{constructor(){super(...arguments),this.type=ND.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}ND.type="area";const zD=()=>{DR.registerMark(ND.type,ND),kb(),lb(),kw.registerGraphic(Rk.area,Nc),vI()};class VD extends kP{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of W(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const HD=()=>{DR.registerAnimation("area",fI),mI(),gI()};class GD extends UL{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,n;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(n=l.style)||void 0===n?void 0:n.visible),u=!1!==h.visible&&!1!==(null===(s=h.style)||void 0===s?void 0:s.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=iR({},f.style,g.style),l.state=iR({},f.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class UD extends LL{constructor(){super(...arguments),this.type=lk.area,this.transformerConstructor=GD,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},n=this._spec.area||{},s=!1!==n.visible&&!1!==(null===(t=n.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(UD.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:s&&"point"!==r,customShape:n.customShape,stateSort:n.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,n,s,r;const a=null!==(n=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==n?n:null===(r=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.curveType,o=a===DL?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return _B(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return _B(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(AL(null===(e=DR.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),kL("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(AL(null===(i=DR.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),kL("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=PL(this);this._symbolMark.setAnimationConfig(AL(null===(n=DR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),kL("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new VD(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,s,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}UD.type=lk.area,UD.mark=EM,UD.transformerConstructor=GD,U(UD,FL);class WD extends xD{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),wO(t)}}class YD extends yD{constructor(){super(...arguments),this.transformerConstructor=WD,this.type="area",this.seriesType=lk.area,this._canStack=!0}}YD.type="area",YD.seriesType=lk.area,YD.transformerConstructor=WD;class KD extends OL{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?W(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?W(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=W(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(W(t)),n=this.radiusAxisHelper.dataToPosition(W(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};SS(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};SS(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&IL(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const XD=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=Kt(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let f=0,m=-1/0;for(let t=0;tNumber(t[n]))),_=r-s;let b=s,x=_,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const n=Math.pow(10,e),s=t.map((t=>(isNaN(t)?0:t)/i*n*100)),r=100*n,a=s.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=s.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/n))}(y);if(i.forEach(((t,e)=>{const i=t[_k],n=f?i/f:0;let s=n*_;s{g(e,s+i*t,t)}))}else{const t=x/S;b=s,i.forEach((e=>{const i=e[c]===a?a:e[_k]*t;g(e,b,i),b+=i}))}return 0!==f&&(i[i.length-1][l]=r),i};function $D(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const ZD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:$D(t,!0,yO.appear)}),qD={type:"fadeIn"},JD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:$D(t,!0,yO.enter)}),QD=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:$D(t,!0,yO.exit)}),tF=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:$D(t,!0,yO.exit)});function eF(t,e){if(!1===e)return{};switch(e){case"fadeIn":return qD;case"growRadius":return ZD(Object.assign(Object.assign({},t),{growField:"radius"}));default:return ZD(Object.assign(Object.assign({},t),{growField:"angle"}))}}class iF extends oI{constructor(t,e){super(t,e),this.type=nF.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this.getAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>Wt({x:0,y:0},this.getAttribute("centerOffset",e,i,n),e[kk])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class nF extends iF{constructor(){super(...arguments),this.type=nF.type}}nF.type="arc";const sF=()=>{kb(),ab(),kw.registerGraphic(Rk.arc,Hc),dC.useRegisters([EE,ME,TE,CE]),DR.registerMark(nF.type,nF)};class rF extends RL{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);n=iR({},this._theme,i,t);const s=(t,e)=>iR({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(n.label)?n.label=n.label.map((t=>s(t.position,t))):n.label=s(n.label.position,n.label)}return{spec:n,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:n,centerY:s}=t;return p(n)&&(i.centerX=n),p(s)&&(i.centerY=s),Object.keys(i).length>0?i:void 0}}class aF extends KD{constructor(){super(...arguments),this.transformerConstructor=rF,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=Ck,this._endAngle=Ek,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[kk];if(u(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return Wt(this.computeCenter(t),(i+n)/2,e)}}getCenter(){var t,e,i,n;const{width:s,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:s/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,n=2*Math.PI;const s=p(t),r=p(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(p(this._spec.startAngle)?Gt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Gt(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?Gt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;lO(this._dataSet,"pie",XD),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?Gt(this._spec.minAngle):0,asStartAngle:xk,asEndAngle:Sk,asRatio:bk,asMiddleAngle:kk,asRadian:Tk,asQuadrant:wk,asK:Ak}},!1);const e=new fi(this._dataSet,{name:`${ck}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new _L(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},aF.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:CL(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:KE,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return ok(xk)(t)}endAngleScale(t){return ok(Sk)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:bB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:bB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,n){if(super.initMarkStyleWithSpec(e,i,n),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const n in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[n]),n,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:ok(mk).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:n,centerY:s,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===s&&t.centerX===n&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[kk];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return Wt(this.computeCenter(t),n,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n;if(i===yO.appear)return this._startAngle;if(i===yO.disappear)return this._endAngle;const s=[yO.disappear,yO.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[YE];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[YE]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[YE])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[YE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Wt({x:0,y:0},a,e[kk]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Wt({x:0,y:0},a,e[kk]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Wt({x:0,y:0},a,e[kk]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Wt({x:0,y:0},a,e[kk]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}aF.transformerConstructor=rF,aF.mark=BM;class oF extends aF{constructor(){super(...arguments),this.type=lk.pie}}oF.type=lk.pie;const lF=()=>{sF(),DR.registerAnimation("pie",((t,e)=>({appear:eF(t,e),enter:JD(t),exit:QD(t),disappear:tF(t)}))),DR.registerSeries(oF.type,oF)};class hF extends bD{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=W(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return p(r)&&s.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),s}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class cF extends hF{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class dF extends yD{constructor(){super(...arguments),this.transformerConstructor=cF}}dF.transformerConstructor=cF;class uF extends dF{constructor(){super(...arguments),this.transformerConstructor=cF,this.type="pie",this.seriesType=lk.pie}}uF.type="pie",uF.seriesType=lk.pie,uF.transformerConstructor=cF;class pF extends bD{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var n;if("bar"===e.type){const s=this._findBandAxisBySeries(e,i,t.axes);if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize){const t=g(e.autoBandSize)&&null!==(n=e.autoBandSize.extend)&&void 0!==n?n:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(s,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&iR(e,EO(this.type,t))})),this._transformAxisSpec(t)}}class gF extends yD{constructor(){super(...arguments),this.transformerConstructor=pF,this.type="common",this._canStack=!0}}gF.type="common",gF.transformerConstructor=pF;const fF={rect:bF,symbol:yF,arc:SF,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=yF(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:function(t,e,i){const n=t.series,s=t.labelSpec||{},r=n.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=s.position||"withChange",o=s.offset||0,l=e?e(r.data):r.data,h=mF(t,l,s.formatMethod);return h.x=function(t,e,i,n){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-n:e.totalPositionX(t,"end")+(t.end>=t.start?n:-n);return e.totalPositionX(t,"index",.5)}(l,n,a,o),h.y=function(t,e,i,n){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-n;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+n;return e.totalPositionY(t,"end")+(t.end>=t.start?-n:n)}(l,n,a,o),"horizontal"===n.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),uh(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const s=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[n.getDimensionField()[0]])}));s&&(s.data=i,e.push(s))})),e},overlap:{strategy:[]}}},line:AF,area:AF,rect3d:bF,arc3d:SF,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function mF(t,e,i,n){var s;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(s=t.labelSpec.textType)&&void 0!==s?s:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=YI(i,n,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function vF(t){return d(t)?e=>t(e.data):t}function yF(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=vF(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:_F(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function _F(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function bF(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=vF(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(n=o.getXAxisHelper())||void 0===n?void 0:n.isInverse():null===(s=o.getYAxisHelper())||void 0===s?void 0:s.isInverse();let u,p=h;y(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],n=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][n]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:xF(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function xF(t){return[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function SF(t){var e;const{labelSpec:i}=t,n=null!==(e=vF(i.position))&&void 0!==e?e:"outside",s=n;let r;return r=i.smartInvert?i.smartInvert:y(n)&&n.includes("inside"),{position:s,smartInvert:r}}function AF(t){var e,i,n,s;const{labelSpec:r,series:a}=t,o=null===(n=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===n?void 0:n.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(s=r.position)&&void 0!==s?s:"end",data:l}}class kF extends $L{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,H(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}kF.type=r.label;class wF extends oI{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=wF.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}wF.type="text";class TF extends wF{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}TF.type="text",TF.constructorType="label";const CF=()=>{DR.registerMark(TF.constructorType,TF),kb(),Eb(),Sb(),kw.registerGraphic(Rk.text,uh)};class EF extends XL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class MF extends kF{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=EF,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],n=(null==e?void 0:e.region)||[];return n.forEach(((n,s)=>{(n.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:n={}}=i;return Object.values(n).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,s],regionIndexes:[s]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const n=i.getProduct();n&&n.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(n.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),rk(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let s=0;s{if(e.visible){const s=this._labelInfoMap.get(n),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),s.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const n=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});n&&(n.setSkipBeforeLayouted(!0),this._marks.addMark(n),this._labelComponentMap.set(n,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(n))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,n;const{labelMark:s,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(s,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,s,r)}(null===(n=null===(i=s.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&s.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(n.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var s,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(s=this._spec)||void 0===s?void 0:s.centerOffset)&&void 0!==r?r:0,h=iR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:n.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:n}=e;return n.overlap&&!g(n.overlap)&&(n.overlap={}),(null!==(i=fF[t])&&void 0!==i?i:fF.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},N(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,n)=>{if(i[n.labelIndex]){const{labelSpec:e,labelMark:s}=i[n.labelIndex];return s.skipEncode?{data:t}:mF(i[n.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let n;n=_(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:n}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const n=i.getProduct().getGroupGraphicItem();n&&t.push(n)})),t}}MF.type=r.label,MF.specKey="label",MF.transformerConstructor=EF;var BF;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(BF||(BF={}));const RF={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class OF extends $L{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:n}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,n,e,t.activeType);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||H(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,n){const s=i?this._handleOutEvent:n?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};_(e)?e.forEach((t=>{this.event.on(t,r,s)})):this.event.on(e,r,s)}_eventOff(t,e,i){const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,n)})):this.event.off(t,n)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),n={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},n),{x:n.x-this.getLayoutStartPoint().x,y:n.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Rf(e)||Of(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=W(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const n=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=R(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{RF[t].includes(e.getOrient())&&s.push(i)}))),!s.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==n&&(this.gridZIndex=n)}_parseField(t,i){var n,s,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,f=e(d,["strokeOpacity","fillOpacity","opacity"]),m="line"===a.type;let v=m?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},f),m)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(s=null===(n=this._spec[i])||void 0===n?void 0:n.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},n=t.style||{},{fill:s="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=n,h=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:s,stroke:r,outerBorder:Object.assign({stroke:s,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((n=>{const s=n.axis;var r,a,o;if(a=e,o=i,((r=n).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const n=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));n&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:n,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:n,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){HR(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{kS(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{value:this._getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,n){var s;let r=t,a=e;if(i&&i.length)if("dimension"===n){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let n;if(e>-1){const i=t.data[e];n=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:GR(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=null==n?void 0:n.y:r=null==n?void 0:n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=ak(this._regions,"cartesian");if(!e)return;const{x:i,y:n,offsetWidth:s,offsetHeight:r,bandWidth:a,bandHeight:o}=iP(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),n&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0}))),i&&this._layoutVertical(i,a,s),n&&this._layoutHorizontal(n,o,r)}_layoutVertical(t,e,i){var n,s;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=rP(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var n,s;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=aP(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s;if(s="x"===t?this._xCrosshair:this._yCrosshair,s)s.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?s=new ax(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(s=new ox(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s}}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new ix(e)),null==n||n.add(t)),function(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}IF.specKey="crosshair",IF.type=r.cartesianCrosshair;class PF{constructor(e){this._showTooltipByHandler=(e,i)=>{var n,s,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(n=a.handler)||void 0===n?void 0:n.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let n;const s=this.component.getChart(),r=s.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),n=[...null!==(e=JR(s,a,!0))&&void 0!==e?e:[],...null!==(i=VR(s,a))&&void 0!==i?i:[]],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!kS(i.getScale().type))return!1;let n;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){n=e;break}if(p(n))break}return p(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:n}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,n)=>{var s,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const n=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(p(n.visible)||p(n.activeType)?d.visible=xP(n).includes(t):p(e.visible)||p(e.activeType)?d.visible=xP(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=n.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==n?void 0:n.length)&&(BP(n).every((t=>{var e;return!xP(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=xP(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=EP(t,i,n),f=MP(t,i,n),m=iR({},P(e[t]),f),v=g.title,y=OP(void 0,m,u.shape,void 0,v);p(m.title)?m.title=TP(m.title,Object.assign(Object.assign({},v),y)):m.title=TP(v,y,!0);const _=W(g.content);if(p(m.content)){const t=RP(_);m.content=CP(m.content,(e=>OP(e,m,u.shape,t)))}else m.content=CP(_,(t=>OP(void 0,m,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),m),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,n))}_updateActualTooltip(t,e){var i,n,s,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=NP(a,t,e),l=!!p(o)&&!1!==PP(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(n=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==n?n:h,this._cacheActualTooltip.content=null!==(r=null===(s=a.updateContent)||void 0===s?void 0:s.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class LF extends PF{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(u(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class DF extends PF{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(u(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t,e){var i;let n,s;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(s=!0)}return{tooltipInfo:n,ignore:s}}}class FF extends PF{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:W(n),series:s}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(u(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("group"))}getMouseEventData(t,e){var i,n;let s,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?W(r.triggerMark):[]).includes(null===(n=t.mark)||void 0===n?void 0:n.name)&&(s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:s,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:n}=t,s=e;if(["line","area"].includes(i.type))return W(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=W(n)[0][a];return r.filter((t=>t[a]===o))}}const jF=t=>p(t)&&!_(t),NF=t=>p(t)&&_(t);class zF extends XL{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:n,theme:s}=super._initTheme(t,e);return n.style=iR({},this._theme,n.style),n.offset=iR({},s.offset,t.offset),n.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:s.transitionDuration,{spec:n,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=xP(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:Of(this._option.mode)||!Bf(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?y(t.parentElement)&&(t.parentElement=gg.getElementById(t.parentElement)):Bf(this._option.mode)&&(t.parentElement=null==Mf?void 0:Mf.body)}}class VF extends $L{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=zF,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,n,s;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return;const r=Bf(null===(s=this._option)||void 0===s?void 0:s.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:n},ignore:{mark:s,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(s&&jF(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&NF(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(n)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(n)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,n,s)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),s)o=!a.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],s=this._isSameAsCache(n,i,t);o=!a.showTooltip(n,i,s),o&&(this._cacheInfo=n,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,n&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&SI.globalConfig.uniqueTooltip&&l&&SI.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:n,ignore:s}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s;const r=n;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:n,ignore:s}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=n,e.ignore[i]=s}return e},this._hideTooltipByHandler=e=>{var i,n,s,r;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(s=this._spec.handler)||void 0===s?void 0:s.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!_(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?LP.canvas:LP.dom,s=DR.getComponentPluginInType(t);s||Tf("Can not find tooltip handler: "+t);const r=new s;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new DF(this),dimension:new LF(this),group:new FF(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=W(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(Rf(i)||Of(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const n=_P(t,e,this);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(NF(t)){if(jF(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>FR(t,e[i])))))return!1}else{if(NF(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:n,y:s}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return n>=a&&n<=a+l&&s>=o&&s<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(p(n.nativeEvent)){const t=n.nativeEvent;s=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(s)&&Pe(s,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}VF.type=r.tooltip,VF.transformerConstructor=zF,VF.specKey="tooltip";function HF(t,i){const{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:y,padding:_}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=function(t){var e,i;const n=Object.assign({},t);return B(t.style)||(n.textStyle=LR(t.style)),B(t.textStyle)||iR(n.textStyle,LR(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&LR(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&LR(n.background.style),n}(n)),B(s.focusIconStyle)||LR(s.focusIconStyle),s.shape&&(s.shape=IR(s.shape)),s.label&&(s.label=IR(s.label)),s.value&&(s.value=IR(s.value)),s.background&&(s.background=IR(s.background)),SB(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*i.width/100),SB(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*i.width/100),SB(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*i.width/100),b.item=s,"scrollbar"===r.type?(B(r.railStyle)||LR(r.railStyle),B(r.sliderStyle)||LR(r.sliderStyle)):(B(r.textStyle)||LR(r.textStyle),r.handler&&IR(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(iR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const GF=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},UF=(t,e)=>{var i,n,s;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:XE;return _(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class WF extends $L{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{rk(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),rk(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=xB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:n,seriesIndex:s}=this._spec;p(n)&&(this._seriesUserId=W(n)),p(e)&&(this._regionUserId=W(e)),p(s)&&(this._seriesIndex=W(s)),p(i)&&(this._regionUserIndex=W(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(H(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new sI(this._option,e),this._initSelectedData(),rk(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,n,s;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(rk(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(n=(i=this.effect).onSelectedDataChange)||void 0===n||n.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)H(n,this._cacheAttrs)||this._legendComponent.setAttributes(iR({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(iR({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:n,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(n-s)/2:"end"===i&&(o=n-s):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+s,i.y2=i.y1+r,i}onDataUpdate(){var e,i,n;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());H(t,this._cacheAttrs)||this._legendComponent.setAttributes(iR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(n=this.getChart())||void 0===n||n.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}WF.specKey="legends";class YF extends WF{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!_(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),rk(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:mO.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){lO(this._option.dataSet,"discreteLegendFilter",UF),lO(this._option.dataSet,"discreteLegendDataMake",GF);const t=new fi(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return rk(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,n;const s=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return s;if(!t.getRawData())return s;const a=this._option.globalScale.getScaleSpec(r);if(!a)return s;if(this._spec.field)return this._spec.field;if(!Df(a.domain))return s;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(n=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==n?n:s}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=TR(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},HF(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return qA}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(YA.legendItemClick,(i=>{const n=R(i,"detail.currentSelected");e&&this.setSelectedData(n),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:n,event:i})})),this._legendComponent.addEventListener(YA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(YA.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const n=t.style("fillOpacity"),s=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(n)?n:1,strokeOpacity:A(s)?s:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,n,s;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(s=null===(n=this._spec.item)||void 0===n?void 0:n.value)&&void 0!==s?s:{},{formatFunc:h}=YI(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=YI(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}YF.specKey="legends",YF.type=r.discreteLegend;SI.useRegisters([()=>{RC(),OC(),zL(),GL(),mI(),gI(),cD(),lD(),DR.registerSeries(gD.type,gD),DR.registerChart(AD.type,AD)},()=>{RC(),OC(),zL(),zD(),GL(),HD(),cD(),lD(),DR.registerSeries(UD.type,UD),DR.registerChart(YD.type,YD)},()=>{DD(),DR.registerChart(jD.type,jD)},()=>{lF(),DR.registerChart(uF.type,uF)},()=>{DR.registerChart(gF.type,gF)},lD,cD,()=>{DR.registerComponent(YF.type,YF)},()=>{DR.registerComponent(VF.type,VF)},()=>{DR.registerComponent(IF.type,IF)},()=>{kw.registerGraphicComponent(Ok.label,(t=>new Vx(t))),kw.registerComponent(Ok.label,fC),CF(),qL(),DR.registerComponent(MF.type,MF,!0)},pL,OI,Uw,Gw]),SI.useRegisters([()=>{Xy(Zs)}]),t.ARC_END_ANGLE=Sk,t.ARC_K=Ak,t.ARC_MIDDLE_ANGLE=kk,t.ARC_QUADRANT=wk,t.ARC_RADIAN=Tk,t.ARC_RATIO=bk,t.ARC_START_ANGLE=xk,t.ARC_TRANSFORM_VALUE=_k,t.AxisSyncPlugin=zI,t.BASE_EVENTS=FE,t.CORRELATION_SIZE=UE,t.CORRELATION_X=HE,t.CORRELATION_Y=GE,t.CanvasTooltipHandler=uL,t.DEFAULT_CHART_HEIGHT=uk,t.DEFAULT_CHART_WIDTH=dk,t.DEFAULT_CONICAL_GRADIENT_CONFIG=gM,t.DEFAULT_DATA_INDEX=YE,t.DEFAULT_DATA_KEY=KE,t.DEFAULT_DATA_SERIES_FIELD=XE,t.DEFAULT_GRADIENT_CONFIG=fM,t.DEFAULT_LABEL_ALIGN=gk,t.DEFAULT_LABEL_LIMIT=pk,t.DEFAULT_LABEL_TEXT=fk,t.DEFAULT_LABEL_VISIBLE=mk,t.DEFAULT_LABEL_X=vk,t.DEFAULT_LABEL_Y=yk,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=uM,t.DEFAULT_MEASURE_CANVAS_ID=WE,t.DEFAULT_RADIAL_GRADIENT_CONFIG=pM,t.DEFAULT_SERIES_STYLE_NAME=$E,t.DomTooltipHandler=dL,t.Factory=DR,t.FormatterPlugin=RI,t.GradientType=dM,t.MediaQuery=CI,t.POLAR_DEFAULT_RADIUS=.6,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=Ek,t.POLAR_START_ANGLE=-90,t.POLAR_START_RADIAN=Ck,t.PREFIX=ck,t.SEGMENT_FIELD_END=lM,t.SEGMENT_FIELD_START=oM,t.STACK_FIELD_END=QE,t.STACK_FIELD_END_OffsetSilhouette=nM,t.STACK_FIELD_END_PERCENT=eM,t.STACK_FIELD_KEY=qE,t.STACK_FIELD_START=JE,t.STACK_FIELD_START_OffsetSilhouette=iM,t.STACK_FIELD_START_PERCENT=tM,t.STACK_FIELD_TOTAL=sM,t.STACK_FIELD_TOTAL_PERCENT=rM,t.STACK_FIELD_TOTAL_TOP=aM,t.ThemeManager=bR,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=SI,t.WaterfallDefaultSeriesField=VE,t.builtinThemes=hR,t.computeActualDataScheme=hB,t.darkTheme=$B,t.dataScheme=EB,t.default=SI,t.defaultThemeName=cR,t.getActualColor=dB,t.getColorSchemeBySeries=fB,t.getDataScheme=lB,t.getMergedTheme=yR,t.getTheme=fR,t.hasThemeMerged=pR,t.isColorKey=uB,t.isProgressiveDataColorScheme=pB,t.isTokenKey=YB,t.lightTheme=XB,t.queryColorFromColorScheme=cB,t.queryToken=WB,t.registerCanvasTooltipHandler=pL,t.registerChartPlugin=TI,t.registerDomTooltipHandler=()=>{cL(dL)},t.registerFormatPlugin=OI,t.registerMediaQuery=()=>{TI(CI)},t.registerTheme=gR,t.removeTheme=mR,t.themeExist=vR,t.themes=dR,t.token=KB,t.transformColorSchemeToStandardStruct=gB,t.version="1.11.11",t.vglobal=gg,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var s,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(s=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s.tt="tt",s.harmony="harmony",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const M=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(M.call(t,e))return!1;return!0}var R=(t,e,i)=>{const n=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function P(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=_(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=P(n)}return e}function L(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];p(n[r])&&"object"==typeof n[r]?D(t,e,r,i):F(t,r,n[r])}}}}function D(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(_(r)){if(n)a=[];else if(_(s))a=s;else if(b(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const s=t[n];let r=!1;e.forEach((t=>{(y(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(i[n]=s)})),i}function z(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function H(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(z(t)!==z(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!H(t[n],e[n],i))return!1;return!0}if(!m(t))return!1;const n=V(t),s=V(e);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){const r=n[s];if(!H(t[r],e[r],i))return!1}return!0}function G(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;s{var i;if(0===t.length)return;let n=t[0];for(let s=1;s0)&&(n=r)}return n},X=(t,e)=>{var i;if(0===t.length)return;let n=t[0];for(let s=1;se?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const n=[e].concat([].slice.call(i));Q&&console[t].apply(console,n)}var et;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(et||(et={}));class it{static getInstance(t,e){return it._instance&&S(t)?it._instance.level(t):it._instance||(it._instance=new it(t,e)),it._instance}static setInstance(t){return it._instance=t}static setInstanceLevel(t){it._instance?it._instance.level(t):it._instance=new it(t)}static clearInstance(){it._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=et.Info}canLogDebug(){return this._level>=et.Debug}canLogError(){return this._level>=et.Error}canLogWarn(){return this._level>=et.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):tt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Warn&&tt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Info&&tt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Debug&&tt(this._method||"log","DEBUG",e),this}}function nt(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(u(n)&&(n=t.length);i>>1;q(t[s],e)>0?n=s:i=s+1}return i}it._instance=null;const st=1e-10,rt=1e-10;function at(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:st,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:rt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function ot(t,e,i,n){return t>e&&!at(t,e,i,n)}function lt(t,e,i,n){return t{let e=null,i=null;return function(){for(var n=arguments.length,s=new Array(n),r=0;rt===e[i]))||(e=s,i=t(...s)),i}};var ct=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,n=e-(t-l);return d?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,u&&n?f(t):(n=s=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_t=new RegExp(yt.source,"g");const bt=1e-12,xt=Math.PI,St=xt/2,At=2*xt,kt=2*Math.PI,wt=Math.abs,Tt=Math.atan2,Ct=Math.cos,Et=Math.max,Mt=Math.min,Bt=Math.sin,Rt=Math.sqrt,Ot=Math.pow;function It(t){return t>1?0:t<-1?xt:Math.acos(t)}function Pt(t){return t>=1?St:t<=-1?-St:Math.asin(t)}function Lt(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function Dt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ft(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class jt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new jt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Nt{static distancePP(t,e){return Rt(Ot(t.x-e.x,2)+Ot(t.y-e.y,2))}static distanceNN(t,e,i,n){return Rt(Ot(t-i,2)+Ot(e-n,2))}static distancePN(t,e,i){return Rt(Ot(e-t.x,2)+Ot(i-t.y,2))}static pointAtPP(t,e,i){return new jt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function zt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return zt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Ht extends Vt{}function Gt(t){return t*(Math.PI/180)}const Ut=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-At;)t+=At;else if(t>0)for(;t>At;)t-=At;return t};function Wt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Yt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function Kt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Xt(t,e,i,n){const{x:s,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const n=Kt(Math.min(t,e)),s=n+i,r=[n,s];let a=Math.floor(n/Math.PI)*Math.PI/2;for(;an&&r.push(a),a+=Math.PI/2;return r}(i,n),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-s):-1===i?h.push(s):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-s)/e)):h.push(Math.abs(s/e)))})),Math.min.apply(null,h)}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new $t,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new $t;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new $t(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class Zt{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:s=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=s)););if(in;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function qt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return S(t)?new oe(t>>16,t>>8&255,255&t,1):_(t)?new oe(t[0],t[1],t[2]):new oe(255,255,255)}function se(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function re(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ae{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ae(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ae?t:new ae(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(te[t]))return function(t){return S(t)?new oe(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new oe(t[0],t[1],t[2],t[3]):new oe(255,255,255,1)}(te[t]);if(p(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new oe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new oe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new oe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=qt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new oe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new oe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=qt(u(t)?s.h:ct(t,0,360),u(e)?s.s:e>=0&&e<=1?100*e:e,u(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new oe(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e),n=parseInt(i[1],16),s=i[1].length;return 3===s?new oe((n>>8&15)+((n>>8&15)<<4),(n>>4&15)+((n>>4&15)<<4),(15&n)+((15&n)<<4),1):6===s?ne(n):8===s?new oe(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):this}setColorName(t){const e=ee[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new ae(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=se(t.color.r),this.color.g=se(t.color.g),this.color.b=se(t.color.b),this}copyLinearToSRGB(t){return this.color.r=re(t.color.r),this.color.g=re(t.color.g),this.color.b=re(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class oe{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function le(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new oe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Jt});function ce(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let de,ue,pe,ge,fe,me,ve,ye;function _e(t,e,i,n){if(!function(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&h<=1&&[t[0]+s[0]*h,t[1]+s[1]*h]}var be;function xe(t,e,i){return!(t&&e&&(i?(de=t.x1,ue=t.x2,pe=t.y1,ge=t.y2,fe=e.x1,me=e.x2,ve=e.y1,ye=e.y2,de>ue&&([de,ue]=[ue,de]),pe>ge&&([pe,ge]=[ge,pe]),fe>me&&([fe,me]=[me,fe]),ve>ye&&([ve,ye]=[ye,ve]),de>me||ueye||gee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?t.angle:Gt(t.angle),n=ke(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const Te=1e-8;function Ce(t,e,i){let n=0,s=t[0];if(!s)return!1;for(let r=1;re&&r>n||rs?o:0}function Me(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class Re{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";const Oe=(t,e)=>{const{x1:i,x2:n,y1:s,y2:r}=t,a=Math.abs(n-i),o=Math.abs(r-s);let l=(i+n)/2,h=(s+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function Ie(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Pe(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const e=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,r=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?n:r}}return{width:i,height:n}}function Le(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const De=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();class Fe{static getInstance(){return Fe.instance||(Fe.instance=new Fe),Fe.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r1?s[0]+s.slice(2):s,+i.slice(n+1)]}let Ne;function ze(t,e){const i=je(t,e);if(!i)return t+"";const n=i[0],s=i[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}class Ve{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const He=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ge(t){let e;if(e=He.exec(t))return new Ve({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});it.getInstance().error("invalid format: "+t)}const Ue=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class We{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,n){let s=t.length;const r=[];let a=0,o=e[0],l=0;for(;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),r.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return We.instance||(We.instance=new We),We.instance}newFormat(t){const e=Ge(t);let i=e.fill,n=e.align;const s=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Ye[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===n)&&(a=!0,i="0",n="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Ye[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,n=-1;t:for(let s=1;s0&&(n=0)}return n>0?t.slice(0,n)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==s&&(t=!1),S=(t?"("===s?s:v:"-"===s||"("===s?"":s)+S,A=("s"===d?Ue[8+Ne/3]:"")+A+(t&&"("===s?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let w=S.length+k.length+A.length,T=w>1)+S+k+A+T.slice(w);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ge(t);i.type="f";const n=this.newFormat(i.toString()),s=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=je(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-s),a=Ue[8+s/3];return function(t){return n(r*t)+a}}}const Ye={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ze(100*t,e),r:ze,s:function(t,e){const i=je(t,e);if(!i)return t+"";const n=i[0],s=i[1],r=s-(Ne=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return r===a?n:r>a?n+new Array(r-a+1).join("0"):r>0?n.slice(0,r)+"."+n.slice(r):"0."+new Array(1-r).join("0")+je(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const Ke=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ii(e,6):ii(e,4))+"-"+ii(t.getUTCMonth()+1,2)+"-"+ii(t.getUTCDate(),2)+(r?"T"+ii(i,2)+":"+ii(n,2)+":"+ii(s,2)+"."+ii(r,3)+"Z":s?"T"+ii(i,2)+":"+ii(n,2)+":"+ii(s,2)+"Z":n||i?"T"+ii(i,2)+":"+ii(n,2)+"Z":"")}function si(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Qe;if(h)return h=!1,Je;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ze.DSV;const i=Ke(oi,e),{delimiter:n}=i;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return si(n).parse(t)},hi=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ze.DSV,ri(t)},ci=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ze.DSV,ai(t)},di=(t,e,i)=>{const n=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ui=0;function pi(){return ui>1e8&&(ui=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ui++}class gi{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:pi("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:it.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const fi="_data-view-diff-rank";class mi{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:pi("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[fi]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[fi]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[fi]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",qe),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class vi{static GenAutoIncrementId(){return vi.auto_increment_id++}}vi.auto_increment_id=0;class yi{constructor(t){this.id=vi.GenAutoIncrementId(),this.registry=t}}const _i="named",bi="inject",xi="multi_inject",Si="inversify:tagged",Ai="inversify:paramtypes";class ki{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_i?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var wi=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,n=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",s=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[s]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const n=this._keys.length;for(let t=i+1;t{Ti(e,0,n,t)}}function Ei(t){return e=>(i,n,s)=>Ci(new ki(t,e))(i,n,s)}const Mi=Ei(bi),Bi=Ei(xi);function Ri(){return function(t){return wi.defineMetadata(Ai,null,t),t}}function Oi(t){return Ci(new ki(_i,t))}const Ii="Singleton",Pi="Transient",Li="ConstantValue",Di="DynamicValue",Fi="Factory",ji="Function",Ni="Instance",zi="Invalid";class Vi{constructor(t,e){this.id=vi.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=zi,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Vi(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ii&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Hi{getConstructorMetadata(t){return{compilerGeneratedMetadata:wi.getMetadata(Ai,t),userGeneratedMetadata:wi.getMetadata(Si,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Gi=(Ui=_i,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ui&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ki=Symbol("ContributionProvider");class Xi{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function $i(t,e){t(Ki).toDynamicValue((t=>{let{container:i}=t;return new Xi(e,i)})).inSingletonScope().whenTargetNamed(e)}class Zi{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class qi extends Zi{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Ji=Symbol.for("EnvContribution"),Qi=Symbol.for("VGlobal");var tn=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},en=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nn=function(t,e){return function(i,n){e(i,n,t)}};let sn=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=vi.GenAutoIncrementId(),this.hooks={onSetEnv:new qi(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};sn=tn([Ri(),nn(0,Mi(Ki)),nn(0,Oi(Ji)),en("design:paramtypes",[Object])],sn);const rn=At-1e-8;class an{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>rn)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=At)<0&&(n+=At),(s%=At)<0&&(s+=At),ss;++o,a-=St)g(a);else for(a=n-n%St+St,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ln=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,hn={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},cn={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let dn,un,pn,gn,fn,mn;var vn,yn,_n,bn,xn,Sn,An,kn,wn;function Tn(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),v=.5*(s-n),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,x=i+g+_*p,S=e+f,A=i+m,k=S+_*m,w=A-_*f;return[h*b+c*x,d*b+u*x,h*k+c*w,d*k+u*w,h*S+c*A,d*S+u*A]}function Cn(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,v=-c/n,y=d/n,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===s&&(k=-k);const w=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),C=Math.atan2(b-T,_-w);let E=Math.atan2(S-T,x-w)-C;E<0&&1===r?E+=At:E>0&&0===r&&(E-=At);const M=Math.ceil(Math.abs(E/(St+.001))),B=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function Bn(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class zn extends Nn{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vn(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}function Hn(t,e,i){const n=null!=e?e:wt(i[i.length-1].x-i[0].x)>wt(i[i.length-1].y-i[0].y)?An.ROW:An.COLUMN;return"monotoneY"===t?new zn(t,n):new Nn(t,n)}class Gn{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Un(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=Hn("linear",i,t);return function(t,e){Vn(t,e)}(new Gn(s,n),t),s}function Wn(t,e,i,n,s){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n,t.lastPoint1)}class Yn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Wn(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Wn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Kn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Un(t,e);const s=Hn("basis",i,t);return function(t,e){Vn(t,e)}(new Yn(s,n),t),s}function Xn(t){return t<0?-1:1}function $n(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Xn(r)+Xn(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Zn(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function qn(t,e,i,n,s){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class Jn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:qn(this,this._t0,Zn(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,qn(this,Zn(this,e=$n(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:qn(this,this._t0,e=$n(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Qn extends Jn{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ts(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Un(t,e);const s=Hn("monotoneX",i,t);return function(t,e){Vn(t,e)}(new Jn(s,n),t),s}function es(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Un(t,e);const s=Hn("monotoneY",i,t);return function(t,e){Vn(t,e)}(new Qn(s,n),t),s}let is=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function ns(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new Nn("step",null!=n?n:wt(t[t.length-1].x-t[0].x)>wt(t[t.length-1].y-t[0].y)?An.ROW:An.COLUMN);return function(t,e){Vn(t,e)}(new is(r,e,s),t),r}class ss extends Gn{lineEnd(){this.context.closePath()}}function rs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=Hn("linear",i,t);return function(t,e){Vn(t,e)}(new ss(s,n),t),s}function as(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>bt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>bt){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function os(t,e){return function(i,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Un(i,s);const o=Hn(t,r,i);return Vn(new e(o,n,a),i),o}}const ls=os("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:as(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const hs=os("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:as(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function cs(t,e,i){var n,s;switch(e){case"linear":default:return Un(t,i);case"basis":return Kn(t,i);case"monotoneX":return ts(t,i);case"monotoneY":return es(t,i);case"step":return ns(t,.5,i);case"stepBefore":return ns(t,0,i);case"stepAfter":return ns(t,1,i);case"catmullRom":return ls(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return hs(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return rs(t,i)}}class ds extends on{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new an(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([cn.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([cn.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([cn.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([cn.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([cn.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([cn.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([cn.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([cn.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([cn.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[cn.M]=t=>`M${t[1]} ${t[2]}`,t[cn.L]=t=>`L${t[1]} ${t[2]}`,t[cn.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[cn.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[cn.A]=t=>{const e=[];En(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[cn.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tmn){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Bn(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===An.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.y-e.p1.y)}if(this.direction===An.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const us=["l",0,0,0,0,0,0,0];function ps(t,e,i){const n=us[0]=t[0];if("a"===n||"A"===n)us[1]=e*t[1],us[2]=i*t[2],us[3]=t[3],us[4]=t[4],us[5]=t[5],us[6]=e*t[6],us[7]=i*t[7];else if("h"===n||"H"===n)us[1]=e*t[1];else if("v"===n||"V"===n)us[1]=i*t[1];else for(let n=1,s=t.length;n{it.getInstance().warn("空函数")}}),Ms=Object.assign(Object.assign({},xs),{points:[],cornerRadius:0,closePath:!0}),Bs=Object.assign(Object.assign({},xs),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},xs),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Rs=Object.assign(Object.assign({},xs),{symbolType:"circle",size:10,keepDirIn3d:!0}),Os=Object.assign(Object.assign(Object.assign({},xs),ys),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Is=Object.assign(Object.assign(Object.assign({},xs),ys),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ps=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},xs),{fill:!0,cornerRadius:0}),Ls=Object.assign(Object.assign({},Ps),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const Ds=new class{},Fs={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},js=!0,Ns=!1,zs=/\w|\(|\)|-/,Vs=/[.?!,;:/,。?!、;:]/,Hs=/\S/;function Gs(t,e,i,n,s){if(!e||e<=0)return 0;const r=Ds.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=Us(t,a)),a}function Us(t,e){let i=e;for(;zs.test(t[i-1])&&zs.test(t[i])||Vs.test(t[i]);)if(i--,i<=0)return e;return i}function Ws(t,e){const i=Ds.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var Ys=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ks=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Os.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&r.str!==t){const i=Us(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextEnd(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length-1);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,s,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=Us(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}};Ks=Ys([Ri()],Ks);var Xs=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const $s=Symbol.for("TextMeasureContribution");let Zs=class extends Ks{};Zs=Xs([Ri()],Zs);const qs=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Pi,this.options=e,this.id=vi.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Hi}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,_i,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Vi(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),new Yi(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),s=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:s(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),n=Object.keys(i),s=[];for(let t=0;t{n[t.key]=t.value}));const r={inject:n[bi],multiInject:n[xi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};s.push(l)}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Li:case ji:e=t.cache;break;case Ni:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ii&&(t.cache=e,t.activated=!0)}},Js=Symbol.for("CanvasFactory"),Qs=Symbol.for("Context2dFactory");function tr(t){return qs.getNamed(Js,Ds.global.env)(t)}const er=1e-4,ir=Math.sqrt(3),nr=1/3;function sr(t){return t>-yr&&tyr||t<-yr}const ar=[0,0],or=[0,0],lr=[0,0];function hr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function cr(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function dr(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function ur(t){return(t%=kt)<0&&(t+=kt),t}function pr(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function gr(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=kt);let d=Math.atan2(l,o);return d<0&&(d+=kt),d>=n&&d<=s||d+kt>=n&&d+kt<=s}function vr(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(sr(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const br=[-1,-1,-1],xr=[-1,-1];function Sr(){const t=xr[0];xr[0]=xr[1],xr[1]=t}function Ar(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(sr(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,nr):Math.pow(i,nr),n=n<0?-Math.pow(-n,nr):Math.pow(n,nr);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+ir*Math.sin(e)))/(3*a),h=(-o+i*(n-ir*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,br);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Sr(),p=dr(e,n,r,o,xr[0]),u>1&&(g=dr(e,n,r,o,xr[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(sr(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,br);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=cr(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);br[0]=-l,br[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=kt-1e-4){n=0,s=kt;const e=r?1:-1;return a>=br[0]+t&&a<=br[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=kt,s+=kt);let c=0;for(let e=0;e<2;e++){const i=br[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=kt+t),(t>=n&&t<=s||t+kt>=n&&t+kt<=s)&&(t>xt/2&&t<1.5*xt&&(e=-e),c+=e)}}return c}function Tr(t){return Math.round(t/xt*1e8)/1e8%2*xt}function Cr(t,e){let i=Tr(t[0]);i<0&&(i+=kt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=kt?s=i+kt:e&&i-s>=kt?s=i-kt:!e&&i>s?s=i+(kt-Tr(i-s)):e&&i1&&(i||(h+=pr(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;Er[0]=S,Er[1]=A,Cr(Er,Boolean(a[6])),S=Er[0],A=Er[1];const k=S,w=A-S,T=!!(1-(a[6]?0:1)),C=(n-m)*y/y+m;switch(f){case cn.M:u=m,p=v,c=u,d=p;break;case cn.L:if(i){if(vr(c,d,m,v,e,n,s))return!0}else h+=pr(c,d,m,v,n,s)||0;c=m,d=v;break;case cn.C:if(i){if(fr(c,d,m,v,y,_,b,x,e,n,s))return!0}else h+=Ar(c,d,m,v,y,_,b,x,n,s)||0;c=b,d=x;break;case cn.Q:if(i){if(gr(c,d,m,v,y,_,e,n,s))return!0}else h+=kr(c,d,m,v,y,_,n,s)||0;c=y,d=_;break;case cn.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=pr(c,d,o,l,n,s),i){if(mr(m,v,y,k,k+w,T,e,C,s))return!0}else h+=wr(m,v,y,k,k+w,T,C,s);c=Math.cos(k+w)*y+m,d=Math.sin(k+w)*y+v;break;case cn.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(vr(u,p,o,p,e,n,s)||vr(o,p,o,l,e,n,s)||vr(o,l,u,l,e,n,s)||vr(u,l,u,p,e,n,s))return!0}else h+=pr(o,p,o,l,n,s),h+=pr(u,l,u,p,n,s);break;case cn.Z:if(i){if(vr(c,d,u,p,e,n,s))return!0}else h+=pr(c,d,u,p,n,s);c=u,d=p}}return i||(g=d,f=p,Math.abs(g-f)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Or=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ir=Symbol.for("VWindow"),Pr=Symbol.for("WindowHandlerContribution");let Lr=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qi(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(qs.getNamed(Pr,t.env).configure(this,t),this.actived=!0)},this._uid=vi.GenAutoIncrementId(),this.global=Ds.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Lr=Rr([Ri(),Or("design:paramtypes",[])],Lr);var Dr=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jr=function(t,e){return function(i,n){e(i,n,t)}};let Nr=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ds.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Br.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:ys.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:ys.fontFamily,fontSize:ys.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=qs.get(Ir),s=t.AABBBounds,r=s.width(),a=s.height(),o=-s.x1,l=-s.y1;n.create({viewBox:{x1:o,y1:l,x2:s.x2,y2:s.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=n.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var zr;Nr=Dr([Ri(),jr(0,Mi(Ki)),jr(0,Oi($s)),Fr("design:paramtypes",[Object])],Nr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zr||(zr={}));const Vr=new $t;let Hr=class{constructor(){this.matrix=new $t}init(t){return this.mode=zr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Vr.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Vr.a,Vr.b,Vr.c,Vr.d,Vr.e,Vr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Vr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Vr.a,Vr.b,Vr.c,Vr.d,Vr.e,Vr.f),this}scale(t,e,i){return this.mode===zr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Vr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Vr.a,Vr.b,Vr.c,Vr.d,Vr.e,Vr.f),this}translate(t,e){return this.mode===zr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Hr=Dr([Ri(),Fr("design:paramtypes",[])],Hr);const Gr={arc:Ss,area:As,circle:ks,line:Cs,path:Es,symbol:Rs,text:Os,rect:Bs,polygon:Ms,richtext:Is,richtextIcon:Ls,image:Ps,group:ws,glyph:Ts},Ur=Object.keys(Gr);function Wr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Yr={arc:Object.assign({},Gr.arc),area:Object.assign({},Gr.area),circle:Object.assign({},Gr.circle),line:Object.assign({},Gr.line),path:Object.assign({},Gr.path),symbol:Object.assign({},Gr.symbol),text:Object.assign({},Gr.text),rect:Object.assign({},Gr.rect),polygon:Object.assign({},Gr.polygon),richtext:Object.assign({},Gr.richtext),richtextIcon:Object.assign({},Gr.richtextIcon),image:Object.assign({},Gr.image),group:Object.assign({},Gr.group),glyph:Object.assign({},Gr.glyph)};class Kr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Ur.forEach((t=>{this._defaultTheme[t]=Object.create(Yr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Ur.forEach((n=>{const s=Object.create(Yr[n]);t&&t[n]&&Wr(s,t[n]),i[n]&&Wr(s,i[n]),e[n]&&Wr(s,e[n]),this.combinedTheme[n]=s})),e.common&&Ur.forEach((t=>{Wr(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Xr=new Kr;function $r(t,e){return t.glyphHost?$r(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Xr.getTheme()}return null}(t)||t.attachedThemeGraphic&&$r(t.attachedThemeGraphic)||Xr.getTheme()}var Zr=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class qr extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=vi.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Zr(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(sa(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=sa(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=sa(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=sa(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=na.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(sa(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(sa(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,sa(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ta))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):sa(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof ea))return void it.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=na.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,s=i.length;n{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new ra(n,{clickInterval:a}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ta,this.rootWheelEvent=new ea,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&y(t)&&!I(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class ha{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return ha.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class ca{static Avaliable(){return!0}avaliable(){return ca.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class da{static Avaliable(){return!!Ds.global.getRequestAnimationFrame()}avaliable(){return da.Avaliable()}tick(t,e){Ds.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var ua;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(ua||(ua={}));class pa{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-pa.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*pa.bounceIn(2*t):.5*pa.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/kt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*kt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/kt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*kt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/kt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*kt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*kt/e)*.5+1}}}pa.quadIn=pa.getPowIn(2),pa.quadOut=pa.getPowOut(2),pa.quadInOut=pa.getPowInOut(2),pa.cubicIn=pa.getPowIn(3),pa.cubicOut=pa.getPowOut(3),pa.cubicInOut=pa.getPowInOut(3),pa.quartIn=pa.getPowIn(4),pa.quartOut=pa.getPowOut(4),pa.quartInOut=pa.getPowInOut(4),pa.quintIn=pa.getPowIn(5),pa.quintOut=pa.getPowOut(5),pa.quintInOut=pa.getPowInOut(5),pa.backIn=pa.getBackIn(1.7),pa.backOut=pa.getBackOut(1.7),pa.backInOut=pa.getBackInOut(1.7),pa.elasticIn=pa.getElasticIn(1,.3),pa.elasticOut=pa.getElasticOut(1,.3),pa.elasticInOut=pa.getElasticInOut(1,.3*1.5);class ga{constructor(){this.id=vi.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===bn.END?this.removeAnimate(e):e.status===bn.RUNNING||e.status===bn.INITIAL?(this.animateCount++,e.advance(t)):e.status===bn.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const fa=new ga;class ma{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class va extends ma{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let ya=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vi.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fa;this.id=t,this.timeline=e,this.status=bn.INITIAL,this.tailAnimate=new _a(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Et(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&xn.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:_n.ANIMATE_PLAY})}runCb(t){const e=new va((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===bn.RUNNING&&(this.status=bn.PAUSED)}resume(){this.status===bn.PAUSED&&(this.status=bn.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new _a(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===bn.RUNNING&&(this.status=bn.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=bn.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};ya.mode=xn.NORMAL,ya.interpolateMap=new Map;class _a{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new ba(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?pa[i]:i,s=this._addStep(e,null,n);return s.type=Sn.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?pa[i]:i,r=this._addStep(e,null,s);return r.type=Sn.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=Sn.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Sn.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new ba(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),e.propKeys=Object.keys(e.props),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return it.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class ba{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const xa=200,Sa="cubicOut",Aa=1e3,ka="quadInOut";var wa;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(wa||(wa={}));const Ta=[!1,!1,!1,!1],Ca=[0,0,0,0],Ea=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Ca[0]=t[0],Ca[2]=t[0],Ca[1]=t[1],Ca[3]=t[1],Ca):t:t:0,Ma=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ba=[1,2,3,0,1,2,3,0];function Ra(t,e,i,n){for(;t>=kt;)t-=kt;for(;t<0;)t+=kt;for(;t>e;)e+=kt;Ma[0].x=i,Ma[1].y=i,Ma[2].x=-i,Ma[3].y=-i;const s=Math.ceil(t/St)%4,r=Math.ceil(e/St)%4;if(n.add(Ct(t)*i,Bt(t)*i),n.add(Ct(e)*i,Bt(e)*i),s!==r||e-t>xt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new jt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new jt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s0&&void 0!==arguments[0]?arguments[0]:Da.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Da.TimeOut=1e3/60;const Fa=new Da,ja=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Na extends ma{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ft(this.fromNumber),Ft(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var za;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(za||(za={}));class Va extends ma{constructor(t,e,i,n,s){var r,a;super(t,e,i,n,s),this.newPointAnimateType=null!==(r=null==s?void 0:s.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==s?void 0:s.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new jt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=Oa(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Ha extends ma{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Ga extends ma{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?pa[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function Ua(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function Wa(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function qa(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function Ja(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}};function eo(t,e,i){const n=t/e;let s,r;t>=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),so=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ro=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return so(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return so(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ro(s[0],n,i),ro(s[1],e-n,i)}};var ao;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ao||(ao={}));class oo{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ao.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ao.Color1){const e=oo.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=ae.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];oo.store1[t]=e,oo.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=oo.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=ae.parseColorString(t);return s&&(oo.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],oo.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===ao.Color1){if(oo.store1[t])return;oo.store1[t]=i,oo.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(oo.store255[t])return;oo.store255[t]=i,oo.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function lo(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function ho(t,e,i,n,s){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((s,r)=>co(_(t)?t[r]:t,_(e)?e[r]:e,i,n))):co(t,e,i,n,s)}function co(t,e,i,n,s){if(!t||!e)return t&&lo(t)||e&&lo(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=oo.Get(t,ao.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=oo.Get(e,ao.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:lo(a)})))});return o?ho(r,l,i,n,s):ho(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:go(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:go(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:go(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),lo(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}oo.store255={},oo.store1={};const uo=[0,0,0,0],po=[0,0,0,0];function go(t,e,i){return oo.Get(t,ao.Color255,uo),oo.Get(e,ao.Color255,po),`rgba(${Math.round(uo[0]+(po[0]-uo[0])*i)},${Math.round(uo[1]+(po[1]-uo[1])*i)},${Math.round(uo[2]+(po[2]-uo[2])*i)},${uo[3]+(po[3]-uo[3])*i})`}const fo=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=ho(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},mo=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?qa(t):[],s=qa(e);i&&n&&(i.fromTransform&&Ja(n,i.fromTransform.clone().getInverse()),Ja(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},yo=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],_o=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!yo.includes(s))return;const r=e[s];u(r)||u(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?oo.Get(t[s],ao.Color255):t[s],to:"string"==typeof r?oo.Get(r,ao.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class bo extends ma{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;mo(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&fo(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const xo=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=vo(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=_o(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new bo({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Aa,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:ka)),c};class So extends ma{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;mo(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&fo(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Ao=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pa.includes(t))(i)||(e[i]=t[i])})),e},ko=(t,e,i)=>{const n=Ao(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Ds.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},wo=(t,e,i)=>{const n=[],s=i?null:Ao(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:Ao(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:n}=to(t.attribute),s=eo(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Ds.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=eo(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Ds.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=eo(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Ds.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return io(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return io(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Ds.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:no(i)}];const n=[];return ro(i,e,n),n})(t,e).forEach((t=>{n.push(Ds.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return ro(r,e,h),h})(t,e).forEach((t=>{n.push(Ds.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=qa(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Ds.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Ds.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&ko(t,n,e),n};class Co{static GetImage(t,e){var i;const n=Co.cache.get(t);n?"fail"===n.loadState?Ds.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Co.loadImage(t,e)}static GetSvg(t,e){var i;let n=Co.cache.get(t);n?"fail"===n.loadState?Ds.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Co.cache.set(t,n),n.dataPromise=Ds.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Co.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Co.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ds.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ds.global.loadBlob(t):"json"===e&&(i.dataPromise=Ds.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Co.isLoading&&Co.toLoadAueue.length){Co.isLoading=!0;const t=Co.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(Co.cache.set(i,s),s.dataPromise=Ds.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Co.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Co.loading()})).catch((t=>{console.error(t),Co.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Co.loading()}))}}),0)}static loadImage(t,e){const i=Eo(t,Co.toLoadAueue);if(-1!==i)return Co.toLoadAueue[i].marks.push(e),void Co.loading();Co.toLoadAueue.push({url:t,marks:[e]}),Co.loading()}static improveImageLoading(t){const e=Eo(t,Co.toLoadAueue);if(-1!==e){const t=Co.toLoadAueue.splice(e,1);Co.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Eo(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Ht,this._updateTag=vn.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,n;const{dx:s=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Lo.x=s+(null!==(i=t.scrollX)&&void 0!==i?i:0),Lo.y=r+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Lo.x=s,Lo.y=r;return Lo}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Ds.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Ds.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new $t),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vn.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vn.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vn.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vn.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vn.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&vn.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vn.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===yn.GLOBAL){const i=new jt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Ro;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Ro;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Ds.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=n&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:xa,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Sa),c&&this.setAttributes(c,!1,{type:_n.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_n.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();I(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=vn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=vn.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=vn.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&vn.UPDATE_SHAPE_AND_BOUNDS)===vn.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=vn.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=vn.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=vn.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=vn.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=vn.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=vn.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=vn.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&vn.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],n=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:n}=this.attribute;return Bo.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bo),this.setAttributes({scaleX:t,scaleY:i,angle:n}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,s=n();i[0]=s.x1+(s.x2-s.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,s=n();i[1]=s.y1+(s.y2-s.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=gs.x,y:e=gs.y,scaleX:i=gs.scaleX,scaleY:n=gs.scaleY,angle:s=gs.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ct(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=n);const y=m-i,_=v-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Ds.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(gs);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Mo.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Ds.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_n.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:_n.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=ho(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=ho(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=ho(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return $r(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ds.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new ds).fromString(t):this.pathProxy=new ds,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Ds.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new ia(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}Fo.mixin(aa);class jo{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function No(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function zo(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",s="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let s=n.data;const r=n.index,a=s.search(/\s/);let o=s,l=!0;-1!==a&&(o=s.substr(0,a).replace(/\s\s*$/,""),s=s.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==n.data.substr(t+1))}return{tagName:o,tagExp:s,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Vo=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Ho{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;"string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const s=function(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=zo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=No(t,"--\x3e",r+4,"Comment is not closed.");else{const a=zo(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new jo(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new jo(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=c}else n+=t[r];return e.child}}function Go(t,e){return Uo(t)}function Uo(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Zo=0;function qo(){return Zo++}var Jo;function Qo(t){const e=[];let i=0,n="";for(let s=0;stl.set(t,!0)));const el=new Map;function il(t){if(tl.has(t))return!0;if(el.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>el.set(t,!0)));const nl=qo(),sl=qo(),rl=qo(),al=qo(),ol=qo(),ll=qo(),hl=qo(),cl=qo(),dl=qo(),ul=qo();qo();const pl=qo();qo();const gl=qo(),fl=qo(),ml=qo(),vl=Symbol.for("GraphicService"),yl=Symbol.for("GraphicCreator"),_l={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},bl=Object.keys(_l);var xl;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(xl||(xl={}));class Sl extends Fo{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=ll,this._childUpdateTag=vn.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Kr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Kr)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===yn.GLOBAL){const i=new jt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vn.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Ds.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Ds.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=gs.x,y:e=gs.y,dx:i=gs.dx,dy:n=gs.dy,scaleX:s=gs.scaleX,scaleY:r=gs.scaleY,angle:a=gs.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=$r(this).group;this._AABBBounds.clear();const i=Ds.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=Ea(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=vn.CLEAR_BOUNDS,this._childUpdateTag&=vn.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=vn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vn.UPDATE_BOUNDS||(this._childUpdateTag|=vn.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Ds.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Ds.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Ds.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Ds.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Ds.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vn.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Ds.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Sl(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Sl.NOWORK_ANIMATE_ATTR}}function Al(t){return new Sl(t)}Sl.NOWORK_ANIMATE_ATTR=Do;class kl extends Sl{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new Kr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ds.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ds.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const wl=Symbol.for("TransformUtil"),Tl=Symbol.for("GraphicUtil"),Cl=Symbol.for("LayerService"),El=Symbol.for("StaticLayerHandlerContribution"),Ml=Symbol.for("DynamicLayerHandlerContribution"),Bl=Symbol.for("VirtualLayerHandlerContribution");var Rl,Ol=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Il=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Pl=Rl=class{static GenerateLayerId(){return`${Rl.idprefix}_${Rl.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ds.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?qs.get(El):"dynamic"===t?qs.get(Ml):qs.get(Bl),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=new kl(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Rl.GenerateLayerId(),layerHandler:s})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Pl.idprefix="visactor_layer",Pl.prefix_count=0,Pl=Rl=Ol([Ri(),Il("design:paramtypes",[])],Pl);var Ll=new yi((t=>{t(Qi).to(sn).inSingletonScope(),t(Ir).to(Lr),t(Tl).to(Nr).inSingletonScope(),t(wl).to(Hr).inSingletonScope(),t(Cl).to(Pl).inSingletonScope()}));function Dl(t,e){return!(!t&&!e)}function Fl(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function jl(t,e,i){return i&&t*e>0}function Nl(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function zl(t,e){return t*e>0}function Vl(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Hl(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uB*B+R*R&&(k=T,w=C),{cx:k,cy:w,x01:-c,y01:-d,x11:k*(s/x-1),y11:w*(s/x-1)}}function Ul(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=wt(l-o),c=l>o;let d=!1;if(s=kt-bt)e.moveTo(i+s*Ct(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>bt&&(e.moveTo(i+r*Ct(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=_(u),{outerDeltaAngle:g,innerDeltaAngle:f,outerStartAngle:m,outerEndAngle:v,innerEndAngle:y,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,w=Math.max(S,x),T=Math.max(A,k);let C=w,E=T;const M=s*Ct(m),B=s*Bt(m),R=r*Ct(y),O=r*Bt(y);let I,P,L,D;if((T>bt||w>bt)&&(I=s*Ct(v),P=s*Bt(v),L=r*Ct(b),D=r*Bt(b),hbt){const t=Mt(x,C),r=Mt(S,C),o=Gl(L,D,M,B,s,t,Number(c)),l=Gl(I,P,R,O,s,r,Number(c));C0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ct(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+s*Bt(v))}else!a||a[0]?(e.moveTo(i+M,n+B),e.arc(i,n,s,m,v,!c)):e.moveTo(i+s*Ct(v),n+s*Bt(v));if(!(r>bt)||f<.001)!a||a[1]?e.lineTo(i+R,n+O):e.moveTo(i+R,n+O),d=!0;else if(E>bt){const t=Mt(k,E),s=Mt(A,E),o=Gl(R,O,I,P,r,-s,Number(c)),l=Gl(M,B,L,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),E0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ct(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+L,n+D)}else!a||a[1]?e.lineTo(i+R,n+O):e.moveTo(i+R,n+O),!a||a[2]?e.arc(i,n,r,y,b,c):e.moveTo(i+r*Ct(b),n+r*Bt(b))}return a?a[3]&&e.lineTo(i+s*Ct(o),n+s*Bt(o)):e.closePath(),d}class Wl{static GetCanvas(){try{return Wl.canvas||(Wl.canvas=Ds.global.createCanvas({})),Wl.canvas}catch(t){return null}}static GetCtx(){if(!Wl.ctx){const t=Wl.GetCanvas();Wl.ctx=t.getContext("2d")}return Wl.ctx}}class Yl extends Zt{static getInstance(){return Yl._instance||(Yl._instance=new Yl),Yl._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Wl.GetCanvas(),n=Wl.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${n}`;s.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Yl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Kl{static GetSize(t){for(let e=0;e=t)return Kl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=Kl.GenKey(t,e,i,n,s),l=Kl.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=Kl.GenKey(t,e,i,n,s);Kl.cache[l]?Kl.cache[l].push({width:a,height:o,pattern:r}):Kl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}Kl.cache={},Kl.ImageSize=[20,40,80,160,320,640,1280,2560];const Xl=Symbol.for("ArcRenderContribution"),$l=Symbol.for("AreaRenderContribution"),Zl=Symbol.for("CircleRenderContribution"),ql=Symbol.for("GroupRenderContribution"),Jl=Symbol.for("PathRenderContribution"),Ql=Symbol.for("PolygonRenderContribution"),th=Symbol.for("RectRenderContribution"),eh=Symbol.for("SymbolRenderContribution"),ih=Symbol.for("TextRenderContribution"),nh=Symbol.for("InteractiveSubRenderContribution"),sh=["radius","startAngle","endAngle",...Ro];class rh extends Fo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=al}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=$r(this).circle;this._AABBBounds.clear();const i=this.attribute,n=Ds.graphicService.updateCircleAABBBounds(i,$r(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Ea(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return $r(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,sh)}needUpdateTag(t){return super.needUpdateTag(t,sh)}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new ds;return o.arc(0,0,s,r,a),o}clone(){return new rh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rh.NOWORK_ANIMATE_ATTR}}function ah(t){return new rh(t)}function oh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function lh(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function hh(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}rh.NOWORK_ANIMATE_ATTR=Do;class ch{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=ml,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=$r(this).text;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,n,s;const r=$r(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:y=0,lineClamp:b}=this.attribute,x=null!==(e=ja(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Ds.graphicUtil.textMeasure,k=new ch(a,{fontSize:h,fontWeight:f,fontFamily:a},A),w=_(t)?t.map((t=>t.toString())):[t.toString()],T=[],C=[0,0];let E=1/0;if(y>0&&(E=Math.max(Math.floor(y/x),1)),b&&(E=Math.min(E,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),C[0]=t}else{let t,e,i=0;for(let n=0,s=w.length;n{const e=t.direction===Jo.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=lh(x,o),w=hh(S,b,p);return this._AABBBounds.set(w,k,w+b,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const n=$r(this).text,{wrap:s=n.wrap}=this.attribute;if(s)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=n.fontFamily,textAlign:o=n.textAlign,textBaseline:l=n.textBaseline,fontSize:h=n.fontSize,fontWeight:c=n.fontWeight,ellipsis:d=n.ellipsis,maxLineWidth:u,stroke:p=n.stroke,lineWidth:g=n.lineWidth,whiteSpace:f=n.whiteSpace,suffixPosition:m=n.suffixPosition}=r,v=null!==(e=ja(r.lineHeight,r.fontSize||n.fontSize))&&void 0!==e?e:r.fontSize||n.fontSize;if("normal"===f)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const y=Ds.graphicUtil.textMeasure,_=new ch(a,{fontSize:h,fontWeight:c,fontFamily:a},y).GetLayoutByLines(t,o,l,v,!0===d?n.ellipsis:d||void 0,!1,u,m),{bbox:b}=_;return this.cache.layoutData=_,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,n,s;const r=$r(this).text,a=Ds.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:m=r.stroke,lineWidth:v=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:_=r.suffixPosition}=l,b=null!==(i=ja(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const e=x;x=null!==(n=t.baselineMapAlign[S])&&void 0!==n?n:"left",S=null!==(s=t.alignMapBaseline[e])&&void 0!==s?s:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Et(e,o)}));const t=lh(x,o),e=this.cache.verticalList.length*b,i=hh(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>Qo(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,n=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,i,!1,_);A[e]=n.verticalList,o=n.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Jo.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Et(e,o)}));const k=lh(x,o),w=this.cache.verticalList.length*b,T=hh(S,w,g);return this._AABBBounds.set(T,k,T+w,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return $r(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dh;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dh;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ph(t){return new uh(t)}uh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Do),uh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},uh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class gh{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function fh(t,e,i,n,s){return s?t.arc(i,n,e,0,At,!1,s):t.arc(i,n,e,0,At),!1}var mh=new class extends gh{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,s){return fh(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return fh(t,e/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var vh=new class extends gh{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,e/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,e/6,i,n,s,r)}};function yh(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var _h=new class extends gh{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return yh(t,e/2,i,n,s)}drawFitDir(t,e,i,n,s){return yh(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return yh(t,e/2+s,i,n,r)}};function bh(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var xh=new class extends gh{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return bh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return bh(t,e/2+s,i,n)}};class Sh extends gh{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i+e,e+n),t.lineTo(i-e,e+n),t.lineTo(i,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}(t,e/2,i,n,s)}}var Ah=new Sh;var kh=new class extends Sh{constructor(){super(...arguments),this.type="triangle"}};const wh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Th=Math.sin(At/10)*wh,Ch=-Math.cos(At/10)*wh;function Eh(t,e,i,n){const s=Th*e,r=Ch*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=At*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var Mh=new class extends gh{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return Eh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Eh(t,e/2+s,i,n)}};const Bh=Rt(3);function Rh(t,e,i,n){const s=e,r=s/Bh,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var Oh=new class extends gh{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return Rh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Rh(t,e/2+s,i,n)}};function Ih(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var Ph=new class extends gh{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return Ih(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Ih(t,e/2+s,i,n)}};function Lh(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Dh=new class extends gh{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return Lh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Lh(t,e/2+s,i,n)}};const Fh=-.5,jh=Rt(3)/2,Nh=1/Rt(12);function zh(t,e,i,n){const s=e/2,r=e*Nh,a=s,o=e*Nh+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(Fh*s-jh*r+i,jh*s+Fh*r+n),t.lineTo(Fh*a-jh*o+i,jh*a+Fh*o+n),t.lineTo(Fh*l-jh*h+i,jh*l+Fh*h+n),t.lineTo(Fh*s+jh*r+i,Fh*r-jh*s+n),t.lineTo(Fh*a+jh*o+i,Fh*o-jh*a+n),t.lineTo(Fh*l+jh*h+i,Fh*h-jh*l+n),t.closePath(),!1}var Vh=new class extends gh{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return zh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return zh(t,e/2+s,i,n)}};var Hh=new class extends gh{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(e+i,e+n),t.lineTo(e+i,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}(t,e/2,i,n,s)}};var Gh=new class extends gh{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i-e,e+n),t.lineTo(e+i,n),t.lineTo(i-e,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}(t,e/2,i,n,s)}};var Uh=new class extends gh{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i-e,n-e),t.lineTo(i+e,n-e),t.lineTo(i,n+e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}(t,e/2,i,n,s)}};const Wh=Rt(3);function Yh(t,e,i,n){const s=e*Wh;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Kh=new class extends Sh{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Yh(t,e/2/Wh,i,n)}drawOffset(t,e,i,n,s){return Yh(t,e/2/Wh+s,i,n)}};function Xh(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var $h=new class extends gh{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return Xh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Xh(t,e/4+s,i,n)}};function Zh(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var qh=new class extends gh{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return Zh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Zh(t,e/4+s,i,n)}};function Jh(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Qh=new class extends gh{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return Jh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Jh(t,e/4+s,i,n)}};function tc(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var ec=new class extends gh{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return tc(t,e/4,i,n)}drawOffset(t,e,i,n,s){return tc(t,e/4+s,i,n)}};function ic(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var nc=new class extends gh{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return ic(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return ic(t,e/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function sc(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var rc=new class extends gh{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return sc(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return sc(t,e/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function ac(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var oc=new class extends gh{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,s){return ac(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return ac(t,e/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=t/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function lc(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function hc(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var cc=new class extends gh{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return S(e)?hc(t,e,i,n):lc(t,e,i,n)}drawOffset(t,e,i,n,s){return S(e)?hc(t,e+2*s,i,n):lc(t,[e[0]+2*s,e[1]+2*s],i,n)}};const dc=new Ht;class uc{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Bn(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(Bn(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Bn(s.path.commandList,t,i,n,e,e),r&&r(s.path,s.attribute)})),!1):(Bn(this.path.commandList,t,i,n,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;dc.x1=n.bounds.x1*t,dc.y1=n.bounds.y1*t,dc.x2=n.bounds.x2*t,dc.y2=n.bounds.y2*t,e.union(dc)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const pc={};[mh,vh,_h,xh,Kh,kh,Mh,Oh,Ph,Dh,Vh,Hh,Gh,Ah,Uh,$h,qh,Qh,ec,cc,nc,rc,oc].forEach((t=>{pc[t.type]=t}));const gc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},fc=new Ht,mc=["symbolType","size",...Ro];let vc=class t extends Fo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fl}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=$r(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,n=pc[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(i=gc[i]||i,!0===((s=i).startsWith("{const e=(new ds).fromString(t.d),i={};bl.forEach((e=>{t[e]&&(i[_l[e]]=t[e])})),r.push({path:e,attribute:i}),fc.union(e.bounds)}));const a=fc.width(),o=fc.height(),l=1/Et(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new uc(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var s;const r=(new ds).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Et(a,o);return r.transform(0,0,l,l),this._parsedPath=new uc(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=$r(this).symbol;this._AABBBounds.clear();const i=this.attribute,n=Ds.graphicService.updateSymbolAABBBounds(i,$r(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Ea(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return $r(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,mc)}needUpdateTag(t){return super.needUpdateTag(t,mc)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new ds).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new ds).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yc(t){return new vc(t)}vc.userSymbolMap={},vc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Do);const _c=["segments","points","curveType","curveTension",...Ro];let bc=class t extends Fo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=cl}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ia(i,n,e))}doUpdateAABBBounds(){const t=$r(this).line;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updateLineAABBBounds(e,$r(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return $r(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,_c)}needUpdateTag(t){return super.needUpdateTag(t,_c)}toCustomPath(){const t=this.attribute,e=new ds,i=t.segments,n=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xc(t){return new bc(t)}bc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Do);const Sc=["width","x1","y1","height","cornerRadius",...Ro];class Ac extends Fo{constructor(t){super(t),this.type="rect",this.numberType=pl}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=$r(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updateRectAABBBounds(e,$r(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return $r(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Sc)}needUpdateTag(t){return super.needUpdateTag(t,Sc)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:s}=to(t),r=new ds;return r.moveTo(e,i),r.rect(e,i,n,s),r}clone(){return new Ac(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ac.NOWORK_ANIMATE_ATTR}}function kc(t){return new Ac(t)}Ac.NOWORK_ANIMATE_ATTR=Do;class wc{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Fs[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-s:"center"===this.globalAlign&&(o=-s/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Tc{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=ja(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof n?n>this.fontSize?n:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:s,height:r,descent:a,width:o}=Ws(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=s+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Ws(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==s&&"end"!==s||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Gs(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===s||"end"===s){const{width:e}=Ws(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Ns;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||js;if(!i)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Gs(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=Ws(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const Cc=["width","height","image",...Ro];class Ec extends Fo{constructor(t){super(t),this.type="image",this.numberType=hl,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}doUpdateAABBBounds(){const t=$r(this).image;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updateImageAABBBounds(e,$r(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ps[t]}needUpdateTags(t){return super.needUpdateTags(t,Cc)}needUpdateTag(t){return super.needUpdateTag(t,Cc)}clone(){return new Ec(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ec.NOWORK_ANIMATE_ATTR}}Ec.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Do);class Mc extends Ec{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Ea(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Ea(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ps.width,height:e=Ps.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Bc{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Mc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Fs[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Tc){const e=Hs.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let s=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n.overflow)continue;if(n instanceof Mc)break;if("vertical"===this.direction&&"vertical"!==n.direction){n.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";n.ellipsisStr=r;const{width:a}=Ws(r,n.character),o=a||0;if(o<=this.blankWidth+t){e&&(n.ellipsis="add");break}if(o<=this.blankWidth+t+n.width){n.ellipsis="replace",n.ellipsisWidth=o,n.ellipsisOtherParagraphWidth=this.blankWidth+t;break}n.ellipsis="hide",t+=n.width}}this.paragraphs.map(((e,s)=>{if(e instanceof Mc)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===s,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof Mc)break;const{width:s}=Ws(t,n.character),r=s||0;if(r<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=r;break}if(r<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=r,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof Mc?t.width:t.getWidthWithEllips(this.direction)})),i}}class Rc{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Fs[this.direction]}store(t){if(t instanceof Mc){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Bc(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Mc?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,s=Gs(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==s){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new Tc(i,t.newLine,t.character),new Tc(n,!0,t.character)]}(t,s);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Oc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...Ro];class Ic extends Fo{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gl}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Is.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Is.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Is.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Is.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Is.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Is.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Is.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Is.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=$r(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updateRichTextAABBBounds(e,$r(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Is[t]}needUpdateTags(t){return super.needUpdateTags(t,Oc)}needUpdateTag(t){return super.needUpdateTag(t,Oc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:n,fontFamily:s,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:n,fontFamily:s,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:n,maxHeight:s,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,f=[],m=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,f.push(t)}}else{const e=this.combinedStyleToCharacter(m[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,y="number"==typeof s&&Number.isFinite(s)&&s>0,_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=n),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=s),x=new wc(0,0,(_?r:v?n:0)||0,(b?a:y?s:0)||0,o,l,h,c,d,u||"horizontal",!_&&v,!b&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new Rc(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;const o=e.AABBBounds.clone();o.translate(e._marginArray[3],e._marginArray[0]),o.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i+e._marginArray[3],s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n+e._marginArray[0])})),s}getNoWorkAnimateAttr(){return Ic.NOWORK_ANIMATE_ATTR}}function Pc(t){return new Ic(t)}Ic.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Do);const Lc=["path","customPath",...Ro];class Dc extends Fo{constructor(t){super(t),this.type="path",this.numberType=dl}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=$r(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof ds?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof ds?this.cache:t.path)}doUpdateAABBBounds(){const t=$r(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updatePathAABBBounds(e,$r(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new ds).fromString(t.path):t.customPath&&(this.cache=new ds,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return $r(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Lc)}needUpdateTag(t){return super.needUpdateTag(t,Lc)}toCustomPath(){return(new ds).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Dc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dc.NOWORK_ANIMATE_ATTR}}function Fc(t){return new Dc(t)}Dc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Do);const jc=["segments","points","curveType","curveTension",...Ro];class Nc extends Fo{constructor(t){super(t),this.type="area",this.numberType=rl}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=$r(this).area;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updateAreaAABBBounds(e,$r(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ia(i,n,e))}getDefaultAttribute(t){return $r(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,jc)}needUpdateTag(t){return super.needUpdateTag(t,jc)}toCustomPath(){const t=new ds,e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new Nc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Nc.NOWORK_ANIMATE_ATTR}}function zc(t){return new Nc(t)}Nc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Do);const Vc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ro];class Hc extends Fo{constructor(t){super(t),this.type="arc",this.numberType=nl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=$r(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:s=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(s+=n,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(s-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=$r(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Ut(e),i=e+r,n&&wt(r)bt&&o>bt)return{startAngle:e-s*u*r,endAngle:i+s*u*a,sc:s*u*r,ec:s*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=$r(this).arc,{innerPadding:n=i.innerPadding,outerPadding:s=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=s,o-=n;const{padRadius:l=Rt(a*a+o*o)}=this.attribute,h=wt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>bt&&l>bt){const i=e>t?1:-1;let n=Pt(Number(l)/o*Bt(g)),s=Pt(Number(l)/a*Bt(g));return(f-=2*n)>bt?(n*=i,u+=n,p-=n):(f=0,u=p=(t+e)/2),(m-=2*s)>bt?(s*=i,c+=s,d-=s):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}doUpdateAABBBounds(t){const e=$r(this).arc;this._AABBBounds.clear();const i=this.attribute,n=Ds.graphicService.updateArcAABBBounds(i,$r(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Ea(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Vc)}needUpdateTag(t){return super.needUpdateTag(t,Vc)}getDefaultAttribute(t){return $r(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let n=t.innerRadius-(t.innerPadding||0),s=t.outerRadius-(t.outerPadding||0);const r=wt(i-e),a=i>e;if(s=kt-bt)o.moveTo(0+s*Ct(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>bt&&(o.moveTo(0+n*Ct(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Ct(e),r=s*Bt(e),l=n*Ct(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new Hc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hc.NOWORK_ANIMATE_ATTR}}function Gc(t){return new Hc(t)}Hc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Do);const Uc=["points","cornerRadius",...Ro];class Wc extends Fo{constructor(t){super(t),this.type="polygon",this.numberType=ul}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=$r(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Ds.graphicService.updatePolygonAABBBounds(e,$r(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Ea(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ia(i,n,e))}getDefaultAttribute(t){return $r(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Uc)}needUpdateTag(t){return super.needUpdateTag(t,Uc)}toCustomPath(){const t=this.attribute.points,e=new ds;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Wc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wc.NOWORK_ANIMATE_ATTR}}function Yc(t){return new Wc(t)}Wc.NOWORK_ANIMATE_ATTR=Do;class Kc extends Sl{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Xc(t){return new Kc(t)}class $c{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+(r+a)/2)}return i}}class Zc extends $c{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;$o(i,n+(r+o)/2,!0,a)}return i}}class qc{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return qc.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ed=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},id=function(t,e){return function(i,n){e(i,n,t)}};function nd(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+v*r+e[15]),t}function sd(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function rd(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function ad(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),nd(t,t,[s+o,r+l,a+h]),nd(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),nd(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=Qc.allocate(),n=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}nd(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),nd(i,i,[-n[0],-n[1],0]),rd(t,t,i)}}let od=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qi(["graphic"]),onSetStage:new qi(["graphic","stage"]),onRemove:new qi(["graphic"]),onRelease:new qi(["graphic"]),onAddIncremental:new qi(["graphic","group","stage"]),onClearIncremental:new qi(["graphic","group","stage"]),beforeUpdateAABBBounds:new qi(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qi(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Ht,this.tempAABBBounds2=new Ht,this._rectBoundsContribitions=[new $c],this._symbolBoundsContribitions=[new Zc],this._imageBoundsContribitions=[new $c],this._circleBoundsContribitions=[new $c],this._arcBoundsContribitions=[new $c],this._pathBoundsContribitions=[new $c]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new an(t);return Bn(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!this.updatePathProxyAABBBounds(i,n)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const s=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),s.copy(i),s}updateGlyphAABBBounds(t,e,i,n){return this._validCheck(t,e,i,n)?(n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=hh(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=lh(s,e);i.set(n,i.y1,n+e,i.y2)}}updateRichTextAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){$o(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),zt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>kt-bt?i.set(-a,-a,a,a):Ra(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return s+=a,r-=o,sl){const t=h;h=l,l=t}return s<=bt?i.set(0,0,0,0):Math.abs(l-h)>kt-bt?i.set(-s,-s,s,s):(Ra(h,l,s,i),Ra(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this._validCheck(t,e,i,n))return i;if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){$o(d,(l+h)/Math.abs(s+r),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;$o(d,o/Math.abs(s+r)*2,!1,c+1),d.translate(n,a),e.union(d)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&zt(e,e,a)}_validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!n.valid)return i.clear(),!1;const{visible:s=e.visible}=t;return!!s||(i.clear(),!1)}};od=td([Ri(),id(0,Mi(yl)),ed("design:paramtypes",[Object])],od);const ld=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let hd,cd;function dd(t){return hd||(hd=ld.CreateGraphic("text",{})),hd.initAttributes(t),hd.AABBBounds}const ud={x:0,y:0,z:0,lastModelMatrix:null};class pd{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===wn.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===wn.afterFillStroke)))}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=jl(o,l,s),p=zl(o,c),g=Dl(s,r),f=Fl(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||n||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;ud.x=s,ud.y=r,ud.z=a,ud.lastModelMatrix=d;const p=u&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=Qc.allocate(),s=Qc.allocate();ad(s,t,e),rd(n,d||n,s),ud.x=0,ud.y=0,ud.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Qc.free(s)}if(g&&!d){const n=t.getOffsetXY(e);ud.x+=n.x,ud.y+=n.y,ud.z=a,i.setTransformForCurrent()}else if(p)ud.x=0,ud.y=0,ud.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const n=t.getOffsetXY(e);ud.x+=n.x,ud.y+=n.y,this.transformWithoutTranslate(i,ud.x,ud.y,ud.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),ud.x=0,ud.y=0,ud.z=0;return ud}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,s){const{context:r}=n;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=$r(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=jl(d,u,h),_=zl(d,g),b=Dl(h),x=Fl(c,p);return!f||(!b&&!x||(!(y||_||a||o)||(e.beginPath(),Bn(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,n-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,n-v,l),e.fill())),!0)))}(t,r,l,h,0,s)||(this.drawShape(t,r,l,h,n,s),this.z=0,r.modelMatrix!==d&&Qc.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const gd=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return s("linear",t.linearGradient,r)||s("radial",t.radialGradient,o)||s("conic",t.conicGradient,a)}function s(e,n,s){return function(n,r){const a=v(n);if(a){v(t.startCall)||i("Missing (");const n=function(n){const r=s();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),n}}(n)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,n,s=l();return s&&(i=[],i.push(s),n=e,v(t.comma)&&(s=l(),s?i.push(s):e=n)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let n=e();const s=[];if(n)for(s.push(n);v(t.comma);)n=e(),n?s.push(n):i("One extra comma");return s}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const n=v(e);if(n)return{type:t,value:n[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const n=t.exec(e);return n&&y(n[0].length),n}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class fd{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fd.IsGradientStr(t))try{const e=gd(t)[0];if(e){if("linear"===e.type)return fd.ParseLinear(e);if("radial"===e.type)return fd.ParseRadial(e);if("conic"===e.type)return fd.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=xt/2,s=parseFloat(e.value)/180*xt-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+kt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=xt/2;let s="angular"===e.type?parseFloat(e.value)/180*xt:0;for(;s<0;)s+=kt;for(;s>kt;)s-=kt;let r=0,a=0,o=0,l=0;return s({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function md(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function vd(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(_(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}var yd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bd=function(t,e){return function(i,n){e(i,n,t)}};class xd{constructor(){this.time=wn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(g);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=$r(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,this.doDrawImage(e,s.data,r,v,y),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n,s){if("no-repeat"===n)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(s&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(o=i*(a/s),l=a):"repeat-y"===n&&(l=s*(r/i),o=r);const h=t.dpr,c=Br.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Br.free(c)}const h=t.dpr,c=t.createPattern(e,n);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Sd=new xd;let Ad=class{constructor(t){this.subRenderContribitions=t,this.time=wn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};Ad=yd([Ri(),bd(0,Mi(Ki)),bd(0,Oi(nh)),_d("design:paramtypes",[Object])],Ad);class kd{constructor(){this.time=wn.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Br.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Br.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,kt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,m)}drawTexture(t,e,i,n,s,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,s,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const wd=new kd;const Td=new class{constructor(){this.time=wn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=m;const C=!(!u||!u.stroke),E=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=md(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T+r,innerRadius:w-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),Ul(t,e,i,n,T+r,w-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(C){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-n)/k,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=md(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T-r,innerRadius:w+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),Ul(t,e,i,n,T-r,w+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(E){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-n)/k,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:w,startAngle:y,endAngle:_})}},Cd=wd,Ed=Sd;const Md=new class{constructor(){this.time=wn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=l.radius,startAngle:v=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),w=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=md(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,m+r,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=md(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,m-r,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(w){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}},Bd=wd,Rd=Sd;const Od=new class extends xd{constructor(){super(...arguments),this.time=wn.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;this.doDrawImage(e,i.data,n,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Id=xt/2;function Pd(t,e,i,n,s,r,a){let o;if(n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),S(r,!0))o=[r=wt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=wt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=wt(t[0]),i=wt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=wt(o[0]),o[1]=wt(o[1]),o[2]=wt(o[2]),o[3]=wt(o[3])}}else o=[0,0,0,0];if(n<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,n,s);const[l,h,c,d]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],u=Math.min(n/2,s/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],f=[l[0],l[1]+p[0]],m=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],y=[c[0]-p[2],c[1]],_=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(m,v)){a&&a[0]&&t.moveTo(m[0],m[1]);const e=m[0],i=m[1]+p[1];t.arc(e,i,p[1],-Id,0,!1)}if(a&&a[1]?a[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),!$(y,_)){const e=_[0]-p[2],i=_[1];a&&a[1]&&t.moveTo(_[0],_[1]),t.arc(e,i,p[2],0,Id,!1)}if(a&&a[2]?a[2](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Id,xt,!1)}if(a&&a[3]?a[3](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]),!$(g,f)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(f[0],f[1]),t.arc(e,i,p[0],xt,xt+Id,!1)}return!a&&t.closePath(),t}var Ld=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dd=class{constructor(){this.time=wn.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Dd=Ld([Ri()],Dd);let Fd=class{constructor(){this.time=wn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:y,height:b}=t.attribute;if(y=(null!=y?y:u-g)||0,b=(null!=b?b:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===v||_(v)&&v.every((t=>0===t)))){let s,r=0;return Pd(e,i,n,y,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),m[0]?e.lineTo(i+y,n):e.moveTo(i+y,n),m[1]?e.lineTo(i+y,n+b):e.moveTo(i+y,n+b),m[2]?e.lineTo(i,n+b):e.moveTo(i,n+b),m[3]){const t=m[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};Fd=Ld([Ri()],Fd);const jd=new class{constructor(){this.time=wn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,opacity:v=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:A-i)||0,T=(null!=T?T:k-n)||0;const C=!(!u||!u.stroke),E=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=md(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(a,o,w+h,T+h)):(e.beginPath(),Pd(e,a,o,w+h,T+h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(C){const s=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(y-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=md(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(a,o,w-h,T-h)):(e.beginPath(),Pd(e,a,o,w-h,T-h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(E){const s=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(y-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}},Nd=wd,zd=Sd;const Vd=new class{constructor(){this.time=wn.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=md(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,n,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(m){const{distance:s=l.innerBorder.distance}=g,r=md(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,n,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}},Hd=wd,Gd=Sd;var Ud=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yd=function(t,e){return function(i,n){e(i,n,t)}};let Kd=class extends pd{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nl,this.builtinContributions=[Td,Ed,Cd],this.init(t)}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=wt(d-c),p=d>c;let g=!1;if(sbt||E>bt)&&(D=s*Ct(x),F=s*Bt(x),j=r*Ct(A),N=r*Bt(A),ubt){const t=Mt(k,B),r=Mt(w,B),a=Gl(j,N,O,I,s,t,Number(p)),o=Gl(D,F,P,L,s,r,Number(p));if(B0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+O,n+I);if(!(r>bt)||y<.001)e.lineTo(i+P,n+L),g=!0;else if(R>bt){const t=Mt(C,R),s=Mt(T,R),a=Gl(P,L,D,F,r,-s,Number(p)),o=Gl(O,I,j,N,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),R0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Ct(A),n+r*Bt(A));return g}drawShape(t,e,i,n,s,r,a,o){const l=$r(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g,{outerPadding:_=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=_,k-=b;let w=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();wt(n-i){var e;let i=!0;if(c(t,!0)){for(let n=0;n<4;n++)Ta[n]=t,i&&(i=!(null!==(e=Ta[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ta[e]=!!t[e],i&&(i=!!Ta[e]);else Ta[0]=!1,Ta[1]=!1,Ta[2]=!1,Ta[3]=!1;return{isFullStroke:i,stroke:Ta}})(d);if((v||E)&&(e.beginPath(),Ul(t,e,i,n,A,k),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-n,l),e.fill())),y&&E&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,p-n,l),e.stroke()))),!E&&y&&(e.beginPath(),Ul(t,e,i,n,A,k,M),C||this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(wt(h-r)>=kt-bt){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),C||this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=kt;for(;i>kt;)i-=kt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),ho(o.color,l.color,h,!1)}(0,0,h,s);a||jl&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}y&&(o||m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))}}this.afterRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}};Kd=Ud([Ri(),Yd(0,Mi(Ki)),Yd(0,Oi(Xl)),Wd("design:paramtypes",[Object])],Kd);var Xd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zd=function(t,e){return function(i,n){e(i,n,t)}};let qd=class extends pd{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=al,this.builtinContributions=[Md,Rd,Bd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=$r(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g;e.beginPath(),e.arc(i,n,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-n,l),e.fill())),y&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,p-n,l),e.stroke())),this.afterRenderStep(t,e,i,n,v,y,f,m,l,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}};function Jd(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=Ln(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}function Qd(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),Jd(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=An.ROW:"y"===n?f=An.COLUMN:"auto"===n&&(f=e.direction);const m=i*e.tryUpdateLength(f);let v=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eu=class extends pd{constructor(){super(...arguments),this.numberType=cl}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f,m,v,y,b;if(!e)return;t.beginPath();const x=null!==(f=this.z)&&void 0!==f?f:0;Qd(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:w,connectedY:T,connectedStyle:C}=a;if(_(o)?(k=null!==(m=null!=k?k:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,w=null!==(v=null!=w?w:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(y=null!=T?T:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,w=null!=w?w:o.connectedX,T=null!=T?T:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),Qd(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:w,zeroY:T});const f=[];_(o)?o.forEach((t=>f.push(t))):f.push(o),f.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,A-d,f),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,A-d,f),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,n,l,s,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const s=cs(t.points,v,{startPoint:e,curveTension:m});return n=s,s})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,s[g],[l,t.attribute],y,_,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,s[m],[l,t.attribute],Mt(y,1),_,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,_,i,n,t,a,o)}};function iu(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function nu(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),Jd(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),Jd(t,l,1,n),o=!1):o=!0}t.closePath()}eu=tu([Ri()],eu);const su=new class extends kd{constructor(){super(...arguments),this.time=wn.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:La(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:La(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:La(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:La(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}},ru=Sd;var au=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ou=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lu=function(t,e){return function(i,n){e(i,n,t)}};function hu(t,e,i){var n,s;switch(e){case"linear":default:return Un(t,i);case"basis":return Kn(t,i);case"monotoneX":return ts(t,i);case"monotoneY":return es(t,i);case"step":return ns(t,.5,i);case"stepBefore":return ns(t,0,i);case"stepAfter":return ns(t,1,i);case"catmullRom":return ls(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return hs(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return rs(t,i)}}let cu=class extends pd{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=rl,this.builtinContributions=[su,ru],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m,v;const{points:y}=t.attribute;if(y.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=y[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t=0;t--){const i=y[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,d,null,{attribute:t.attribute}),n){const{stroke:i=l&&l.stroke}=t.attribute;if(_(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t=0;t--){const i=y[t];e.lineTo((null!==(m=i.x1)&&void 0!==m?m:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=$r(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;if(w&&"linear"===E&&(E="linearClosed"),1===k&&!C&&!T.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const n=C.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=hu(t.points,E,{startPoint:e,curveTension:b});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}i.length>1&&(s=hu(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const n=hu(e,E,{curveTension:b}),s=hu(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,_,r[c],[g,t.attribute],k,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,S,v,A,_,r[u],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,_,t.attribute,g,k,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let m=!1;return m=m||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),m=m||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),m}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m){var v,y,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:w}=a;const T=[];if(g&&(_(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(y=null!=A?A:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,w=null!==(x=null!=w?w:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),_(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:C,segments:E}=u.attribute;let M,B,R=An.ROW;if(E){const t=E[E.length-1];B=E[0].points[0],M=t.points[t.points.length-1]}else B=C[0],M=C[C.length-1];const O=wt(M.x-B.x),I=wt(M.y-B.y);R=null==M.x1?An.ROW:null==M.y1?An.COLUMN:Number.isFinite(O+I)?O>I?An.ROW:An.COLUMN:An.ROW,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),iu(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),iu(t,e,i,n),e.length=0,i.length=0)}s=o})),iu(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?An.ROW:An.COLUMN,Number.isFinite(u)||(h=An.COLUMN),Number.isFinite(p)||(h=An.ROW);const g=i*(h===An.ROW?u:p);let f=0,m=!0;const v=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fu=function(t,e){return function(i,n){e(i,n,t)}};let mu=class extends pd{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=dl,this.builtinContributions=[uu,du],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:$r(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;if(e.beginPath(),t.pathShape)Bn(t.pathShape.commandList,e,i,n,1,1,g);else{Bn((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,n,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,n,y,_,m,v,d,s,a,o),_&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-n,d),e.stroke())),y&&(a?a(e,t.attribute,d):m&&(e.setCommonStyle(t,t.attribute,u-i,p-n,d),e.fill())),this.afterRenderStep(t,e,i,n,y,_,m,v,d,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};mu=pu([Ri(),fu(0,Mi(Ki)),fu(0,Oi(Jl)),gu("design:paramtypes",[Object])],mu);var vu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_u=function(t,e){return function(i,n){e(i,n,t)}};let bu=class extends pd{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=pl,this.builtinContributions=[jd,zd,Nd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:$r(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:y=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:w}=t.attribute;k=(null!=k?k:b-S)||0,w=(null!=w?w:x-A)||0;const T=Nl(g,f,k,w,c),C=Vl(g,v,k,w),E=Dl(c,d),M=Fl(u,m);if(!t.valid||!y)return;if(!E&&!M)return;if(!(T||C||a||o||d))return;0===p||_(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,k,w)):(e.beginPath(),Pd(e,i,n,k,w,p));const B={doFill:E,doStroke:M};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,E,M,T,C,h,s,a,o,B),B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-n,h),e.fill())),B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,A-n,h),e.stroke())),this.afterRenderStep(t,e,i,n,E,M,T,C,h,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).rect;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};bu=vu([Ri(),_u(0,Mi(Ki)),_u(0,Oi(th)),yu("design:paramtypes",[Object])],bu);var xu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Su=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Au=function(t,e){return function(i,n){e(i,n,t)}};let ku=class extends pd{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fl,this.builtinContributions=[Vd,Gd,Hd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=$r(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const s=e.project(i,n,A),r=e.camera;e.camera=null,!1===x.draw(e,_(c)?[c[0]*p,c[1]*g]:c*p,s.x,s.y,void 0,((s,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-n,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-n)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,n,A,((s,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-n,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-n)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,y,b,m,v,h,s,a,o),y&&!x.isSvg&&(a?a(e,t.attribute,h):m&&(e.setCommonStyle(t,t.attribute,d-i,u-n,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-n)/g,h),e.stroke())),this.afterRenderStep(t,e,i,n,y,b,m,v,h,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};ku=xu([Ri(),Au(0,Mi(Ki)),Au(0,Oi(eh)),Su("design:paramtypes",[Object])],ku);const wu=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ht)}allocate(t,e,i,n){if(!this.pools.length)return(new Ht).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new Ht(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const Tu=new class extends xd{constructor(){super(...arguments),this.time=wn.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let w,{background:T}=t.attribute;if(!T)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),w&&e.setTransformFromMatrix(w,!0,1))};let E;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const M=g(T)&&T.background,B=t.transMatrix.onlyTranslate();if(M){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),n=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),s=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(y=T.height)&&void 0!==y?y:e.height();if(E=wu.allocate(i,n,i+s,n+r),T=T.background,!B){const t=E.width(),e=E.height();E.set((null!==(_=T.x)&&void 0!==_?_:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,B||(E=dd(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const s=t.resources.get(T);if("success"!==s.state||!s.data)return void C();e.highPerformanceSave(),B&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,l),this.doDrawImage(e,s.data,E,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:s}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=T,s?(Pd(e,E.x1,E.y1,E.width(),E.height(),s),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}M&&wu.free(E),C()}};var Cu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mu=function(t,e){return function(i,n){e(i,n,t)}};let Bu=class extends pd{constructor(t){super(),this.textRenderContribitions=t,this.numberType=ml,this.builtinContributions=[Tu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const d=$r(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,whiteSpace:v=d.whiteSpace,fontSize:y=d.fontSize,verticalMode:_=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!_&&"vertical"===m){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=ja(t.attribute.lineHeight,y))&&void 0!==c?c:y,w=this.valid(t,d,a,o);if(!w)return;const{fVisible:T,sVisible:C,doFill:E,doStroke:M}=w,B=!f,R=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,n,E,M,T,C,d,s,a,o),B&&this.transformUseContext2d(t,d,R,e);const O=(s,r,l,h)=>{let c=i+r;const u=n+l;if(h){e.highPerformanceSave(),c+=y;const t=Jc.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Jc.free(t)}M&&(o?o(e,t.attribute,d):C&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,d),e.strokeText(s,c,u,R))),E&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-n,d),e.fillText(s,c,u,R),this.drawUnderLine(p,g,t,c,u,R,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,R),"horizontal"===m){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;M&&(o?o(e,t.attribute,d):C&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,d),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),E&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-n,d),s.lines.forEach((s=>{var a,o;e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n-(o=y,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*y,R,s.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=k*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Et(e,r)}));let a=0,o=0;"bottom"===A?o=-s:"middle"===A&&(o=-s/2),"center"===S?a-=r/2:"right"===S&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===S?l+=n/2:"right"===S&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;O(i,s-(e+1)*k+o,l,r),l+=n}))}))}else if("horizontal"===m){e.setTextStyle(t.attribute,d,R);const i=t.clipedText;let n=0;k!==y&&("top"===A?n=(k-y)/2:"middle"===A||"bottom"===A&&(n=-(k-y)/2)),O(i,0,n,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,R);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?s-=r/2:"right"===S&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;O(e,a,s,n),s+=i}))}}B&&this.restoreTransformUseContext2d(t,d,R,e),this.afterRenderStep(t,e,i,n,E,M,T,C,d,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:f=a.fillOpacity}=i.attribute,m=i.clipedWidth,v=lh(l,m),y=hh(h,c,c),_={lineWidth:0,stroke:d,opacity:u,strokeOpacity:f};if(t){_.lineWidth=t,o.setStrokeStyle(i,_,n,s,a),g&&o.setLineDash(g),o.beginPath();const e=s+y+c+p;o.moveTo(n+v,e,r),o.lineTo(n+v+m,e,r),o.stroke()}if(e){_.lineWidth=e,o.setStrokeStyle(i,_,n,s,a),o.beginPath();const t=s+y+c/2;o.moveTo(n+v,t,r),o.lineTo(n+v+m,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,f=hh("alphabetic",h,h),m={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),p&&l.setLineDash(p),l.beginPath();const e=s+f+h+v+u;l.moveTo(n+0,e,r),l.lineTo(n+0+a,e,r),l.stroke()}if(v=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+h/2+v;l.moveTo(n+0,t,r),l.lineTo(n+0+a,t,r),l.stroke()}}};function Ru(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ju=function(t,e){return function(i,n){e(i,n,t)}};let Nu=class extends pd{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=ul,this.builtinContributions=[Lu,Pu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=$r(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Ru(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Ru(t,e,i,n);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(s)?null!==(a=s[r%e.length])&&void 0!==a?a:0:s,y=v/m;const _=Ou(d,u),b=Ou(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Iu(h,y,_,d,u),A=Iu(h,y,b,p,g),k=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=Ou(k,w),C=Iu(h,Ou(y,v),T,k,w);let E=Math.atan2(S.y-C.y,S.x-C.x);const M=Math.atan2(A.y-C.y,A.x-C.x);let B=M-E;B<0&&(E=M,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),B&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,v),t.lineTo(A.x+i,A.y+n)}r||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,v,y,f,m,l,s,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-n,l),e.fill())),y&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,d-i,u-n,l),e.stroke())),this.afterRenderStep(t,e,i,n,v,y,f,m,l,s,a,o)}draw(t,e,i,n){const s=$r(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}};Nu=Du([Ri(),ju(0,Mi(Ki)),ju(0,Oi(Ql)),Fu("design:paramtypes",[Object])],Nu);var zu=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hu=function(t,e){return function(i,n){e(i,n,t)}};let Gu=class{constructor(t){this.groupRenderContribitions=t,this.numberType=ll}drawShape(t,e,i,n,s,r,a,o){const l=$r(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Nl(u,m,p,g,h),k=Vl(u,v,p,g),w=Dl(h,c),T=Fl(d,x);if(!t.valid||!S)return;if(!f){if(!w&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),Pd(e,i,n,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Od));const C={doFill:w,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===wn.beforeFillStroke&&r.drawShape(t,e,i,n,w,T,A,k,l,s,a,o,C)})),f&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===wn.afterFillStroke&&r.drawShape(t,e,i,n,w,T,A,k,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?s.save():s.highPerformanceSave();const o=s.baseGlobalAlpha;s.baseGlobalAlpha*=a;const l=$r(t,null==n?void 0:n.theme).group,h=s.modelMatrix;if(s.camera){const e=Qc.allocate(),i=Qc.allocate();ad(i,t,l),rd(e,h||e,i),s.modelMatrix=e,Qc.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&s.translate(c,d),n&&n.drawingCb&&(u=n.drawingCb()),s.modelMatrix!==h&&Qc.free(s.modelMatrix),s.modelMatrix=h,s.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};Gu=zu([Ri(),Hu(0,Mi(Ki)),Hu(0,Oi(ql)),Vu("design:paramtypes",[Object])],Gu);const Uu=Symbol.for("IncrementalDrawContribution"),Wu=Symbol.for("ArcRender"),Yu=Symbol.for("AreaRender"),Ku=Symbol.for("CircleRender"),Xu=Symbol.for("GraphicRender"),$u=Symbol.for("GroupRender"),Zu=Symbol.for("LineRender"),qu=Symbol.for("PathRender"),Ju=Symbol.for("PolygonRender"),Qu=Symbol.for("RectRender"),tp=Symbol.for("SymbolRender"),ep=Symbol.for("TextRender"),ip=Symbol.for("RichTextRender"),np=Symbol.for("GlyphRender"),sp=Symbol.for("DrawContribution");var rp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ap=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const op=Symbol.for("DrawItemInterceptor"),lp=new Ht,hp=new Ht;class cp{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){lp.copy(n.dirtyBounds),hp.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,Jc.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(lp),n.backupDirtyBounds.copy(hp)),!0}}class dp{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let up=class{constructor(){this.order=1,this.interceptors=[new cp,new gp,new pp,new dp]}afterDrawItem(t,e,i,n,s){for(let r=0;r(e=t.numberType===sl,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=kt;for(;o<0;)o+=kt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",n.renderGroup(t,i,r),i.hack_pieFace="inside",n.renderGroup(t,i,r),i.hack_pieFace="top",n.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i,t.parent.globalTransMatrix)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&Qc.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var fp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vp=function(t,e){return function(i,n){e(i,n,t)}};const yp=Symbol.for("RenderService");let _p=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};_p=fp([Ri(),vp(0,Mi(sp)),mp("design:paramtypes",[Object])],_p);var bp=new yi((t=>{t(yp).to(_p)}));const xp=Symbol.for("PickerService"),Sp=Symbol.for("GlobalPickerService");var Ap=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const kp=Symbol.for("PickItemInterceptor");let wp=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=$r(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Jc.allocateByObj(a),u=new jt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};wp=Ap([Ri()],wp);let Tp=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new jt(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}};Tp=Ap([Ri()],Tp);let Cp=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===sl,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=kt;for(;o<0;)o+=kt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Cp=Ap([Ri()],Cp);var Ep=new yi(((t,e,i)=>{i(xp)||(t(Sp).toSelf(),t(xp).toService(Sp)),t(Cp).toSelf().inSingletonScope(),t(kp).toService(Cp),t(wp).toSelf().inSingletonScope(),t(kp).toService(wp),t(Tp).toSelf().inSingletonScope(),t(kp).toService(Tp),$i(t,kp)})),Mp=new yi((t=>{t(vl).to(od).inSingletonScope(),t(yl).toConstantValue(ld)}));const Bp=Symbol.for("AutoEnablePlugins"),Rp=Symbol.for("PluginService");var Op=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,n){e(i,n,t)}};let Lp=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&qs.isBound(Bp)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Lp=Op([Ri(),Pp(0,Mi(Ki)),Pp(0,Oi(Bp)),Ip("design:paramtypes",[Object])],Lp);var Dp=new yi((t=>{t(Rp).to(Lp),function(t,e){t(Ki).toDynamicValue((t=>{let{container:i}=t;return new Xi(e,i)})).whenTargetNamed(e)}(t,Bp)})),Fp=new yi((t=>{$i(t,Ji)})),jp=new yi((t=>{t($s).to(Zs).inSingletonScope(),$i(t,$s)})),Np=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Vp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ds.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=tr({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Vp=Np([Ri(),zp("design:paramtypes",[])],Vp);var Hp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Up=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Ds.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return null}release(){}};Up=Hp([Ri(),Gp("design:paramtypes",[])],Up);var Wp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kp=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Ds.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=tr({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(a,o,l,h),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),n.nativeContext.restore()}merge(t){}};Kp=Wp([Ri(),Yp("design:paramtypes",[])],Kp);var Xp=new yi((t=>{t(Vp).toSelf(),t(Kp).toSelf(),t(Up).toSelf(),t(El).toService(Vp),t(Ml).toService(Kp),t(Bl).toService(Up)}));var $p=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function Zp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return $p(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function Jp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var Qp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eg=function(t,e){return function(i,n){e(i,n,t)}};let ig=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt,this.global=Ds.global,this.layerService=Ds.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,viewBox:s,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,s.width(),s.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(o=a,l=n.dirtyBounds,h=!1,null===o?l:null===l?o:(de=o.x1,ue=o.x2,pe=o.y1,ge=o.y2,fe=l.x1,me=l.x2,ve=l.y1,ye=l.y2,h&&(de>ue&&([de,ue]=[ue,de]),pe>ge&&([pe,ge]=[ge,pe]),fe>me&&([fe,me]=[me,fe]),ve>ye&&([ve,ye]=[ye,ve])),de>=me||ue<=fe||pe>=ye||ge<=ve?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(de,fe),y1:Math.max(pe,ve),x2:Math.min(ue,me),y2:Math.min(ge,ye)}));a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}var o,l,h;const c=i.dpr%1;(c||.5!==c)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(s.x1,s.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xs.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Jc.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Jp(e,i,xs.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!xe(t.AABBBounds,this.dirtyBounds,!1))return;let s,r=i;if(this.useDirtyBounds){s=wu.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Jc.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;n?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Zp(t,xs.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),wu.free(s),Jc.free(r))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||qs.get(Uu);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sg=class extends eu{constructor(){super(...arguments),this.numberType=cl}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=$r(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=jl(u,p,c),y=zl(u,g),_=Dl(c),b=Fl(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};sg=ng([Ri()],sg);var rg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ag=class extends cu{constructor(){super(...arguments),this.numberType=rl}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=$r(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=jl(u,d,c),f=Dl(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};ag=rg([Ri()],ag);var og,lg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cg=function(t,e){return function(i,n){e(i,n,t)}},dg=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(og||(og={}));let ug=class extends ig{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=og.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qi([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return dg(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xs.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return dg(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return dg(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>dg(this,void 0,void 0,(function*(){if(2!==t.count)yield qp(t,xs.zIndex,((i,n)=>{if(this.status===og.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return dg(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return dg(this,void 0,void 0,(function*(){this.rendering&&(this.status=og.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=og.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return dg(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>dg(this,void 0,void 0,(function*(){yield qp(t,xs.zIndex,(t=>dg(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};ug=lg([Ri(),cg(0,Bi(Xu)),cg(1,Mi(sg)),cg(2,Mi(ag)),cg(3,Mi(Ki)),cg(3,Oi(op)),hg("design:paramtypes",[Array,Object,Object,Object])],ug);var pg=new yi((t=>{t(xd).toSelf().inSingletonScope(),t(kd).toSelf().inSingletonScope(),t(sp).to(ig),t(Uu).to(ug),t($u).to(Gu).inSingletonScope(),t(Xu).toService($u),$i(t,ql),t(Ad).toSelf().inSingletonScope(),$i(t,nh),$i(t,Xu),t(up).toSelf().inSingletonScope(),t(op).toService(up),$i(t,op)}));function gg(){gg.__loaded||(gg.__loaded=!0,qs.load(Ll),qs.load(Mp),qs.load(bp),qs.load(Ep),qs.load(Dp),function(t){t.load(Fp),t.load(jp),t.load(Xp)}(qs),function(t){t.load(pg)}(qs))}gg.__loaded=!1,gg();const fg=qs.get(Qi);Ds.global=fg;const mg=qs.get(Tl);Ds.graphicUtil=mg;const vg=qs.get(wl);Ds.transformUtil=vg;const yg=qs.get(vl);Ds.graphicService=yg;const _g=qs.get(Cl);Ds.layerService=_g;class bg{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ds.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Ds.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Ds.graphicService.hooks.onAttributeUpdate.taps=Ds.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.onSetStage.taps=Ds.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class xg{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vi.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class Sg{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ds.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Ds.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Ds.graphicService.hooks.onAddIncremental.taps=Ds.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.onClearIncremental.taps=Ds.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ds.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class Ag{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=vi.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.onRemove.unTap(this.key),Ds.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?Ds.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ds.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[De(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const s=De(n);u(t[n])||(e[s]=i(t[n]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:$r(t).text)}getTransformOfText(t){const e=$r(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,s=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=s,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[n]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[n]}`}}updateStyleOfWrapContainer(t,e,i,n,s){const{pointerEvents:r}=s;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",n.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=s.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=Oe(h,c);o=t.x,l=t.y}const p=Ds.global.getElementTopLeft(n,!1),f=e.window.getTopLeft(!1),m=e.viewBox,v=o+f.left-p.left+m.x1,_=l+f.top-p.top+m.y1;if(a.left=`${v}px`,a.top=`${_}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(s.style)){const e=s.style({top:_,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(s.style)?a=Object.assign(Object.assign({},a),s.style):y(s.style)&&s.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),n=i[1].trim();e&&n&&(t[e]=n)}}})),t}(s.style)));Ds.global.updateDom(i,{width:s.width,height:s.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ds.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xs.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xs.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ds.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:s,container:r}=i;if(!s)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof s?this.htmlMap[a].wrapContainer.innerHTML=s:s!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(s));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,r);t&&("string"==typeof s?t.innerHTML=s:t.appendChild(s),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ds.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const kg=new Ht;class wg{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Ds.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(kg.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(kg,t.parent&&t.parent.globalTransMatrix)))})),Ds.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),Ds.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Ds.graphicService.hooks.beforeUpdateAABBBounds.taps=Ds.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.afterUpdateAABBBounds.taps=Ds.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.onRemove.taps=Ds.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Tg=new Ht;class Cg{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vi.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ht}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=$r(i).group,{display:s=n.display}=i.attribute;if("flex"!==s)return;const{flexDirection:r=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:l=n.clip}=i.attribute,{alignContent:h=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((n=>{const s=this.getAABBBounds(n);s.empty()||("column"===r||"column-reverse"===r?(e+=s.height(),t=Math.max(t,s.width())):(t+=s.width(),e=Math.max(e,s.height())),i+=s.x1,i+=s.y1,i+=s.x2,i+=s.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),n="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:n}),v+=i,y=Math.max(y,n)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>f.len?0===t?(b.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=s,e=r):(t+=s,e=Math.max(e,r))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=r;i--){t-=s[i].mainLen;const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}}layoutCross(t,e,i,n,s,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,Ds.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Ds.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&Tg.copy(n)})),Ds.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(Tg.equals(i)||this.tryLayout(t,!1))})),Ds.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Ds.graphicService.hooks.onAttributeUpdate.taps=Ds.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.beforeUpdateAABBBounds.taps=Ds.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.afterUpdateAABBBounds.taps=Ds.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ds.graphicService.hooks.onSetStage.taps=Ds.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const Eg=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===ua.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=ua.INITIAL,Ds.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Ds.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:da},{mode:"timeout",cons:ca},{mode:"manual",cons:ha}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==ua.INITIAL&&(this.status=ua.PAUSE,!0)}resume(){return this.status!==ua.INITIAL&&(this.status=ua.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===ua.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===ua.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=ua.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=ua.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Eg.addTimeline(fa),Eg.setFPS(60);class Mg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=oo.Get(e,ao.Color1),this.ambient=i;const n=Rt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Mt(Et((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=y(e)?oo.Get(e,ao.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}function Bg(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Rg(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}class Og{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Qc.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Qc.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):n&&n(),i&&Ds.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const s=n.params.ReactDOM,{element:r,container:a}=i;if(!r||!s||!s.createRoot&&!s.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])s.createRoot?this.htmlMap[o].root.render(r):s.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),s.createRoot){const i=s.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else s.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{s.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,l,h,i),this.htmlMap[o].renderId=this.renderId}}const Dg="white";class Fg extends Sl{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Dg}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new Kr,this.hooks={beforeRender:new qi(["stage"]),afterRender:new qi(["stage"])},this.global=Ds.global,!this.global.env&&Pg()&&this.global.setEnv("browser"),this.window=qs.get(Ir),this.renderService=qs.get(yp),this.pluginService=qs.get(Rp),this.layerService=qs.get(Cl),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Dg,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Eg,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new ga,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new la(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1),this.light=new Mg(f,m,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Og(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new xg))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new bg))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Sg))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new wg,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Cg))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new Ag))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new Lg))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=qs.get(xp));const i=this.pickerService.pick(this.children,new jt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=qs.get(Ir),i=t?-t.x1:0,n=t?-t.y1:0,s=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:n,x2:s,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var jg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ng=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zg=new $t(1,0,0,1,0,0),Vg={x:0,y:0};let Hg=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new $t(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new $t(1,0,0,1,0,0),this.path=new ds,this._clearMatrix=new $t(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Jc.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Jc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Jc.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Vg),function(t,e,i){return Mr(t,0,!1,e,i)}(this.path.commandList,Vg.x,Vg.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Vg);const i=md(this,this.lineWidth,this.dpr);return function(t,e,i,n){return Mr(t,e,!0,i,n)}(this.path.commandList,i,Vg.x,Vg.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(zg,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Jc.free(t))),this.stack.length=0}};Hg=jg([Ri(),Ng("design:paramtypes",[Object,Number])],Hg);var Gg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Wg={WIDTH:500,HEIGHT:500,DPR:1};let Yg=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Wg.WIDTH,height:s=Wg.HEIGHT,dpr:r=Wg.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*r,this._pixelHeight=s*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=s,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};Yg.env="browser",Yg=Gg([Ri(),Ug("design:paramtypes",[Object])],Yg);var Kg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Xg=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ht}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};Xg=Kg([Ri()],Xg);var $g=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qg=class{constructor(){this._uid=vi.GenAutoIncrementId(),this.viewBox=new Ht,this.modelMatrix=new $t(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,s,r){this.modelMatrix.setValue(t,e,i,n,s,r)}getViewBoxTransform(){return this.modelMatrix}};qg=$g([Ri(),Zg("design:paramtypes",[])],qg);var Jg=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tf=function(t,e){return function(i,n){e(i,n,t)}};let ef=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Ds.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const s=i.bounds.width(),r=i.bounds.height();if(!(new Ht).setValue(0,0,s,r).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new $t(1,0,0,1,0,0);let o;for(let s=t.length-1;s>=0&&(n=t[s].isContainer?this.pickGroup(t[s],e,a,i):this.pickItem(t[s],e,a,i),!n.graphic);s--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){var n;return!!(null===(n=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===n?void 0:n.graphic)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Qc.allocate();if(sd(i,e),a){if(i){const t=Qc.allocate();r.modelMatrix=rd(t,a,i),Qc.free(i)}}else sd(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(r.isContainer){const i=new jt(e.x,e.y),a=$r(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,s=this.pickGroup(r,i,l,n)}else{const a=new jt(e.x,e.y);l.transformPoint(a,a);const o=$r(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,n);d&&d.graphic&&(s.graphic=d.graphic,s.params=d.params)}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&Qc.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!u||t.stage.camera||(s.group=t),Jc.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};ef=Jg([Ri(),tf(0,Mi(Ki)),tf(0,Oi(kp)),Qg("design:paramtypes",[Object])],ef);let nf=!1;const sf=new yi((t=>{nf||(nf=!0,t(Kd).toSelf().inSingletonScope(),t(Wu).to(Kd).inSingletonScope(),t(Xu).toService(Wu),t(Xl).toService(Ad),$i(t,Xl))}));let rf=!1;const af=new yi((t=>{rf||(rf=!0,t(bu).toSelf().inSingletonScope(),t(Qu).to(bu).inSingletonScope(),t(Xu).toService(Qu),t(Fd).toSelf(),t(Dd).toSelf(),t(th).toService(Fd),t(th).toService(Dd),t(th).toService(Ad),$i(t,th))}));let of=!1;const lf=new yi((t=>{of||(of=!0,t(eu).toSelf().inSingletonScope(),t(sg).toSelf().inSingletonScope(),t(Zu).to(eu).inSingletonScope(),t(Xu).toService(Zu))}));let hf=!1;const cf=new yi((t=>{hf||(hf=!0,t(cu).toSelf().inSingletonScope(),t(Yu).to(cu).inSingletonScope(),t(Xu).toService(Yu),t($l).toService(Ad),$i(t,$l),t(ag).toSelf().inSingletonScope())}));let df=!1;const uf=new yi((t=>{df||(df=!0,t(ku).toSelf().inSingletonScope(),t(tp).to(ku).inSingletonScope(),t(Xu).toService(tp),t(eh).toService(Ad),$i(t,eh))}));let pf=!1;const gf=new yi((t=>{pf||(pf=!0,t(qd).toSelf().inSingletonScope(),t(Ku).to(qd).inSingletonScope(),t(Xu).toService(Ku),t(Zl).toService(Ad),$i(t,Zl))}));let ff=!1;const mf=new yi((t=>{ff||(ff=!0,t(ep).to(Bu).inSingletonScope(),t(Xu).toService(ep),t(ih).toService(Ad),$i(t,ih))}));let vf=!1;const yf=new yi((t=>{vf||(vf=!0,t(mu).toSelf().inSingletonScope(),t(qu).to(mu).inSingletonScope(),t(Xu).toService(qu),t(Jl).toService(Ad),$i(t,Jl))}));let _f=!1;const bf=new yi((t=>{_f||(_f=!0,t(Ju).to(Nu).inSingletonScope(),t(Xu).toService(Ju),t(Ql).toService(Ad),$i(t,Ql))}));var xf=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Af=class extends pd{constructor(){super(),this.numberType=gl,this.builtinContributions=[Tu],this.init()}drawShape(t,e,i,n,s){const r=$r(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=jl(o,l,!0),d=jl(o,a,!0);c&&(e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,d,c,d,r,s),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,d,c,d,r,s))}drawIcon(t,e,i,n,s){var r;const a=$r(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(v-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,v,y)):(e.beginPath(),Pd(e,i-t,n-s,v,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const n=$r(t).richtext;this._draw(t,n,!1,i)}};Af=xf([Ri(),Sf("design:paramtypes",[])],Af);let kf=!1;const wf=new yi((t=>{kf||(kf=!0,t(ip).to(Af).inSingletonScope(),t(Xu).toService(ip))}));const Tf=(t,e)=>(d(Ef.warnHandler)&&Ef.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Cf=(t,e,i)=>{if(!d(Ef.errorHandler))throw new Error(t);Ef.errorHandler.call(null,t,e)},Ef={silent:!1,warnHandler:!1,errorHandler:!1},Mf=Pg(),Bf=Mf&&globalThis?globalThis.document:void 0;function Rf(t){return("desktop-browser"===t||"mobile-browser"===t)&&Mf}function Of(t){return If(t)||"mobile-browser"===t}function If(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Pf=0;function Lf(){return Pf>=9999999&&(Pf=0),Pf++}function Df(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Ff(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const jf=(t,e,i)=>(t.fields=e||[],t.fname=i,t),Nf=t=>e=>R(e,t),zf=t=>{it.getInstance().error(t)},Vf=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||zf("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&zf("Access path missing closing bracket: "+t),a&&zf("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return jf((i&&i.get||Nf)(n),[s],e||s)},Hf=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_(t)){const n=t.map((t=>Vf(t,e,i)));return t=>n.map((e=>e(t)))}return Vf(t,e,i)};Hf("id");const Gf=jf((function(t){return t}),[],"identity");jf((function(){return 0}),[],"zero"),jf((function(){return 1}),[],"one"),jf((function(){return!0}),[],"true"),jf((function(){return!1}),[],"false"),jf((function(){return{}}),[],"emptyObject");const Uf=function(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!f(e)&&!f(i))return e===i;const s=_(e)?e:e[t],r=_(i)?i:i[t];return s===r||!1!==n&&(_(r)?!(!_(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!g(r)&&!(!g(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>Uf(t,r,s)))))},Wf=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Yf=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Kf extends Sl{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,Yf.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Yf.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.attribute.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const _m=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},bm=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class xm extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=na.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=na.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||_m(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=bm(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const i=na.now(),s=this.lastMoveTime;if(i-s<100){const t=s-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=bm(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=_m(i,s),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=na.now()-i>this.config.press.time&&bm(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const km=[0,0,0];let wm=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},fs),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vs),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ys),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new $t(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new $t(1,0,0,1,0,0),this._clearMatrix=new $t(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new $t(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Jc.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Jc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Jc.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=kt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Kl.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Rg(km,[t,e,i],this.modelMatrix),t=km[0],e=km[1],i=km[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Rg(km,[t,e,i],this.modelMatrix),t=km[0],e=km[1],i=km[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Rg(km,[e,i,n],this.modelMatrix),e=km[0],i=km[1],n=km[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ds.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ds.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:ys.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:ys.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Rg(km,[e,i,n],this.modelMatrix),e=km[0],i=km[1],n=km[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vd(this,l,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r*this.dpr,n.shadowColor=a,n.shadowOffsetX=o*this.dpr,n.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),c?(n.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=s.lineWidth,stroke:o=s.stroke,lineJoin:l=s.lineJoin,lineDash:h=s.lineDash,lineCap:c=s.lineCap,miterLimit:d=s.miterLimit}=e;r.lineWidth=md(this,a,this.dpr),r.strokeStyle=vd(this,o,t,i,n),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=oh(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=oh(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Jc.free(t))),this.stack.length=0}};wm.env="browser",wm=Sm([Ri(),Am("design:paramtypes",[Object,Number])],wm);var Tm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Em=class extends Yg{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ds.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new wm(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.width=`${n}px`,t.style.height=`${s}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Mm(t,e){return new yi((i=>{i(Js).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Qs).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Em.env="browser",Em=Tm([Ri(),Cm("design:paramtypes",[Object])],Em);const Bm=Mm(Em,wm);var Rm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,n){e(i,n,t)}};let Pm=class extends ef{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Br.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dm=class{constructor(){this.type="group",this.numberType=ll}contains(t,e,i){return!1}};Dm=Lm([Ri()],Dm);const Fm=new yi(((t,e,i,n)=>{Fm.__vloaded||(Fm.__vloaded=!0,t(mm).to(Dm).inSingletonScope(),t(vm).toService(mm),$i(t,vm))}));Fm.__vloaded=!1;var jm=Fm;const Nm=new yi(((t,e,i,n)=>{i(Pm)||t(Pm).toSelf().inSingletonScope(),i(xp)?n(xp).toService(Pm):t(xp).toService(Pm)}));var zm,Vm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gm=zm=class extends qg{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${zm.idprefix}_${zm.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ds.global,this.viewBox=new Ht,this.modelMatrix=new $t(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zm.GenerateCanvasId(),canvasControled:!0};this.canvas=new Em(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new Em({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Gm.env="browser",Gm.idprefix="visactor_window",Gm.prefix_count=0,Gm=zm=Vm([Ri(),Hm("design:paramtypes",[])],Gm);const Um=new yi((t=>{t(Gm).toSelf(),t(Pr).toDynamicValue((t=>t.container.get(Gm))).whenTargetNamed(Gm.env)}));var Wm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Km{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Xm(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let $m=class extends Xg{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,n;let s=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0,a=s,o=r}else s=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=s,i=r,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Km(t)}return new Ht}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:s}=e;return s&&(y(s)?t.setAttribute("style",s):Object.keys(s).forEach((e=>{t.style[e]=s[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return Xm(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Xm(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vi.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,n+=s.offsetLeft,s=s.offsetParent;return{top:i,left:n}}};$m=Wm([Ri(),Ym("design:paramtypes",[])],$m);const Zm=new yi((t=>{Zm.isBrowserBound||(Zm.isBrowserBound=!0,t($m).toSelf().inSingletonScope(),t(Ji).toService($m))}));function qm(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];qm.__loaded||(qm.__loaded=!0,t.load(Zm),t.load(Bm),t.load(Um),e&&function(t){t.load(jm),t.load(Nm)}(t))}Zm.isBrowserBound=!1,qm.__loaded=!1;var Jm=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tv=function(t,e){return function(i,n){e(i,n,t)}};let ev=class extends ef{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Hg(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const s=this.pickerMap.get(t.numberType);if(!s)return null;const r=s.contains(t,e,n),a=r?t:null;return a?{graphic:a,params:r}:null}};ev=Jm([Ri(),tv(0,Mi(Ki)),tv(0,Oi(Xf)),tv(1,Mi(Ki)),tv(1,Oi(kp)),Qm("design:paramtypes",[Object,Object])],ev);const iv=new yi((t=>{iv.__vloaded||(iv.__vloaded=!0,$i(t,Xf))}));iv.__vloaded=!1;var nv=iv,sv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},av=function(t,e){return function(i,n){e(i,n,t)}};let ov=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ov=sv([Ri(),av(0,Mi(Wu)),rv("design:paramtypes",[Object])],ov);let lv=!1;const hv=new yi(((t,e,i,n)=>{lv||(lv=!0,t($f).to(ov).inSingletonScope(),t(Xf).toService($f))}));var cv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uv=function(t,e){return function(i,n){e(i,n,t)}};let pv=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=rl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};pv=cv([Ri(),uv(0,Mi(Yu)),dv("design:paramtypes",[Object])],pv);let gv=!1;const fv=new yi(((t,e,i,n)=>{gv||(gv=!0,t(Zf).to(pv).inSingletonScope(),t(Xf).toService(Zf))}));var mv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yv=function(t,e){return function(i,n){e(i,n,t)}};let _v=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=al}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};_v=mv([Ri(),yv(0,Mi(Ku)),vv("design:paramtypes",[Object])],_v);let bv=!1;const xv=new yi(((t,e,i,n)=>{bv||(bv=!0,t(qf).to(_v).inSingletonScope(),t(Xf).toService(qf))}));var Sv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Av=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kv=function(t,e){return function(i,n){e(i,n,t)}};let wv=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=ol}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,null,i))})),n}return!1}};wv=Sv([Ri(),kv(0,Mi(np)),Av("design:paramtypes",[Object])],wv);let Tv=!1;const Cv=new yi(((t,e,i,n)=>{Tv||(Tv=!0,t(rm).to(wv).inSingletonScope(),t(wv).toService(rm))}));var Ev=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Mv=class{constructor(){this.type="image",this.numberType=hl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Mv=Ev([Ri()],Mv);let Bv=!1;const Rv=new yi(((t,e,i,n)=>{Bv||(Bv=!0,t(Jf).to(Mv).inSingletonScope(),t(Mv).toService(Jf))}));var Ov=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pv=function(t,e){return function(i,n){e(i,n,t)}};let Lv=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=cl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Lv=Ov([Ri(),Pv(0,Mi(Zu)),Iv("design:paramtypes",[Object])],Lv);let Dv=!1;const Fv=new yi(((t,e,i,n)=>{Dv||(Dv=!0,t(Qf).to(Lv).inSingletonScope(),t(Xf).toService(Qf))}));var jv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zv=function(t,e){return function(i,n){e(i,n,t)}};let Vv=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=ul}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Vv=jv([Ri(),zv(0,Mi(Ju)),Nv("design:paramtypes",[Object])],Vv);let Hv=!1;const Gv=new yi(((t,e,i,n)=>{Hv||(Hv=!0,t(sm).to(Vv).inSingletonScope(),t(Xf).toService(sm))}));var Uv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yv=function(t,e){return function(i,n){e(i,n,t)}};let Kv=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=dl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Kv=Uv([Ri(),Yv(0,Mi(qu)),Wv("design:paramtypes",[Object])],Kv);let Xv=!1;const $v=new yi(((t,e,i,n)=>{Xv||(Xv=!0,t(tm).to(Kv).inSingletonScope(),t(Xf).toService(tm))}));var Zv=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jv=function(t,e){return function(i,n){e(i,n,t)}};const Qv=new Ht;let ty=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Qv.setValue(i.x1,i.y1,i.x2,i.y2),Qv.expand(-r/2),h=!Qv.containsPoint(e)}}return n.highPerformanceRestore(),h}};ty=Zv([Ri(),Jv(0,Mi(Qu)),qv("design:paramtypes",[Object])],ty);let ey=!1;const iy=new yi(((t,e,i,n)=>{ey||(ey=!0,t(em).to(ty).inSingletonScope(),t(Xf).toService(em))}));let ny=!1;const sy=new yi(((t,e,i,n)=>{ny||(ny=!0,t(Jf).to(Mv).inSingletonScope(),t(Mv).toService(Jf))}));var ry=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ay=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oy=function(t,e){return function(i,n){e(i,n,t)}};let ly=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=fl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ly=ry([Ri(),oy(0,Mi(tp)),ay("design:paramtypes",[Object])],ly);let hy=!1;const cy=new yi(((t,e,i,n)=>{hy||(hy=!0,t(im).to(ly).inSingletonScope(),t(Xf).toService(im))}));var dy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uy=class{constructor(){this.type="text",this.numberType=ml}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};uy=dy([Ri()],uy);let py=!1;const gy=new yi(((t,e,i,n)=>{py||(py=!0,t(nm).to(uy).inSingletonScope(),t(Xf).toService(nm))})),fy=new yi(((t,e,i,n)=>{i(ev)||t(ev).toSelf().inSingletonScope(),i(xp)?n(xp).toService(ev):t(xp).toService(ev)}));var my=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yy=class extends wm{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new $t(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};yy.env="node",yy=my([Ri(),vy("design:paramtypes",[Object,Number])],yy);var _y=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},by=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let xy=class extends Yg{constructor(t){super(t)}init(){this._context=new yy(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};xy.env="node",xy=_y([Ri(),by("design:paramtypes",[Object])],xy);const Sy=Mm(xy,yy);var Ay=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ky=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wy=function(t,e){return function(i,n){e(i,n,t)}};let Ty=class extends qg{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:vi.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xy(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new xy({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};Ty.env="node",Ty=Ay([Ri(),wy(0,Mi(Qi)),ky("design:paramtypes",[Object])],Ty);const Cy=new yi((t=>{t(Ty).toSelf(),t(Pr).toDynamicValue((t=>t.container.get(Ty))).whenTargetNamed(Ty.env)}));var Ey=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let My=class extends Xg{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Fa.call(t)}}getCancelAnimationFrame(){return t=>{Fa.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};My=Ey([Ri()],My);const By=new yi((t=>{By.isNodeBound||(By.isNodeBound=!0,t(My).toSelf().inSingletonScope(),t(Ji).toService(My))}));function Ry(t){Ry.__loaded||(Ry.__loaded=!0,t.load(By),t.load(Sy),t.load(Cy))}By.isNodeBound=!1,Ry.__loaded=!1;var Oy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Iy=class extends wm{draw(){}createPattern(t,e){return null}};Iy.env="wx",Iy=Oy([Ri()],Iy);var Py=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Dy=class extends Yg{constructor(t){super(t)}init(){this._context=new Iy(this,this._dpr)}release(){}};Dy.env="wx",Dy=Py([Ri(),Ly("design:paramtypes",[Object])],Dy);const Fy=Mm(Dy,Iy);var jy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zy=function(t,e){return function(i,n){e(i,n,t)}};class Vy{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Hy=class extends qg{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Vy}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:vi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Dy(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Dy({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Hy.env="wx",Hy=jy([Ri(),zy(0,Mi(Qi)),Ny("design:paramtypes",[Object])],Hy);const Gy=new yi((t=>{t(Hy).toSelf(),t(Pr).toDynamicValue((t=>t.container.get(Hy))).whenTargetNamed(Hy.env)}));var Uy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yy=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let Ky=class extends Xg{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s,r){return Yy(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Fa.call(t)}}getCancelAnimationFrame(){return t=>{Fa.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Ky=Uy([Ri(),Wy("design:paramtypes",[])],Ky);const Xy=new yi((t=>{Xy._isWxBound||(Xy._isWxBound=!0,t(Ky).toSelf().inSingletonScope(),t(Ji).toService(Ky))}));function $y(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];$y.__loaded||($y.__loaded=!0,t.load(Xy),t.load(Fy),t.load(Gy),e&&function(t){t.load(nv),t.load(fy),t.load(hv),t.load(fv),t.load(xv),t.load(Cv),t.load(Rv),t.load(Fv),t.load(Gv),t.load($v),t.load(iy),t.load(sy),t.load(cy),t.load(gy)}(t))}Xy._isWxBound=!1,$y.__loaded=!1;var Zy=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jy=function(t,e){return function(i,n){e(i,n,t)}};let Qy=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=md(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Qy=Zy([Ri(),Jy(0,Mi(Wu)),qy("design:paramtypes",[Object])],Qy);let t_=!1;const e_=new yi(((t,e,i,n)=>{t_||(t_=!0,t(am).to(Qy).inSingletonScope(),t(vm).toService(am))}));var i_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s_=function(t,e){return function(i,n){e(i,n,t)}};const r_=new Ht;let a_=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=md(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;r_.setValue(i.x1,i.y1,i.x2,i.y2),r_.expand(-r/2),h=!r_.containsPoint(e)}}return n.highPerformanceRestore(),h}};a_=i_([Ri(),s_(0,Mi(Qu)),n_("design:paramtypes",[Object])],a_);let o_=!1;const l_=new yi(((t,e,i,n)=>{o_||(o_=!0,t(dm).to(a_).inSingletonScope(),t(vm).toService(dm))}));var h_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let c_=class extends pd{};c_=h_([Ri()],c_);var d_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},u_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p_=function(t,e){return function(i,n){e(i,n,t)}};let g_=class extends c_{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=cl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=$r(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return n.lineWidth=md(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Qc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};g_=d_([Ri(),p_(0,Mi(Zu)),u_("design:paramtypes",[Object])],g_);let f_=!1;const m_=new yi(((t,e,i,n)=>{f_||(f_=!0,t(hm).to(g_).inSingletonScope(),t(vm).toService(hm))}));var v_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__=function(t,e){return function(i,n){e(i,n,t)}};let b_=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=rl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;const{fillPickable:o=s.fillPickable,strokePickable:l=s.strokePickable}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=md(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h})),n.highPerformanceRestore(),h}};b_=v_([Ri(),__(0,Mi(Yu)),y_("design:paramtypes",[Object])],b_);let x_=!1;const S_=new yi(((t,e,i,n)=>{x_||(x_=!0,t(om).to(b_).inSingletonScope(),t(vm).toService(om))}));var A_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},w_=function(t,e){return function(i,n){e(i,n,t)}};let T_=class extends c_{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=$r(t).symbol,a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(n.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return n.lineWidth=md(n,s+r,n.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Qc.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),u}};T_=A_([Ri(),w_(0,Mi(tp)),k_("design:paramtypes",[Object])],T_);let C_=!1;const E_=new yi(((t,e,i,n)=>{C_||(C_=!0,t(um).to(T_).inSingletonScope(),t(vm).toService(um))}));var M_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},B_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},R_=function(t,e){return function(i,n){e(i,n,t)}};let O_=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=al}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=md(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};O_=M_([Ri(),R_(0,Mi(Ku)),B_("design:paramtypes",[Object])],O_);let I_=!1;const P_=new yi(((t,e,i,n)=>{I_||(I_=!0,t(lm).to(O_).inSingletonScope(),t(vm).toService(lm))}));var L_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},D_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},F_=function(t,e){return function(i,n){e(i,n,t)}};let j_=class extends c_{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=ml}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=$r(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=hh(a,u,s),v=lh(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&Qc.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};j_=L_([Ri(),F_(0,Mi(ep)),D_("design:paramtypes",[Object])],j_);let N_=!1;const z_=new yi(((t,e,i,n)=>{N_||(N_=!0,t(pm).to(j_).inSingletonScope(),t(vm).toService(pm))}));var V_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},H_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},G_=function(t,e){return function(i,n){e(i,n,t)}};let U_=class extends c_{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=dl}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return n.lineWidth=md(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Qc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};U_=V_([Ri(),G_(0,Mi(qu)),H_("design:paramtypes",[Object])],U_);let W_=!1;const Y_=new yi(((t,e,i,n)=>{W_||(W_=!0,t(cm).to(U_).inSingletonScope(),t(vm).toService(cm))}));var K_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},X_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,n){e(i,n,t)}};let Z_=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=ul}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=$r(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer;return n.lineWidth=md(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Z_=K_([Ri(),$_(0,Mi(Ju)),X_("design:paramtypes",[Object])],Z_);let q_=!1;const J_=new yi(((t,e,i,n)=>{q_||(q_=!0,t(gm).to(Z_).inSingletonScope(),t(vm).toService(gm))}));var Q_=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eb=function(t,e){return function(i,n){e(i,n,t)}};let ib=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ib=Q_([Ri(),eb(0,Mi(ip)),tb("design:paramtypes",[Object])],ib);let nb=!1;const sb=new yi(((t,e,i,n)=>{nb||(nb=!0,t(fm).to(ib).inSingletonScope(),t(vm).toService(fm))})),rb=Pg();function ab(){ab.__loaded||(ab.__loaded=!0,ld.RegisterGraphicCreator("arc",Gc),qs.load(sf),qs.load(rb?e_:hv))}ab.__loaded=!1;const ob=ab;function lb(){lb.__loaded||(lb.__loaded=!0,ld.RegisterGraphicCreator("area",zc),qs.load(cf),qs.load(rb?S_:fv))}lb.__loaded=!1;const hb=lb;function cb(){cb.__loaded||(cb.__loaded=!0,ld.RegisterGraphicCreator("circle",ah),qs.load(gf),qs.load(rb?P_:xv))}cb.__loaded=!1;const db=cb;function ub(){ub.__loaded||(ub.__loaded=!0,ld.RegisterGraphicCreator("group",Al))}ub.__loaded=!1;const pb=ub;function gb(){gb.__loaded||(gb.__loaded=!0,ld.RegisterGraphicCreator("line",xc),qs.load(lf),qs.load(rb?m_:Fv))}gb.__loaded=!1;const fb=gb;function mb(){mb.__loaded||(mb.__loaded=!0,ld.RegisterGraphicCreator("path",Fc),qs.load(yf),qs.load(rb?Y_:$v))}mb.__loaded=!1;const vb=mb;function yb(){yb.__loaded||(yb.__loaded=!0,ld.RegisterGraphicCreator("polygon",Yc),qs.load(bf),qs.load(rb?J_:Gv))}yb.__loaded=!1;const _b=yb;function bb(){bb.__loaded||(bb.__loaded=!0,ld.RegisterGraphicCreator("rect",kc),qs.load(af),qs.load(rb?l_:iy))}bb.__loaded=!1;const xb=bb;function Sb(){Sb.__loaded||(Sb.__loaded=!0,ld.RegisterGraphicCreator("richtext",Pc),qs.load(wf),qs.load(rb?sb:sy))}Sb.__loaded=!1;const Ab=Sb;function kb(){kb.__loaded||(kb.__loaded=!0,ld.RegisterGraphicCreator("shadowRoot",Xc))}kb.__loaded=!1;const wb=kb;function Tb(){Tb.__loaded||(Tb.__loaded=!0,ld.RegisterGraphicCreator("symbol",yc),qs.load(uf),qs.load(rb?E_:cy))}Tb.__loaded=!1;const Cb=Tb;function Eb(){Eb.__loaded||(Eb.__loaded=!0,ld.RegisterGraphicCreator("text",ph),qs.load(mf),qs.load(rb?z_:gy))}Eb.__loaded=!1;const Mb=Eb;function Bb(){pb(),xb()}const Rb=-.5*Math.PI,Ob=1.5*Math.PI,Ib="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var Pb;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Pb||(Pb={}));const Lb={[Pb.selectedReverse]:{},[Pb.selected]:{},[Pb.hover]:{},[Pb.hoverReverse]:{}},Db={container:"",width:30,height:30,style:{}},Fb={debounce:gt,throttle:ft};Bb();class jb extends Kf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},jb.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===n){const t=i-this._viewPosition.y,e=ct(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ct(t-o/2,l,h);c=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===fg.env?(fg.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),fg.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=n,a=r-this._prePos,s=a/l):(r=i,a=r-this._prePos,s=a/o),[r,s]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:Fb[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:n=[0,1]}=this.attribute,s=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[s[0]+a,s[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:dt(o,n[0],n[1])}),"browser"===fg.env?(fg.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),fg.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=dt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",Fb[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ie(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Ie(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,e-(n+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function Nb(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&Nb(t,e)}))}jb.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const zb=t=>!u(t)&&!1!==t.visible;const Vb=["#ffffff","#000000"];function Hb(t,e,i,n,s,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ae(t).toHex(),o=new ae(e).toHex();return Gb(a,o,i,n,r)?a:function(t,e,i,n,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...Vb);for(const s of a)if(t!==s&&Gb(s,e,i,n,r))return s}(a,o,i,n,s,r)}function Gb(t,e,i,n,s){if("lightness"===s){const i=ae.getColorBrightness(new ae(e));return ae.getColorBrightness(new ae(t))<.5?i>=.5:i<.5}return n?Ub(t,e)>n:"largeText"===i?Ub(t,e)>3:Ub(t,e)>4.5}function Ub(t,e){const i=Wb(t),n=Wb(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function Wb(t){const e=le(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function Yb(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function Kb(t,e){return[t[0]*e,t[1]*e]}function Xb(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const $b=(t,e,i,n)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:Ib,fontSize:14},n),getTextBounds:i?void 0:dd,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function Zb(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const n=dd({text:t,fontFamily:e.fontFamily||i.fontFamily||Ib,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:n.width(),height:n.height()}}function qb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,n;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(n=t[e])&&void 0!==n?n:"text"}function Jb(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function Qb(t){const e=qb(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ld.richtext(Jb(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.html=n,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.react=n,t.text=i,t.renderable=!1,t}(t)),ld.text(t))}function tx(t,e,i,n,s){"right"===t?"center"===i?e.setAttribute("x",n-s/2):"right"===i||"end"===i?e.setAttribute("x",n):e.setAttribute("x",n-s):"center"===i?e.setAttribute("x",n+s/2):"right"===i||"end"===i?e.setAttribute("x",n+s):e.setAttribute("x",n)}function ex(){pb(),xb(),Cb(),Ab(),Mb()}var ix=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1&&void 0!==arguments[1]?arguments[1]:"type")}({text:n})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},Jb(Object.assign({type:v,text:n},s))),s),{visible:p(n)&&!1!==f,x:T,y:0});R=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=ix(a,["visible"]);if(f&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!n,x:R.AABBBounds.x1,y:R.AABBBounds.y1,width:R.AABBBounds.width(),height:R.AABBBounds.height()}),"rect");if(B(null==m?void 0:m.panel)||(t.states=m.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(R.attribute,t,new ds)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(n)&&"type"in n&&"text"===n.type?n.text:n,visible:p(n)&&!1!==f,lineHeight:null==s?void 0:s.fontSize},s),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=s.fontSize),R=x.createOrUpdateChild("tag-text",o,"text"),B(null==m?void 0:m.text)||(R.states=m.text);const d=Zb(o.text,s,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,E=d.height;k+=v;const M=null!==(i=r.size)&&void 0!==i?i:10,O=S(M)?M:Math.max(M[0],M[1]);w+=Math.max(E,r.visible?O:0);const{textAlign:I,textBaseline:P}=s;(p(l)||p(h))&&(p(l)&&kh&&(k=h,R.setAttribute("maxLineWidth",h-b[1]-b[2])));let L=0,D=0,F=0;"left"===I||"start"===I?F=1:"right"===I||"end"===I?F=-1:"center"===I&&(F=0),F?F<0?(L-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-C)):F>0&&x.setAttribute("x",b[3]):(L-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-C/2));const j="right"===_||"end"===_,N="left"===_||"start"===_;if((_?"center"===_:y)&&F){const t=k-b[1]-b[3],e=v+C,i=1===F?(t-e)/2+C+v/2:b[0]+C-(k/2+e/2-C)+v/2;if(R.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-C+O/2;A.setAttributes({x:t})}}if(N&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+C/2:-k+b[3]+b[1]+C,i=e+C;if(R.setAttributes({x:i,textAlign:"left"}),A){const t=e+O/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+C/2:t;if(R.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-C+O/2;A.setAttributes({x:t})}}"middle"===P?(D-=w/2,A&&A.setAttribute("y",0)):"bottom"===P?(D-=w,A&&A.setAttribute("y",-E/2),x.setAttribute("y",-b[2])):"top"===P&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",E/2));const{visible:z}=a,V=ix(a,["visible"]);if(f&&c(z)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:z&&!!n,x:L,y:D,width:k,height:w}),"rect");if(B(null==m?void 0:m.panel)||(t.states=m.panel),V.customShape){const e=V.customShape;t.pathProxy=t=>e(R.attribute,t,new ds)}this._bgRect=t}}this._textShape=R}}nx.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sx={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},rx={poptip:j({},sx)};class ax extends Kf{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}pb(),fb();class ox extends ax{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ox.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}ox.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pb(),xb();class lx extends ax{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lx.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}lx.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const hx=new Uint32Array(33),cx=new Uint32Array(33);cx[0]=0,hx[0]=~cx[0];for(let t=1;t<=32;++t)cx[t]=cx[t-1]<<1|1,hx[t]=~cx[t];function dx(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:n=0,left:s=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+s+r+o)/o),h=~~((e+n+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&hx[31&l]&cx[1+(31&h)])return!0}else{if(i[c]&hx[31&l])return!0;if(i[d]&cx[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,hx[31&s]&cx[1+(31&r)]);else for(n(a,hx[31&s]),n(o,cx[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,cx[31&i]|hx[1+(31&n)]);else for(s(r,cx[31&i]),s(a,hx[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(l,h),c.x=t=>~~((t+s)/o),c.y=t=>~~((t+n)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function ux(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function px(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=ux(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function gx(t,e,i){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return gx(t,e,s,o,h,c)}return!1}var u;if("moveY"===i.type){const n=(i.offset?d(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return gx(t,e,s,n,h,c)}if("moveX"===i.type){const n=(i.offset?d(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return gx(t,e,s,n,h,c)}return!1}const mx=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],vx=["top","inside-top","inside"];function yx(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const _x={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function bx(t,e){var i,n;return null!==(n=null===(i=_x[e])||void 0===i?void 0:i.call(_x,t))&&void 0!==n?n:{from:{},to:{}}}const xx=(t,e,i,n)=>{const s=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return W(null==n?void 0:n.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:s,to:r}};function Sx(t,e,i,n){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Na({text:t.attribute.text},{text:e.attribute.text},i,n))}const Ax={mode:"same-time",duration:300,easing:"linear"};function kx(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Tx(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function Cx(t){return 3===t||4===t}function Ex(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}const Mx=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}},Bx=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function Rx(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=t,a=Math.abs(r-s),o=e.x1;let l=o;return"end"===i?l=o+a/2+n:"start"===i&&(l=o-a/2-n),{x:l,y:e.y1}}function Ox(t,e,i,n,s,r){return Math.abs(e/t)0?s:-s),y:n+e*s/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:n+(e>0?r:-r)}}pb(),Mb(),Ab(),fb();class Ix extends Kf{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ix.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(Pb.hover,!0),Nb(this,(t=>{t===e||B(t.states)||t.addState(Pb.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(Nb(this,(t=>{B(t.states)||(t.removeState(Pb.hoverReverse),t.removeState(Pb.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void Nb(this,(t=>{B(t.states)||(t.removeState(Pb.selectedReverse),t.removeState(Pb.selected))}));B(e.states)||(e.addState(Pb.selected,!0),Nb(this,(t=>{t===e||B(t.states)||t.addState(Pb.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,n,s,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_n.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_n.ANIMATE_UPDATE&&(null===(n=t.detail.animationState)||void 0===n?void 0:n.isFirstFrameOfStep)){const e=null!==(r=null===(s=t.target)||void 0===s?void 0:s.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,n){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(xe(t,e,!0))return;const i=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-n)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=n+o,u=s+l,p=r+h,g=u-c,f=p-d;return[Ox(g,f,c,d,a,o),Ox(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const n=ld.line({points:i});if(null==n?void 0:n.customShape){const e=n.customShape;n.pathProxy=i=>e(t.attribute,i,new ds)}return e&&e.attribute.fill&&n.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(n)?n(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(s)?a=s(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return Qb(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,n,s;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let n=0;n!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),s),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let n=0;n"bound"===t.type));h&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&v.setRange(ux(m,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(ux(m,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(ux(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:n}=e;return{x1:i,x2:i,y1:n,y2:n}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==s?void 0:s.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),n.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:n}=bx(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(s=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,n,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=s.get(d);s.delete(d),n.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!_(i)){const{duration:n,easing:s,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,n,s),void(r&&Sx(t,e,n,s))}i.forEach(((i,n)=>{const{duration:s,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=xx(t,e,o,i.options);B(h)||t.animate().to(h,s,r),"text"in l&&"text"in h&&a&&Sx(t,e,s,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(bx(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=n}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==s?void 0:s.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)n.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=s.get(l);s.delete(l),n.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=n}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,f;const{detail:m}=o;if(!m)return{};const v=null===(p=m.animationState)||void 0===p?void 0:p.step;if(m.type!==_n.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(m.type===_n.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const y=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":m.animationState.end&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":s===e.length-1&&m.animationState.end&&(e.forEach((t=>{t.animate({onStart:y}).wait(d).to(a,h,c)})),n.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,yn.LOCAL,null===(f=this.stage)||void 0===f?void 0:f.pickerService)||(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,n,s,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(n=a.brightColor)&&void 0!==n?n:"#ffffff",f=null!==(s=a.darkColor)&&void 0!==s?s:"#000000",m=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Px.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class Lx extends Ix{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Lx.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),{x:c,y:d}=Oe(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*n+u*l/2,y:d+p*n+p*h/2}}}Lx.tag="rect-label",Lx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let Dx=class t extends Ix{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const n=t.attribute.points||[e],s="start"===i?0:n.length-1;return n[s]?{x1:n[s].x,x2:n[s].x,y1:n[s].y,y2:n[s].y}:void 0}labeling(t,e){return Rx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};Dx.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Fx{constructor(t,e,i,n,s,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class jx extends Ix{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},jx.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let s=1/0;if(!1!==n.ellipsis){const t=this._createLabelText(n),e=this.getGraphicBounds(t);s=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,s);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(n){const i={visible:n.labelVisible,x:n.labelPosition.x,y:n.labelPosition.y,angle:n.angle,maxLineWidth:n.labelLimit,points:n.pointA&&n.pointB&&n.pointC?[n.pointA,n.pointB,n.pointC]:void 0,line:n.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,n,s,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),n.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(n[i])&&!u(s[i])){const t=n[i]?n[i]:null,r=s[i]?s[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=Tx(l.endAngle-d/2),p=kx(h.x,h.y,l.outerRadius,o),g=kx(h.x,h.y,a+e.line.line1MinLength,o),f=new Fx(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=kx(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),f.middleAngle),f.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=f.quadrant)||2===c?this._arcRight.set(f.refDatum,f):Cx(f.quadrant)&&this._arcLeft.set(f.refDatum,f)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var n,s;const r=e,a=r.spaceWidth,o=null!==(n=r.position)&&void 0!==n?n:"inside",l=null!==(s=r.offsetRadius)&&void 0!==s?s:-a;return t.forEach((t=>{var i,n,s;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:u+l-y,t.labelPosition=kx(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=f,ot(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle;let a=null!==(s=r.offsetAngle)&&void 0!==s?s:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var n,s,r;const a=null!==(n=i[0].attribute.x)&&void 0!==n?n:0,o=2*(null!==(s=i[0].attribute.y)&&void 0!==s?s:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=Cx(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=Cx(n.quadrant)?{x:t.x+s.width/2+l+c,y:t.y}:{x:t.x-s.width/2-l-c,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const n=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-s),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const n of t)this._computePointB(n,h,e,i),this._computeX(n,e,i)}const d=2*a;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,l+c)||ot(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var n;const s=t.circleCenter,r=2*s.x;s.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(n=e.layout)||void 0===n?void 0:n.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;A(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const f=this.computeRadius(o,e.width,e.height),m=Cx(p)?-1:1;let v=0,y=(m>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(f+l+h)*m+s.x,y=(m>0?r-v:v)-d);const _=this._getFormatLabelText(t.refDatum,y);t.labelText=_;let b=Math.min(y,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=m>0?r-b-d:b+d;break;default:v=g.x+m*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-m*x}else{const t=0;u.x=v+t+m*(d+x)}}_computeAlign(t,e){var i,n,s,r,a,o;const l=e,h=null!==(n=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=l.textStyle)||void 0===s?void 0:s.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?Cx(t.quadrant)?"left":"right":Cx(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,n){var s;n[0].attribute.x;const r=2*(null!==(s=n[0].attribute.y)&&void 0!==s?s:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){const s=i;let r=0;n.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=s.line.line1MinLength;if("none"===s.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,s=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(s+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;A(c)?t.pointB={x:n.x+c*(Cx(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,s={width:2*n.x,height:2*n.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=s,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,u))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?at(v[0].y,v[1].y)?ot(t.middleAngle,-Math.PI)&<(t.middleAngle,0)||ot(t.middleAngle,Math.PI)&<(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-s;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;ee(t.attribute,i,new ds)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,n){return this.computeLayoutRadius(e||0,i||0)*t*(u(n)?1:n)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const n=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*n}}jx.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class Nx extends Ix{constructor(t){super(j({},Nx.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var n;if("area"!==t.type)return super.getGraphicBounds(t,e);const s=(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)||[e],r="start"===i?0:s.length-1;return{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}}labeling(t,e){return Rx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Nx.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class zx extends Ix{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},zx.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return Mx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}zx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const Vx={rect:Lx,symbol:Px,arc:jx,line:Dx,area:Nx,"line-data":zx};class Hx extends Kf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Hx.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:n=0,height:s=0,padding:r}=i||{};if(!n||!s||!A(s*n))return;this._componentMap||(this._componentMap=new Map);const a=dx(n,s,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}Hx.defaultAttributes={pickable:!1},pb(),fb(),_b(),Cb();class Gx extends Kf{getStartAngle(){return Kt(this._startAngle)}getEndAngle(){return Kt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Gx.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:s=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!s)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var s,r;const a=ld.line(Object.assign(Object.assign({points:t},_(i)?null!==(s=i[e])&&void 0!==s?s:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==n?void 0:n.line)||(a.states=_(n.line)?null!==(r=n.line[e])&&void 0!==r?r:n.line[n.line.length-1]:n.line),this.add(a),this.lines.push(a)}))}else{let t=ld.line;W(i)[0].cornerRadius&&(t=ld.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},W(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==n?void 0:n.line)||(e.states=[].concat(n.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:n=!0}=t;let s;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),s=ld.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:n?v+u:0,strokeBoundsBuffer:0}),p)),s.name=`${this.name}-${i}-symbol`,s.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(s.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(s.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(s.states=o.endSymbol),this.add(s)}return s}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const i=e.clip?e.size||10:0;n=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,s={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};n=[...n.slice(0,n.length-1),s]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],s=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[s.x-n.x,s.y-n.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}var Ux,Wx;Gx.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(Ux||(Ux={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Wx||(Wx={}));const Yx={[Wx.selectedReverse]:{},[Wx.selected]:{},[Wx.hover]:{},[Wx.hoverReverse]:{}},Kx={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},Xx=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=At;else if(t>0)for(;t>At;)t-=At;return t};function $x(t,e,i){return!lt(t,e,0,1e-6)&&!ot(t,i,0,1e-6)}function Zx(t,e,i,n){const s=dd(Object.assign({text:i},n)),r=s.width(),a=s.height(),o=Xx(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=$x(o,-l,-h)?((o+l)/c-.5)*r:$x(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let f=0;return f=$x(o,-l,-h)?.5*-a:$x(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-Xx(o-l)/c)*a,{x:p,y:g-f}}function qx(t){const e={};return Nb(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Jx(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Qx(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return Kb(r,(n?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}function tS(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}class iS extends Kf{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=((t,e,i)=>{const n=t.target;return n!==i&&n.name&&!B(n.states)?(n.addState(Pb.hover,!0),Nb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Pb.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(Nb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Pb.hoverReverse),t.removeState(Pb.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const n=t.target;return i===n&&n.hasState(Pb.selected)?(Nb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Pb.selectedReverse),t.removeState(Pb.selected))})),null):n.name&&!B(n.states)?(n.addState(Pb.selected,!0),Nb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Pb.selectedReverse,!0)})),n):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=P(this.attribute);j(this.attribute,t);const i=ld.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&qx(this._innerView),this.removeAllChild(!0),this._innerView=ld.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,items:r}=this.attribute,a=ld.group({x:0,y:0,zIndex:1});if(a.name=Ux.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),s&&s.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),n&&n.visible&&this.renderTicks(a),i&&i.visible)){const t=ld.group({x:0,y:0,pickable:!1});t.name=Ux.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,r.length),this.handleLabelsOverlap(s,e,n,i,r.length),this.afterLabelsOverlap(s,e,n,i,r.length);let a=0,o=0,l="center",h="middle";s.forEach((t=>{var e;const i=t.attribute,n=null!==(e=i.angle)&&void 0!==e?e:0,s=t.AABBBounds;let r=s.width(),c=s.height();n&&(r=Math.abs(r*Math.cos(n)),c=Math.abs(c*Math.sin(n))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ld.group({x:0,y:0,pickable:!1});i.name=Ux.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=ld.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=Ux.tick,r.id=this._getNodeId(t.id),B(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=Lb;else{const t=this.data[n],e=j({},Lb,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(n&&n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=ld.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=Ux.subTick,r.id=this._getNodeId(`${s}`),B(n.state))r.states=Lb;else{const i=j({},Lb,n.state);Object.keys(i).forEach((n=>{d(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&d(n)&&(e=n(e,i));const s=this._transformItems(e),r=ld.group({x:0,y:0,pickable:!1});return r.name=`${Ux.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=Qb(this._getLabelAttribute(t,e,s,i));if(a.name=Ux.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(n=this.attribute.label)||void 0===n?void 0:n.state))a.states=Lb;else{const n=j({},Lb,this.attribute.label.state);Object.keys(n).forEach((r=>{d(n[r])&&(n[r]=n[r](t,e,s,i))})),a.states=n}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new nx(Object.assign({},e));i.name=Ux.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Jx(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return at(t[0],0)?at(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;wt(n[0])>wt(n[1])?o=xt/2*(l.x>e.x?1:-1):h=xt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[n-1].height+R(this.attribute,"label.space",4))*n:u+=(this.axisLabelLayerSize[n-1].width+R(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,n):t.label;let{style:y}=this.attribute.label;y=d(y)?j({},Kx.label.style,y(t,e,i,n)):y;return y=j(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y)}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function nS(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}function sS(t,e){return xe(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=we(t,i),r=we(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=ke(t),l=ke(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Gt(t.angle);let f=i?t.angle+St:Gt(90-t.angle);const m=i?e.angle:Gt(e.angle);let v=i?e.angle+St:Gt(90-e.angle);f>kt&&(f-=kt),v>kt&&(v-=kt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Se(s,i)+Se(s,n))/2>Se(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,m,c,d)&&y((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const rS={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&aS(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function aS(t,e,i){const n=t.AABBBounds,s=e.AABBBounds;return i>Math.max(s.x1-n.x2,n.x1-s.x2,s.y1-n.y2,n.y1-s.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function oS(t,e){for(let i,n=1,s=t.length,r=t[0];n1&&e.height()>1}function hS(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},uS(t,e.attribute.angle)),{angle:dS(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},pS(t,e.attribute.angle)),{angle:dS(e.attribute.angle)}))}))}(t,e),nS(e)}function dS(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function uS(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=dS(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function pS(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=dS(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}class gS{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return Kb([n[1],-1*n[0]],t*(e?1:-1)*i)}}function fS(){pb(),fb(),Ab(),Mb()}var mS=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=y[1]>0;_=1===m?r?n?_:s?_/2:t:n?t:s?_/2:_:r?n?t:s?_/2:_:n?_:s?_/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===s?"start":"end"===s?"end":"center",u(C)&&o){C=Xb(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(k),T=this.getTextBaseline(k,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,n=Math.min(t||1/0,e||1/0);if(A(n))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=n-x;else if(C&&0!==C){const t=Math.abs(Math.sin(C));E=t<1e-6?1/0:this.attribute.end.y/t}else E=n-x}const M=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:E,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:j({},Yx,c.text),shape:j({},Yx,c.shape),panel:j({},Yx,c.background)}});return M.angle=C,l&&l.visible&&(M.shape=Object.assign({visible:!0},l.style),l.space&&(M.space=l.space)),h&&h.visible&&(M.panel=Object.assign({visible:!0},h.style)),M}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,s=(e?1:-1)*n;return at(t[1],0)?i=!at(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===s?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(["top","bottom","right","left"].includes(n)||0===t[0]&&0===t[1]){if("top"===n||"bottom"===n)return uS(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return pS(e?"left"===n?"right":"left":n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,h=t[0],c=Y(t),d=s?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,s=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=n.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-s}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,s){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,s),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:f,autoHide:m,autoHideMethod:v,autoHideSeparation:y,lastVisible:_}=a;if(d(h))h(t,e,n,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),cS(i,t),!hS(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:n,ellipsis:s="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,f="top"===r||"bottom"===r;if(f){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=n)return}const m=t.attribute.direction;if(!f){if("vertical"===m&&Math.floor(t.AABBBounds.height())<=n)return;if("vertical"!==m){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=n)return}}let v=null;if(p||g)v=f?p?n:i:"vertical"===m||g?n:i;else if(f){const{x1:e,x2:n}=t.AABBBounds,s=d/c;v=s>0&&e<=a&&i/s+e>a?(a-e)/Math.abs(c):s<0&&n>=0&&i/s+n<0?n/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);A(t.attribute.maxLineWidth)&&(v=A(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:s})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:f,orient:o,axisLength:i})}m&&function(t,e){if(B(t))return;const i=t.filter(lS);if(B(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),nS(n);const{method:s="parity",separation:r=0}=e,a=d(s)?s:rS[s]||rS.parity;if(n.length>=3&&oS(n,r)){do{n=a(n,r)}while(n.length>=3&&oS(n,r));if(n.length<3||e.lastVisible){const t=Y(i);if(!t.attribute.opacity){const e=n.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&aS(n[i],t,r);i--)n[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:y,lastVisible:_})}}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,s);let e,n;h=Math.max(h,t),"left"===a?(e=l.x2-h,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-h):"bottom"===a&&(e=l.x1,n=l.y1);const r=ld.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=Ux.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(n=h.style.lineWidth)&&void 0!==n?n:1:0,m=c&&c.visible?null!==(s=c.length)&&void 0!==s?s:4:0;if(l&&l.visible&&"string"==typeof l.text){p=Zb(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Ie(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}}vS.defaultAttributes=Kx,U(vS,gS);class yS{isInValidValue(t){const{startAngle:e=Rb,endAngle:i=Ob}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=Rb,endAngle:i=Ob,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Wt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qx(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var _S,bS=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(c=r,d=0),A(l)&&l>=3){const t=tS(s,l,c,e,i);h=ld.path(Object.assign(Object.assign({},a.style),{path:eS(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ld.circle(t)}h.name=Ux.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=j({},Yx,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:n,radius:s,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=bS(a,["space","textStyle","shape","background","state"]);let g=n,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=s+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=0===r?"end":"middle"),"start"===_?(y="bottom",g={x:n.x,y:n.y-v}):"end"===_&&(y="top",g={x:n.x,y:n.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:y,textAlign:"center"},l),state:{text:j({},Yx,d.text),shape:j({},Yx,d.shape),panel:j({},Yx,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,n){return Zx(t,e,i,n)}}xS.defaultAttributes=Kx,U(xS,yS);class SS extends ma{constructor(){super(...arguments),this.mode=xn.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},Nb(t,(t=>{var i,n,s,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!H(t.attribute,l.attribute)){const e=P(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:1,strokeOpacity:null!==(s=e.strokeOpacity)&&void 0!==s?s:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var n;const{node:s,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(n=this.params)&&void 0!==n?n:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===s.type?s.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=yt.lastIndex=_t.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=yt.exec(t))&&(n=_t.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=_t.lastIndex;return r{kS[t]=!0}));const MS=t=>-Math.log(-t),BS=t=>-Math.exp(-t),RS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,OS=t=>10===t?RS:t===Math.E?Math.exp:e=>Math.pow(t,e),IS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),PS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),LS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function DS(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function FS(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function jS(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function NS(t,e,i,n){return 1===i&&(i=0),jS(t,i,n)*(e/(1-i))}function zS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function VS(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};class US{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=zS(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,s=this.range(),r=s[0],a=s[s.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(n)?(l-o)*i:n;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const WS=Symbol("implicit");class YS extends US{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=_S.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=WS}clone(){const t=(new YS).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==WS)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const s=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(s):s}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class XS extends YS{constructor(t){super(),this.type=_S.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,s=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=NS(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,n=e+i;this._wholeRange=[e,n]}else{const e=t[1]+i*(1-this._rangeFactorEnd),n=e-i;this._wholeRange=[n,e]}const s=this._rangeFactorStart+n<=1,r=this._rangeFactorEnd-n>=0;"rangeFactorStart"===e&&s?this._rangeFactorEnd=this._rangeFactorStart+n:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?s?this._rangeFactorEnd=this._rangeFactorStart+n:r?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):r?this._rangeFactorStart=this._rangeFactorEnd-n:s?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:KS(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return KS(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new XS(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:$S}=he;function ZS(t,e){const i=typeof e;let n;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=ae.parseColorString(e)){const e=$S(ae.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof oe?$S(t,e):e instanceof ae?$S(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class qS extends US{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ES,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ES;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=ES,this._piecewise=FS,this._interpolate=ZS}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,J);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=vt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return this._autoClamp&&(this._clamp=ut(i[0],i[r-1])),this._piecewise=r>2?VS:FS,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:ES),this.rescale(i)):this._clamp!==ES}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const JS=Math.sqrt(50),QS=Math.sqrt(10),tA=Math.sqrt(2),eA=[1,2,5,10],iA=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=aA(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ns+t*n))):t>0?sA(0,-(e-1)/n,n):sA((e-1)/n,0,n)},nA=ht(((t,e,i,n)=>{let s,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return iA(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return iA(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=sA(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=sA(t,e,l);return s&&r.reverse(),r})),aA=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=eA[0];return i>=JS?n=eA[3]:i>=QS?n=eA[2]:i>=tA&&(n=eA[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function oA(t,e,i){const n=(e-t)/Math.max(0,i);return aA(n)}function lA(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=oA(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function cA(t,e){const i=S(e.forceMin),n=S(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const dA=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),uA=ht(((t,e,i,n,s,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=n-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),pA=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=rA(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?dA(t,e,s):dA(t,e,GS(s)),h=dA(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),gA=ht(((t,e,i,n,s)=>lA(n(t),n(e),i).map((t=>GS(s(t))))));class fA extends qS{constructor(){super(...arguments),this.type=_S.Linear}clone(){return(new fA).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return nA(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=rA(s[0],s[s.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return lA(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,s,r=-1;if(i=+i,(s=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=cA(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=hA(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=hA(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=hA(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function mA(t){return e=>-t(-e)}function vA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class yA extends qS{constructor(){super(IS(10),OS(10)),this.type=_S.Log,this._limit=vA(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new yA).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=IS(this._base),n=OS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=mA(i),this._pows=mA(n),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=MS,this.untransformer=BS):(this._logs=i,this._pows=n,this._limit=vA(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return ES}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),n=this._limit(i[0]),s=this._limit(i[i.length-1]);return uA(n,s,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return pA(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return gA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return gA(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=cA(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=HS(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class _A extends fA{constructor(){super(PS(1),LS(1)),this.type=_S.Symlog,this._const=1}clone(){return(new _A).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=PS(t),this.untransformer=LS(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),n=i[0],s=i[i.length-1];return uA(n,s,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return pA(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return gA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return gA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=cA(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=HS(n.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class bA{constructor(){this.type=_S.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[nt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new bA).domain(this._domain).range(this._range).unknown(this._unknown)}}const xA=t=>t.map(((t,e)=>({index:e,value:t}))),SA=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=new Ht(t).expand(i/2),s=new Ht(e).expand(i/2);return n.intersects(s)};function AA(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function kA(t,e){for(let i,n=1,s=t.length,r=t[0];nit?Math.min(t-e/2,i-e):i{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(n=s.angle)&&void 0!==n?n:0;"vertical"===s.direction&&(h+=Gt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=$b(s),f=t.range(),m=e.map(((i,n)=>{var r,l;const m=o?o(i):`${i}`,{width:v,height:y}=g.quickMeasure(m),_=Math.max(v,12),b=Math.max(y,12),x=t.scale(i),S=u*x,A=p*x;let k,w,T=S,C=A;a&&c&&0===n?T=wA(S,_,f[0],f[f.length-1]):a&&c&&n===e.length-1?T=wA(S,_,f[f.length-1],f[0]):k=null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===k?T-=_:"center"===k&&(T-=_/2),a&&d&&0===n?C=wA(A,b,f[0],f[f.length-1]):a&&d&&n===e.length-1?C=wA(A,b,f[f.length-1],f[0]):w=null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===w?C-=b:"middle"===w&&(C-=b/2);const E=(new Ht).set(T,C,T+_,C+b);return h&&E.rotate(h,S,A),E}));return m},CA=(t,e,i)=>{var n;const{labelStyle:s,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(n=s.angle)&&void 0!==n?n:0,d=$b(s),u=e.map((e=>{var i,n;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),f=Math.max(p,12),m=t.scale(e);let v=0,y=0;const _=null!==(i=s.textAlign)&&void 0!==i?i:"center",b=null!==(n=s.textBaseline)&&void 0!==n?n:"middle",{x:x,y:S}=function(t,e,i,n,s,r,a){const o=Wt({x:0,y:0},i,t),l=Jx(o,Qx(n,o,e,s));return Zx(l,Qx(n||1,l,e,s),r,a)}(m,{x:0,y:0},h,a,l,r,s);return v=x+("right"===_?-g:"center"===_?-g/2:0),y=S+("bottom"===b?-f:"middle"===b?-f/2:0),(new Ht).set(v,y,v+g,y+f).rotate(c,v+g/2,y+f/2)}));return u},EA={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&AA(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},MA=(t,e,i,n)=>TA(t,e,i).map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),BA=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},RA=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=n=>{let s=!0,r=0;do{r+n{let n=t,s=e;for(;n=0?s=t:n=t+1}return n})(s,t.length,(t=>c(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!n){o=u;break}{const n=t.length-1;let s,r=0;s=t.length%u>0?t.length-t.length%u+u:t.length;do{if(s-=u,s!==n&&!BA(e[s],e[n],i))break;r++}while(s>0);if(s===n){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?RA(e[s-u],e[s]):t,d=Math.abs(t-c);if(d{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&SA(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},PA=(t,e)=>{if(wS(t.type))return((t,e)=>{if(!wS(t.type))return xA(t.domain());const i=t.range(),n=Math.abs(i[i.length-1]-i[0]);if(n<2)return xA([t.domain()[0]]);const{tickCount:s,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(s)?s({axisLength:n,labelStyle:l}):s;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(s)?s({axisLength:n,labelStyle:l}):s;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=TA(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;s.length>=3&&kA(s,i);)s=EA.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),Y(r)!==Y(h)&&r.push(Y(h))),h=r}return xA(h)})(t,e);if(CS(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?xA([n[n.length-1]]):xA([n[0]]);let f;if(p(a))f=t.stepTicks(a);else if(p(r))f=t.forceTicks(r);else if(p(s)){const e=d(s)?s({axisLength:g,labelStyle:h}):s;f=t.ticks(e)}else if(e.sampling){const s=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=X(u),a=K(u);if(n.length<=g/s){const i=(a-r)/n.length,s=MA(t,n,e,c),l=Math.min(...s.map((t=>t[2]))),h=OA(n,s,o,e.labelLastVisible,Math.floor(l/i),!1);f=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(f=f.slice(0,f.length-h.delCount)),f.push(n[n.length-1]))}else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],s=MA(t,i,e,c);let l=null;s.forEach((t=>{l?l[2]0?Math.ceil(n.length*(o+l[2])/(a-r-o)):n.length-1;f=t.stepTicks(h),!e.labelLastVisible||f.length&&f[f.length-1]===n[n.length-1]||(f.length&&Math.abs(t.scale(f[f.length-1])-t.scale(n[n.length-1])){const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return xA(t.domain());let c;if(p(s))c=t.stepTicks(s);else if(p(n))c=t.forceTicks(n);else if(p(i)){const e=t.range(),n=Math.abs(e[e.length-1]-e[0]),s=d(i)?i({axisLength:n,labelStyle:l}):i;c=t.ticks(s)}else if(e.sampling){const i=t.domain(),n=t.range(),s=CA(t,i,e),r=X(n),l=K(n),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=IA(i,s,o,Math.floor(s.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return xA(c)})(t,e)}return xA(t.domain())};function LA(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Nt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function DA(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=eS(t,!!s),o=eS(r,!!s);const h=Nt.distancePP(n,l),c=Nt.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=LA(e,t,!1,!!s),o=LA(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=eS(t,!!s),o=eS(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class FA extends Kf{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&qx(this._innerView),this.removeAllChild(!0),this._innerView=ld.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Jx(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:n,items:s,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${Ux.grid}-sub`:`${Ux.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=eS(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=LA(t,o,!1,!!a)}const u=ld.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FA.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${s}`),e.add(u)})),l&&"line"===n&&s.forEach(((t,i)=>{const{id:n,points:s}=t,o=[];o.push(s[0]);const c=s[1].x-s[0].x,u=s[1].y-s[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:s[0].x+c*g,y:s[0].y+u*g});const f=eS(o,!!a),m=wt(o[0].x-o[1].x),v=wt(o[0].y-o[1].y),y=ld.path(Object.assign({path:f,z:0,alpha:m>v?(s[1].x-s[0].x>0?-1:1)*xt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FA.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${n}`),e.add(y)})),s.length>1&&o){const t=_(o)?o:[o,"transparent"],n=e=>t[e%t.length];for(let t=0;t=2&&(s=this.data[1].value-this.data[0].value);let r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(jA,gS);var NA=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s=2&&(p=this.data[1].value-this.data[0].value),t){e=j({},c,h);const t=[],{count:n=4}=h||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}function VA(){pb(),Cb(),Mb()}U(zA,yS);const HA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};VA();class GA extends Kf{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GA.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith($A.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,n,s;const r=t.target;if(r&&r.name&&r.name.startsWith($A.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===$A.focus||"focus"===o){const n=a.hasState(KA.focus);a.toggleState(KA.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[KA.unSelected,KA.unSelectedHover,KA.focus],t),this._setLegendItemState(e,KA.selected,t)})):(this._setLegendItemState(a,KA.selected,t),this._removeLegendItemState(a,[KA.unSelected,KA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[KA.selected,KA.selectedHover,KA.focus],t),this._setLegendItemState(e,KA.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(KA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(KA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(XA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[KA.selected,KA.selectedHover],t),this._setLegendItemState(a,KA.unSelected,t)):(this._setLegendItemState(a,KA.selected,t),this._removeLegendItemState(a,[KA.unSelected,KA.unSelectedHover],t))}else this._setLegendItemState(a,KA.selected,t),this._removeLegendItemState(a,[KA.unSelected,KA.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[KA.selected,KA.selectedHover],t),this._setLegendItemState(e,KA.unSelected,t))}))}this._dispatchLegendEvent(XA.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,KA.selected),this._removeLegendItemState(e,[KA.unSelected,KA.unSelectedHover])):(this._removeLegendItemState(e,[KA.selected,KA.selectedHover]),this._setLegendItemState(e,KA.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:n,maxHeight:s,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=UA,spaceRow:h=WA}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e;let v,{doWrap:y,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;_(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(n)&&(f&&o?(A=Math.ceil((x+g)/n),y=A>1):x+g>n&&(y=!0,x>0&&(A+=1,x=0,S+=m+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(s)&&(f&&o?(A=Math.ceil((S+m)/s),y=A>1):s<=m?(A+=1,y=!0,S=0,t>0&&(x+=k+l)):sthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,n){var s,r;const{label:a,value:o}=this.attribute.item,l=n.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:n.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(n.setAttribute("maxLineWidth",Math.max(e*(null!==(s=a.widthRatio)&&void 0!==s?s:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,n){var s,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,n),A=this._handleStyle(y,t,e,i,n),k=this._handleStyle(b,t,e,i,n),w=this._handleStyle(x,t,e,i,n),T=Ie(c);let C;!1===x.visible?(C=ld.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(C,$A.item,t,C)):(C=ld.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(C,$A.item,t,C,w.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?KA.selected:KA.unSelected);const E=ld.group({x:0,y:0,pickable:!1});C.add(E);let M,B=0,O=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);O=_(i)?i[0]||0:i,I=R(v,"space",8);const n=ld.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(n,$A.itemShape,t,C,S.state),n.addState(e?KA.selected:KA.unSelected),E.add(n)}let P=0;if(d){const e=R(g,"size",10);M=ld.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(M,$A.focus,t,C),P=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=Qb(Object.assign(Object.assign({x:O/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,$A.itemLabel,t,C,A.state),D.addState(e?KA.selected:KA.unSelected),E.add(D);const F=R(y,"space",8);if(p(l)){const n=R(b,"space",d?8:0),s=b.formatMethod?b.formatMethod(l,t,i):l,r=Qb(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:s,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,$A.itemValue,t,C,k.state),r.addState(e?KA.selected:KA.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-I-F-P-n;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-P-n}):r.setAttribute("x",n+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",n+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),E.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-I-P),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);M&&(M.setAttribute("x",B),E.add(M));const j=E.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;E.forEachChildren(((i,n)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===M?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const z=j.height(),V=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],H=this._itemHeightByUser||z+T[0]+T[2];return C.attribute.width=V,C.attribute.height=H,M&&M.setAttribute("visible",!1),E.translateTo(-j.x1+T[3],-j.y1+T[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:n,maxRow:s}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new GA(Object.assign(Object.assign({layout:1===s?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:n})):new GA(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:n,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new jb(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new jb(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,n,s){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+s-this._pagerComponent.AABBBounds.height()/2:i+s/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?n-this._pagerComponent.AABBBounds.width():(n-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:n,totalPage:s,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(n-1)/s,n/s]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:n=!0,animationDuration:s=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let n=e[0]*this._itemContext.totalPage;return i.scrollByPosition?n+=1:n=Math.floor(n)+1,n}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:n}=t.attribute;v<_+i&&(_=0,b+=n+l,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=o+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(v,y,t,f,m)}else{if(f=this._itemMaxWidth*n+(n-1)*o,m=i,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=i-g.AABBBounds.height()-c-t,y<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:_,y:b}),b+=l+i}));const e=Math.ceil(x/n);this._itemContext.totalPage=e,this._updatePositionOfPager(v,y,t,f,m)}d>1&&(p?h.setAttribute("y",-(d-1)*(m+l)):h.setAttribute("x",-(d-1)*(f+o)));const S=ld.group({x:0,y:t,width:p?v:f,height:p?m:y,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?m+l:f+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:n={},pager:s={}}=this.attribute,{spaceCol:r=UA,spaceRow:a=WA}=n,o=this._itemsContainer,{space:l=YA,defaultCurrent:h=1}=s,c=qA(s,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,f=0,m=0,v=1;if(d)p=e,g=e,f=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,f,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),f=i-t,g=this._itemMaxWidth,f<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((m+i)/f)+1,m+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,f,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(f+a)));const y=ld.group({x:0,y:t,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(KA.selected)?this._setLegendItemState(t,KA.selectedHover,e):this._setLegendItemState(t,KA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===$A.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(XA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(KA.unSelectedHover)||t.hasState(KA.selectedHover))&&(i=!0),t.removeState(KA.unSelectedHover),t.removeState(KA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(KA.unSelectedHover)&&!t.hasState(KA.selectedHover)||(i=!0),t.removeState(KA.unSelectedHover),t.removeState(KA.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===$A.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(XA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(XA.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==$A.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(XA.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==$A.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(XA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(KA.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=j({},JA,s)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(KA.selected),currentSelectedItems:n,currentSelected:s,event:i})}_handleStyle(t,e,i,n,s){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,n,s):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,n,s):r.state[a]=t.state[a])}))),r}};QA.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:UA,spaceRow:WA,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:YA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const tk=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return j(t,...i,{shape:s.every(u)?void 0:j({},...s),key:r.every(u)?void 0:j({},...r),value:a.every(u)?void 0:j({},...a)})},ek=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:W(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},ik={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:Ib,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:Ib,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:Ib,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ht).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},nk=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];pb(),xb(),Cb(),Mb(),Ab();let sk=class t extends Kf{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:n,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Ie(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:zb(u)&&zb(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:zb(u)&&zb(u.value)},ek(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:zb(u)&&zb(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:zb(u)&&zb(u.value)},ek(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},Db),u.value),visible:zb(u)&&zb(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=zb(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=s.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=zb(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),n&&n.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;n.forEach(((i,n)=>{const s=t.getContentAttr(this.attribute,n);if(!zb(s))return;const l=`tooltip-content-${n}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=s.shape.size+s.shape.spacing;let u="right"===c?(o?d:0)+(zb(s.key)?r+s.key.spacing:0)+(zb(s.value)?a:0):0;this._createShape("right"===c?u-s.shape.size/2:u+s.shape.size/2,s,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(s,h,l);g&&(tx(c,g,s.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+s.key.spacing:u+=r+s.key.spacing);const f=this._createValue(s,h,l);if(f){let t="right";p(s.value.textAlign)?t=s.value.textAlign:zb(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tx(c,f,t,u,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if(zb(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=ja(e.key.lineHeight,e.key.fontSize))&&void 0!==s?s:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var n;if(zb(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},ek(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.key.text)&&void 0!==n?n:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},ek(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},Db),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if(zb(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},ek(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.value.text)&&void 0!==n?n:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},ek(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),s}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>nk.includes(t)))?(this._mergeAttributes(e,n),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&zb(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=zb(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=$b(u),_=$b(p);let b=0;if(zb(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(zb(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&pc[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return tk({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return tk({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function rk(t,e){const i=ak(t),n=ak(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function ak(t,e={x:0,y:0}){return Nt.distancePP(t,e)}function ok(t,e,i){let n=!1;if(e&&d(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}sk.defaultAttributes=ik;const lk=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var ck,dk;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(ck||(ck={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dk||(dk={}));const uk="__VCHART",pk=500,gk=500,fk=`${uk}_LABEL_LIMIT`,mk=`${uk}_LABEL_ALIGN`,vk=`${uk}_LABEL_TEXT`,yk=`${uk}_LABEL_VISIBLE`,_k=`${uk}_LABEL_X`,bk=`${uk}_LABEL_Y`,xk=`${uk}_ARC_TRANSFORM_VALUE`,Sk=`${uk}_ARC_RATIO`,Ak=`${uk}_ARC_START_ANGLE`,kk=`${uk}_ARC_END_ANGLE`,wk=`${uk}_ARC_K`,Tk=`${uk}_ARC_MIDDLE_ANGLE`,Ck=`${uk}_ARC_QUADRANT`,Ek=`${uk}_ARC_RADIAN`,Mk=-Math.PI/2,Bk=3*Math.PI/2;var Rk,Ok,Ik,Pk,Lk,Dk,Fk,jk,Nk,zk,Vk,Hk,Gk,Uk,Wk;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(Rk||(Rk={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Ok||(Ok={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(Ik||(Ik={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(Pk||(Pk={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(Lk||(Lk={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Dk||(Dk={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Fk||(Fk={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(jk||(jk={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(Nk||(Nk={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zk||(zk={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(Vk||(Vk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(Hk||(Hk={})),t.VGRAMMAR_HOOK_EVENT=void 0,(Gk=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",Gk.AFTER_EVALUATE_DATA="afterEvaluateData",Gk.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",Gk.AFTER_EVALUATE_SCALE="afterEvaluateScale",Gk.BEFORE_PARSE_VIEW="beforeParseView",Gk.AFTER_PARSE_VIEW="afterParseView",Gk.BEFORE_TRANSFORM="beforeTransform",Gk.AFTER_TRANSFORM="afterTransform",Gk.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",Gk.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",Gk.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",Gk.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",Gk.BEFORE_STAGE_RESIZE="beforeStageResize",Gk.AFTER_STAGE_RESIZE="afterStageResize",Gk.BEFORE_VRENDER_DRAW="beforeVRenderDraw",Gk.AFTER_VRENDER_DRAW="afterVRenderDraw",Gk.BEFORE_MARK_JOIN="beforeMarkJoin",Gk.AFTER_MARK_JOIN="afterMarkJoin",Gk.BEFORE_MARK_UPDATE="beforeMarkUpdate",Gk.AFTER_MARK_UPDATE="afterMarkUpdate",Gk.BEFORE_MARK_STATE="beforeMarkState",Gk.AFTER_MARK_STATE="afterMarkState",Gk.BEFORE_MARK_ENCODE="beforeMarkEncode",Gk.AFTER_MARK_ENCODE="afterMarkEncode",Gk.BEFORE_DO_LAYOUT="beforeDoLayout",Gk.AFTER_DO_LAYOUT="afterDoLayout",Gk.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",Gk.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",Gk.BEFORE_DO_RENDER="beforeDoRender",Gk.AFTER_DO_RENDER="afterDoRender",Gk.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",Gk.AFTER_MARK_RENDER_END="afterMarkRenderEnd",Gk.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",Gk.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",Gk.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",Gk.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",Gk.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",Gk.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",Gk.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",Gk.BEFORE_ELEMENT_STATE="beforeElementState",Gk.AFTER_ELEMENT_STATE="afterElementState",Gk.BEFORE_ELEMENT_ENCODE="beforeElementEncode",Gk.AFTER_ELEMENT_ENCODE="afterElementEncode",Gk.ANIMATION_START="animationStart",Gk.ANIMATION_END="animationEnd",Gk.ELEMENT_ANIMATION_START="elementAnimationStart",Gk.ELEMENT_ANIMATION_END="elementAnimationEnd",Gk.ALL_ANIMATION_START="allAnimationStart",Gk.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(Uk||(Uk={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(Wk||(Wk={}));const Yk="__vgrammar_scene_item__",Kk=[Ik.line,Ik.area],Xk=[Ik.arc3d,Ik.rect3d,Ik.pyramid3d],$k="key",Zk=[{}],qk=["key"],Jk=!0,Qk=!0,tw=!1,ew=!0,iw="VGRAMMAR_IMMEDIATE_ANIMATION",nw=0,sw=1e3,rw=0,aw=0,ow=!1,lw=!1,hw="quintInOut",cw={stopWhenStateChange:!1,immediatelyApply:!0},dw="_mo_hide_";function uw(t,e){return W(t).reduce(((t,i)=>{const n=y(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function pw(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(y(i))return W(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return uw(t.dependency,e);var i;return[]}function gw(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function fw(t,e,i,n){if(u(t))return t;if(d(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function mw(t,e){return vw(t)?t.output():e[t]}const vw=t=>t&&!u(t.grammarType),yw=t=>d(t)?t:e=>e[t];function _w(t){return!!(null==t?void 0:t.scale)}function bw(t){return!!(null==t?void 0:t.field)}function xw(t,e){if(!t)return[];let i=[];return t.scale&&(i=vw(t.scale)?[t.scale]:W(e.getScaleById(t.scale))),i.concat(pw(t,e))}function Sw(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function Aw(t,e,i,n,s){i&&(gw(i)?e.forEach((e=>{const s=fw(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=s&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case Ik.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case Ik.group:case Ik.rect:case Ik.image:return["width","height","y1"].includes(e);case Ik.path:case Ik.shape:return["path","customPath"].includes(e);case Ik.line:return"defined"===e;case Ik.area:return["x1","y1","defined"].includes(e);case Ik.rule:return["x1","y1"].includes(e);case Ik.symbol:return"size"===e;case Ik.polygon:return"points"===e;case Ik.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(_w(l)){const t=mw(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=y(null==l?void 0:l.field),c=s?Hf(l.field):null;let d=s?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((n=>{var a;s&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(n.datum))),n.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(bw(l)){const t=Hf(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=fw(l,n,e.datum,t)}))})))}function kw(t,e,i,n){if(!t)return null;if(gw(t))return fw(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(_w(h)){const t=mw(h.scale,n),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=y(null==h?void 0:h.field),p=d?Hf(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);s[r]=S(g)||S(c)?g+i+c:g}else if(bw(h)){const t=Hf(h.field);s[r]=t(e)}else s[r]=fw(h,n,e,i)})),s}class ww{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return y(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=W(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let Tw=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,n){return t._marks[e]?new t._marks[e](i,e,n):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,n,s){const r=t._components[e];return r?new r(i,n,s):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,n){const s=t._graphicComponents[e];return s?s(i,n):null}static registerTransform(e,i,n){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!n})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,n){t._grammars[e]={grammarClass:i,specKey:null!=n?n:e}}static createGrammar(e,i,n){var s;const r=null===(s=t._grammars[e])||void 0===s?void 0:s.grammarClass;return r?new r(i,n):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,n){const s=t._interactions[e];return s?new s(i,n):null}static hasInteraction(e){return!!t._interactions[e]}};Tw._plotMarks={},Tw._marks={},Tw._components={},Tw._graphicComponents={},Tw._transforms={},Tw._grammars={},Tw._glyphs={},Tw._animations={},Tw._interactions={},Tw._graphics={},Tw.registerGlyph=(t,e,i,n,s)=>(Tw._glyphs[t]=new ww(e,i,n,s),Tw._glyphs[t]),Tw.registerAnimationType=(t,e)=>{Tw._animations[t]=e},Tw.getAnimationType=t=>Tw._animations[t],Tw.registerInteraction=(t,e)=>{Tw._interactions[t]=e},Tw.registerGraphic=(t,e)=>{Tw._graphics[t]=e},Tw.getGraphicType=t=>Tw._graphics[t],Tw.createGraphic=(t,e)=>{const i=Tw._graphics[t];return i?i(e):null};const Cw=t=>!!Ik[t];function Ew(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var n;const s=Tw.getGraphicType(e)?Tw.createGraphic(e,i):Tw.createGraphicComponent(e,i,{skipDefault:null===(n=null==t?void 0:t.spec)||void 0===n?void 0:n.skipTheme});return s||it.getInstance().error(`create ${e} graphic failed!`),s}const Mw=t=>{t&&(t[Yk]=null,t.release(),t.parent&&t.parent.removeChild(t))},Bw=["fillOpacity"],Rw=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):[]};const Ow={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[Ik.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a),l=m(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[Ik.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return A(e)&&A(i)&&A(n)&&A(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[Ik.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const Iw=(t,e,i,n)=>{const s={},r=e?Object.keys(e):[],a=y(t)?Ow[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){const a=s.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in n&&(a[t]=n[t])})),a;const o={};return e.forEach((t=>{o[t]=n[t]})),i[t]=o,o}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(Bw.includes(r)?Rw(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{Bw.includes(t)?Rw(s,t,e):s[t]=e[t]}));return s},Pw=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),Lw=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],Dw=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(Lw);function Fw(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?Dw:Lw,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>Pw(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=jw(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function jw(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((n=>{i.includes(n)||(e[n]=t[n])})),e}let Nw=class{constructor(t){this.data=null,this.states=[],this.diffState=Ok.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t]),this.runtimeStatesEncoder[t]):null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));Aw(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?Iw(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[Yk]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?Iw(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===Ok.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(Mw(this.graphicItem),this.graphicItem[Yk]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,n){var s;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:n},this),this.data=i;const r=yw(n);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:n},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=W(fw(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===Ok.unChange&&(this.diffState=Ok.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,dw in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[dw],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==Ok.enter&&this.diffState!==Ok.update||!this.states.length||this.useStates(this.states),this.mark.markType===Ik.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new ds))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[Rk.update],a=e[Rk.enter],o=e[Rk.exit],l=this.mark.isLargeMode()||s&&!this.mark.getSpec().enableSegments;this.diffState===Ok.enter?(a&&Aw(this,t,a,n,l),r&&Aw(this,t,r,n,l)):this.diffState===Ok.update?((s&&a||i)&&Aw(this,t,a,n,l),r&&Aw(this,t,r,n,l)):this.diffState===Ok.exit&&o&&(i&&Aw(this,t,a,n,l),Aw(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let n=!1,s=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!H(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?n=!0:e.push(r),this._updateRuntimeStates(r,o),s=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),s=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(s=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),n&&this.graphicItem.clearStates(),!!s&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&y(t)&&!H(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const n=this.mark.getSpec().encode,s=W(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==n?void 0:n[e])&&t.push(e),t)),this.states.slice());return s.length!==this.states.length&&(this.useStates(s),!0)}removeState(t){if(!this.graphicItem)return!1;const e=W(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var n;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const s=null===(n=this.mark.getSpec())||void 0===n?void 0:n.stateSort;s&&e.sort(s),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)Uf(n,i,t)&&I(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[Ik.line,Ik.area,Ik.largeRects,Ik.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||Sw(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),n=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[Rk.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=jw(h),e===Ik.line||e===Ik.area){const i=function(t,e,i,n){return t&&t.length&&(1!==t.length||e)?t.some((t=>Sw(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(s=null==i?void 0:i[e])&&void 0!==s?s:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,n&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,n,e===Ik.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const n=!!i&&i.mark.getSpec().enableSegments;let s,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(s||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===s&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),s=!0):s=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(n){const n=Fw(e.items,e.points,i);if(n)return void n.forEach((e=>{t.push(e)}))}const s=jw(e.items[0]);s.points=e.points,t.push(s)})),t}return n?Fw(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=kw(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=Fw(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const n="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],s={};return Object.keys(t).forEach((e=>{n.includes(e)||(s[e]=t[e])})),s}(h,this)}else h.points=i,h.segments=null}else e===Ik.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=null!==(s=l.x)&&void 0!==s?s:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,n):e===Ik.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=null!==(s=a.x)&&void 0!==s?s:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];n[2*e]=o,n[2*e+1]=l})),n}(t,!0,n))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),s=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{s[t]=this.getGraphicAttribute(t),r[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(s),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!I(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!I(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(Mw(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?_(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class zw{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),W(t).map((t=>y(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const Vw=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const n=t&&t.getSpec(),s=n&&n.encode;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class Hw extends zw{constructor(t,e){super(t,e),this.type=Hw.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},Hw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Vw(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:n,resetType:s}=(t=>{const e=W(t),i=[],n=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(n.push(t.replace("view:","")),i.push("view")):(n.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:n,resetType:i}})(t);return n.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=s,i}start(t){const{state:e,reverseState:i,isMultiple:n}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const n=this._statedElements&&this._statedElements.filter((e=>e!==t));n&&n.length?this._statedElements=this.updateStates(n,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(n&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}Hw.type="element-select",Hw.defaultOptions={state:Wk.selected,trigger:"click"};class Gw extends zw{constructor(t,e){super(t,e),this.type=Gw.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},Gw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Vw(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}Gw.type="element-highlight",Gw.defaultOptions={highlightState:Wk.highlight,blurState:Wk.blur,trigger:"pointerover",triggerOff:"pointerout"};class Uw{updateStates(t,e,i,n){return t&&t.length?(i&&n?e&&e.length?(this.toggleReverseStateOfElements(t,e,n),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,n):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((n=>{const s=i&&this._stateMarks[i]&&this._stateMarks[i].includes(n),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(n);(s||r)&&n.elements.forEach((n=>{t&&t.includes(n)?r&&n.addState(e):s&&n.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&i.elements.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const Ww=()=>{U(Hw,Uw),Tw.registerInteraction(Hw.type,Hw)},Yw=()=>{U(Gw,Uw),Tw.registerInteraction(Gw.type,Gw)},Kw=(t,e)=>vw(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,Xw=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=Kw(s,e),i}),{}):t.map((t=>Kw(t,e))):t;let $w=-1;class Zw extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++$w}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=W(this.spec.dependency).map((t=>y(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=W(t).map((t=>y(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return W(t).filter((t=>!u(t))).forEach((i=>{var n;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return W(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(pw(this.spec[e],this.view)),this.spec[e]=t,this.attach(pw(t,this.view)),this.commit(),this}}const qw=(t,e,i)=>{var n,s;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=pw(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},Jw=(t,e)=>{const i=Tw.getTransform(t.type);if(!i)return;const n={};let s=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(s=s.concat(uw(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(_(e)){const n=e.map((e=>qw(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return qw(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(s=s.concat(o.references)),n[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:n,references:s}},Qw=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=Jw(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null},tT={csv:hi,dsv:li,tsv:ci,json:function(t){if(!y(t))return W(t);try{return W(JSON.parse(t))}catch(t){return[]}}};class eT extends Zw{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!tT[e.type])return W(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return tT[e.type](t,i,new mi(new gi))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],n=t.format?pw(t.format,this.view)[0]:null;if(n&&e.push(n),t.values){const n=pw(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const s=pw(t.url,this.view)[0];s&&e.push(s),i.push({type:"load",transform:this.load,options:{url:null!=s?s:t.url,format:null!=n?n:t.format}})}else if(t.source){const n=[];W(t.source).forEach((t=>{const i=vw(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const n=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const s=this.evaluateTransform(n,this._input,i),r=this._evaluateFilter(s,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Object.assign({},this.spec,{values:t,format:e});return u(t)||(n.url=void 0,n.source=void 0),i?this.parseLoad(n):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Object.assign({},this.spec,{url:t,format:e});return u(t)||(n.values=void 0,n.source=void 0),i?this.parseLoad(n):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Object.assign({},this.spec,{source:t,format:e});return u(t)||(n.values=void 0,n.url=void 0),i?this.parseLoad(n):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=W(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=Qw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=Qw(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(W(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=W(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const iT="window",nT="view",sT={trap:!1},rT="width",aT="height",oT="viewWidth",lT="viewHeight",hT="padding",cT="viewBox",dT="autoFit";function uT(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],a&&s&&n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function pT(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,uT(t,e,s,n)}class gT{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return uT(this.nodes,e,0,this.compare),pT(this.nodes,e,null,this.compare)}return this.nodes.push(t),uT(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),uT(this.nodes,e,0,this.compare),pT(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,pT(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class fT{constructor(t){this.list=[],this.ids={},this.idFunc=t||Gf}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class mT{constructor(){this.grammars=[],this.logger=it.getInstance(),this._curRank=0,this._committed=new fT((t=>t.uid)),this._heap=new gT(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new fT((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const vT=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===Ik.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class yT{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Xo(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ds.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,n,s,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new Fg(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(n=a.layer)&&void 0!==n?n:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&(this._dragController=new ym(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new xm(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function _T(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function bT(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return A(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),A(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&A(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&A(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function xT(t,e,i,n,s){if(s===iT){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{bT(t,_T(t),!1)}))}));const e=_T(t);bT(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class ST extends Zw{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?fw(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(_(t)&&_(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,n,s;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},TT=(t,e)=>e&&e.debounce?gt(t,e.debounce):e&&e.throttle?ft(t,e.throttle):t;class CT extends Nw{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t]),this.runtimeStatesEncoder[t]):null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return Aw(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[Yk]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?Iw(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const n=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===Ok.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==Ok.enter&&this.diffState!==Ok.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!u(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=Iw(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=Ow[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===Ik.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){const n=e.map((t=>Object.assign({},t,{nextAttrs:i})));return Kk.includes(t)&&this.mark.getSpec().enableSegments&&n.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),n}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&I(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),I(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),I(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)Uf(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var n,s;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(n=this.getPrevGraphicAttributes(e))&&void 0!==n?n:{},o=null!==(s=this.getFinalGraphicAttributes(e))&&void 0!==s?s:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[Yk]=null})),this.glyphGraphicItems=null),super.release()}}const ET=t=>t.markType===Ik.glyph?new CT(t):new Nw(t);function MT(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set($k,i?t.slice().sort(i):t.slice()),{keys:qk,data:n};const s=yw(e);if(1===t.length){const e=s(t[0]);return n.set(e,[t[0]]),{keys:[e],data:n}}const r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class BT{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?MT(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const RT=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,n=Object.keys(i);n.forEach((t=>{u(i[t])&&delete i[t]}));const s=Sw(n,e.mark.markType)&&!p(i.segments);if(s){const n=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(n,e.mark.markType,s)}}if(t.to){const i=t.to,n=Object.keys(i);n.forEach((t=>{u(i[t])&&delete i[t]}));const s=Sw(n,e.mark.markType)&&!p(i.segments);if(s){const n=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(n,e.mark.markType,s)}}return t};const OT=(t,e,i,n,s)=>d(i)?i(t.getDatum(),t,s):i;class IT extends ma{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class PT extends ma{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Do,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const n=Object.assign({},this.from),s=Object.assign({},this.to),r=[];Object.keys(s).forEach((t=>{i.includes(t)?(n[t]=s[t],this.from[t]=s[t]):u(n[t])?n[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=n,this._toAttribute=s}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:_n.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:_n.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const n=this.step.getLastProps();Object.keys(n).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=n[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}ya.mode|=xn.SET_ATTR_IMMEDIATELY;let LT=0;const DT=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof ma||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class FT{constructor(t,e,i){this.id=LT++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const n=i.animate();this.runnings.push(n),n.startAt(this.unit.initialDelay),n.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(n,i,t,e)})),n.wait(this.unit.loopDelayAfter),n.loop(this.unit.loopCount-1),A(this.unit.totalTime)&&setTimeout((()=>{n&&n.stop("end")}),this.unit.totalTime),n.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==n)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(s>0&&t.wait(s),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var s;const r=null!==(s=t.type?function(t,e,i,n){const s=d(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!Tw.getAnimationType(e.type))return null;const r=Tw.getAnimationType(e.type)(t,s,i);return RT(r,t)}(this.element,t,i,n):t.channel?function(t,e,i,n){const s=e.channel;let r=null;return _(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!u(null===(r=s[i])||void 0===r?void 0:r.from),l=!u(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?OT(t,0,s[i].from,0,n):void 0,e.to[i]=l?OT(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),RT(r,t)}(this.element,t,0,n):void 0)&&void 0!==s?s:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=DT(o);return u(o)||DT(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new PT(r.from,r.to,a,t.easing):void 0:new IT(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new Ga(a,e))}r>0&&t.wait(r)}}function jT(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(NT(i,t[i]))})),e}function NT(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return W(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:nw,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:lw,loop:null!==(n=h.loop)&&void 0!==n?n:ow,controlOptions:j({},cw,null!==(s=h.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sw,delay:null!==(a=h.delay)&&void 0!==a?a:rw,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:aw,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:hw,customParameters:h.customParameters,options:h.options}]}]}}const g=W(t.timeSlices).filter((t=>t.effects&&W(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:nw,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:lw,loop:null!==(d=t.loop)&&void 0!==d?d:ow,controlOptions:j({},cw,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:rw,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:aw,effects:W(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:hw,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function zT(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class VT{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class HT{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=jT(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=jT(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==Ok.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new VT(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=NT(iw,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new VT(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=W(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=W(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=W(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var s;const r=[],a=e.filter((e=>{const s=!(e.isReserved&&e.diffState===Ok.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(s=this.mark.group)&&void 0!==s?s:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((n,s)=>{e.elementIndex=s;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,n,s,a.length,o);r.push(this.animateElement(t,l,n,e,o))}))}return r}animateElement(e,i,n,s,r){var a,o;const l=new FT(n,i,e);if(l.animate(s,r),!l.isAnimating)return;n.diffState===Ok.exit&&(n.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(n))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(n,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,n),l}getAnimationState(t){const e=fw(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=zT(t.startTime,e,s),o=zT(t.totalTime,e,s),l=zT(t.oneByOne,e,s),h=zT(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=zT(t.delay,e,s),l=zT(t.delayAfter,e,s),h=null!==(i=zT(t.duration,e,s))&&void 0!==i?i:o/n,d=W(t.effects).map((t=>Object.assign({},t,{customParameters:zT(t.customParameters,e,s)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===Ok.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===Ok.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=e.element,s=e.animationOptions,r=s.state,a=r===iw,o=this.elementRecorder.get(n).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[s.id]-=1;const l=0===this.timelineCount[s.id],h=a?this.immediateConfigs.find((t=>t.id===s.id)).originConfig:this.configs.find((t=>t.id===s.id)).originConfig;l&&(delete this.timelineCount[s.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==s.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===Ok.exit&&0===o[Ok.exit]&&this.clearElement(n));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,n)}}class GT extends Zw{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new HT(this,{}),this.differ=new BT([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=y(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=y(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===Ok.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var n;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===Hk.before)return this;const s=null===(n=this.view.renderer)||void 0===n?void 0:n.stage();this.init(s,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:Zk,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===Ik.group)return;const e=MT(null!=t?t:Zk,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(y(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return y(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(Ok.update,t,e,i)}encodeState(t,e,i,n){if(t===Ok.enter&&(this._isReentered=!0),this.spec.encode[t]){const s=this.spec.encode[t];if(gw(s))this.detach(xw(s,this.view));else{const r=y(e);r&&n||!r&&i?(Object.keys(s).forEach((t=>{this.detach(xw(s[t],this.view))})),this.spec.encode[t]={}):r?this.detach(xw(s[e],this.view)):Object.keys(e).forEach((t=>{this.detach(xw(s[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),y(e)?(this.spec.encode[t][e]=i,this.attach(xw(i,this.view))):gw(e)?(this.spec.encode[t]=e,this.attach(xw(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(xw(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=Qw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=Qw(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return Kk.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==Ok.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===Uk.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!gw(s)&&Object.keys(s).forEach((t=>{_w(s[t])&&(e[t]=mw(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];gw(n)||Object.keys(n).forEach((t=>{bw(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[Yk];if((null==n?void 0:n.mark)===this){const i=xT(this.view,t,n,0,nT);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new HT(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=mw(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==Ik.group){if(!this.graphicItem){const t=Ew(this,Ik.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||Xk.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==Ik.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=_(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=yw(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>$k),a=yw(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>$k),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===Ok.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(u(e))s=this.elementMap.get(n),s&&(s.diffState=Ok.exit);else if(u(i)){s=this.elementMap.has(n)?this.elementMap.get(n):ET(this),s.diffState===Ok.exit&&(s.diffState=Ok.enter,this.animate.getElementAnimators(s,Ok.exit).forEach((t=>t.stop("start")))),s.diffState=Ok.enter;const i=l?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),c.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=Ok.update;const i=l?t:a(e[0]);s.updateData(i,e,r,this.view),c.push(s)}h.delete(s)}));const d=null!=t?t:Zk;l||this.differ.setCurrentData(MT(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const n={};return this._groupKeys.forEach((s=>{const r=t.find((t=>t.groupKey===s));r&&(n[s]=kw(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=n,n}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,n,s){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:n},this);const a=s?null:this.evaluateGroupEncode(e,i[Rk.group],n);e.forEach((t=>{this.markType===Ik.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,n),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,n),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:n},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:Ew(this,this.markType,t);if(s){if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return s}}parseRenderContext(t,e){const i=this.markType!==Ik.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=yw(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>$k),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=ET(this);e.diffState=Ok.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=ET(this);i.diffState=Ok.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const n=this.renderContext.progressive.currentIndex;if(0===n){if(this.evaluateEncode(t,e,i),0===n&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==Ik.glyph){const e=t[0],i=e.getGraphicItem(),n=null==i?void 0:i.parent;n&&this._groupEncodeResult[e.groupKey]&&n.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,n;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const s=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=Ew(this,Ik.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,s),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),s);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(n=this._getTransformsAfterEncode())||void 0===n?void 0:n.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==Ok.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:Ow[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=Ok.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&Mw(this.graphicItem),this.detachAll(),super.release()}}let UT=class extends GT{constructor(t,e){super(t,Ik.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===Ik.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return Ow.rect}evaluateJoin(t){if(!this.elements.length){const t=ET(this);t.updateData($k,Zk,(()=>""),this.view),this.elements=[t],this.elementMap.set($k,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const n=d(e.clipPath)?e.clipPath([t]):e.clipPath;n&&n.length?i.path=n:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var n;const s=this.elements[0],r={};return Aw(s,[Object.assign({},null===(n=s.items)||void 0===n?void 0:n[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,n,s){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:n},this);const a=s?null:this.evaluateGroupEncode(e,i[Rk.group],n);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,n)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,n),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:n},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,n){const s=null!=n?n:Ew(this,this.markType,e);if(s)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};function WT(t,e){if(A(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return A(t)?t*e:0}return 0}function YT(t,e){return Math.min(t<0?t+e:t-1,e)}function KT(t,e,i){let n=YT(t,i),s=YT(e,i);if(A(t)||A(e)?A(t)?A(e)||(n=YT(Math.max(0,s-1),i)):s=YT(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const XT=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>WT(t,i))),u=l.map((t=>WT(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let v=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=v;return v+=i+c,n}));return y.push(v),{rows:m,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=KT(e,i,r),{start:h,end:c}=KT(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},$T={[Pk.axis]:0,[Pk.legend]:1,[Pk.slider]:2,[Pk.player]:3,[Pk.datazoom]:4},ZT=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=$T[t.componentType])&&void 0!==n?n:1/0},qT=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Wf(r.maxChildWidth,s.width()),o=Wf(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=wT(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dZT(t)-ZT(e)));for(let t=0,e=m.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==Ik.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(d(r))r.call(null,t,s,a,e);else if(d(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=qT(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(oT,o),i.updateSignal(lT,l),i.updateSignal(hT,h)}else qT(t,s,a,e);else"grid"===r.display&&XT(t,s,a);JT(s,e,i)}}))};class QT extends GT{constructor(t,e,i){super(t,Ik.glyph,i),this.glyphType=e,this.glyphMeta=Tw.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Tw.getGraphicType(Ik.glyph))return;const n=Tw.createGraphic(Ik.glyph,i),s=e.getMarks(),r=Object.keys(s).map((t=>{if(Tw.getGraphicType(s[t])){const e=Tw.createGraphic(s[t]);if(e)return e.name=t,e}}));return n.setSubGraphic(r),n}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const tC=Symbol.for("key");class eC{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new BT(t,i);return s.setCallback(((t,e,i)=>{u(e)?n.exit.push({prev:i[0]}):u(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(MT(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==Ik.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==Ik.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=MT(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=MT(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=yw(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new BT(t,i);return s.setCallback(((t,e,i)=>{u(e)?n.exit.push({prev:i}):u(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(MT(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:tC})),r=MT(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:tC}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==tC){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=fw(i.animation.delay,s,o,l),d=fw(i.animation.duration,s,o,l),u=fw(i.animation.oneByOne,s,o,l),p=fw(i.animation.splitPath,s,o,l),g=A(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?wo:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:To)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);xo(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?wo:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:To)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>vo(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>_o(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_n.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new bo({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:Aa,null!==(l=i.easing)&&void 0!==l?l:ka))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_n.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new So({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:Aa,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:ka))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):xo(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class iC{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=y(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),u(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),u(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class nC extends iC{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===Ik.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===Ik.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===Ik.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===Ik.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class sC{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;e.animate&&(null===(n=(i=e.animate).enableAnimationState)||void 0===n||n.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;e.animate&&(null===(n=(i=e.animate).disableAnimationState)||void 0===n||n.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class rC extends GT{addGraphicItem(t,e){const i=t&&t.limitAttrs,n=Ew(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?Ik.richtext:Ik.text,t);return super.addGraphicItem(t,e,n)}release(){super.release()}}rC.markType=Ik.text;const aC={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},oC={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},lC=Object.assign({},aC);lC.axis=Object.assign({},lC.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),lC.circleAxis=Object.assign({},lC.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),lC.grid=Object.assign({},lC.grid,{style:{stroke:"#404349"}}),lC.circleGrid=Object.assign({},lC.circleGrid,{style:{stroke:"#404349"}}),lC.rectLabel=Object.assign({},lC.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),lC.lineLabel=Object.assign({},lC.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),lC.symbolLabel=Object.assign({},lC.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),lC.title=Object.assign({},lC.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const hC={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:oC,components:lC},cC={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:oC,components:aC};let dC=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};dC._themes=new Map,dC.registerTheme("default",cC),dC.registerTheme("dark",hC);class uC extends GT{constructor(t,e,i,n){super(t,Ik.component,i),this._componentDatum={[$k]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=n,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,n){const s=null!=n?n:Tw.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,$k)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[$k]+=1}evaluateJoin(t){return this.spec.key=$k,t?(t[$k]=this._componentDatum[$k],this._componentDatum=t):this._componentDatum={[$k]:this._componentDatum[$k]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class pC extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[Yk],s=xT(0,t,n,0,nT);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=W(t),i=[];return e.forEach((t=>{if(vw(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):Cw(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){y(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ST(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new eT(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=Tw.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=Tw.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const n=y(e)?this.getMarkById(e):e;let s;switch(t){case Ik.group:s=new UT(this,n);break;case Ik.glyph:s=new QT(this,null==i?void 0:i.glyphType,n);break;case Ik.component:s=Tw.hasComponent(null==i?void 0:i.componentType)?Tw.createComponent(null==i?void 0:i.componentType,this,n,null==i?void 0:i.mode):new uC(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case Ik.text:s=new rC(this,t,n);break;default:s=Tw.hasMark(t)?Tw.createMark(t,this,n):new GT(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(Ik.group,t)}glyph(t,e){return this.mark(Ik.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(Ik.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Ik.component,t,{componentType:Pk.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Ik.component,t,{componentType:Pk.grid,mode:e})}legend(t){return this.mark(Ik.component,t,{componentType:Pk.legend})}slider(t){return this.mark(Ik.component,t,{componentType:Pk.slider})}label(t){return this.mark(Ik.component,t,{componentType:Pk.label})}datazoom(t){return this.mark(Ik.component,t,{componentType:Pk.datazoom})}player(t){return this.mark(Ik.component,t,{componentType:Pk.player})}title(t){return this.mark(Ik.component,t,{componentType:Pk.title})}scrollbar(t){return this.mark(Ik.component,t,{componentType:Pk.scrollbar})}customized(t,e){const i=Tw.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=y(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&kT.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(Mw(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,n,s,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++AT;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(dC.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(n=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==n?n:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(rT,t.width),this.updateSignal(aT,t.height))}(null===(s=e.signals)||void 0===s?void 0:s.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=Tw.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=Hk.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var n,s,r,a,o;return[{id:rT,value:null!==(n=t[rT])&&void 0!==n?n:0},{id:aT,value:null!==(s=t[aT])&&void 0!==s?s:0},{id:hT,value:wT(null!==(a=null!==(r=t[hT])&&void 0!==r?r:e[hT])&&void 0!==a?a:null==i?void 0:i.padding)},{id:oT,update:{callback:(t,e)=>{const i=wT(e[hT]);return e[rT]-i.left-i.right},dependency:[rT,hT]}},{id:lT,update:{callback:(t,e)=>{const i=wT(e[hT]);return e[aT]-i.top-i.bottom},dependency:[aT,hT]}},{id:cT,update:{callback:(t,e)=>{const i=wT(e[hT]);return(t||new Vt).setValue(i.left,i.top,i.left+e[oT],i.top+e[lT])},dependency:[oT,lT,hT]}},{id:dT,value:null!==(o=t[dT])&&void 0!==o?o:e[dT]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===Ik.glyph?{glyphType:t.glyphType}:t.type===Ik.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,n,s,r,a;y(t)?this._theme=null!==(e=dC.getTheme(t))&&void 0!==e?e:dC.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(n=null!=o?o:this._options.background)&&void 0!==n?n:this._theme.background),this.padding(null!==(s=null!=l?l:this._options.padding)&&void 0!==s?s:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(rT);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(aT);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(oT);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(lT);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(hT);if(arguments.length){const i=wT(t);return this.updateSignal(e,i),i}return wT(e.output())}autoFit(t){const e=this.getSignalById(dT);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(cT);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=Hk.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===Ik.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||JT;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{vT(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),vT(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const n=(t=>{var e,i,n,s,r;const{reuse:a=Jk,morph:o=Qk,morphAll:l=tw,animation:h={},enableExitAnimation:c=ew}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:hw,delay:null!==(i=h.delay)&&void 0!==i?i:rw,duration:null!==(n=h.duration)&&void 0!==n?n:sw,oneByOne:null!==(s=h.oneByOne)&&void 0!==s?s:lw,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),s=this._cachedGrammars.size()>0;s&&(this.reuseCachedGrammars(n),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=Hk.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Hk.reevaluate,this._dataflow.evaluate()),this._layoutState=Hk.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!kT.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return vT(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=Pe(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;return t!==this.width()&&(n=!0,this.updateSignal(rT,t)),e!==this.height()&&(n=!0,this.updateSignal(aT,e)),n&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nT;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):Cw(t)?(i.markType=t,i.source=e):i.source=t===iT?iT:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((_=h).markId)?t=>t&&t.mark.id()===_.markId:u(_.markName)?t=>t&&t.mark.name()===_.markName:u(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,f=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:y(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=uw(l,this),v=TT(((t,e)=>{const n=c===nT&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===iT&&(t=xT(0,t,e,0,iT));let s=!1;if((!i||i(t))&&(!p||p(e))&&f.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});f.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.run()}),{throttle:s,debounce:r});var _;if(c===nT){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||g(n)&&!n[i])}(this._eventConfig,nT,d))return this.addEventListener(d,v,sT),()=>{this.removeEventListener(d,v)}}else if(c===iT)return fg.addEventListener(d,v),this._eventListeners.push({type:d,source:fg,handler:v}),()=>{fg.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===fg&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);y(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=Tw.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var n;return u(e)?y(t)?i.type===t:t?i===t:void 0:(null===(n=i.options)||void 0===n?void 0:n.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new yT(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new iC((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new nC((t=>t.id())),this._options.logger&&it.setInstance(this._options.logger),this.logger=it.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new mT,this.animate=new sC(this),this._morph=new eC,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[nT,iT]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:dC.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&fg.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=Hk.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==Ik.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=fg.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&fg.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),Tw.unregisterRuntimeTransforms(),it.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}class gC extends uC{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=y(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const fC=(t,e,i,n,s,r)=>{var a;const o=t.getCoordinateAxisPosition();s&&"auto"===s.position&&(s.position=i?"content":o);const l=t.getCoordinateAxisPoints(n);if(l){const n={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();n.center=e.origin(),n.startAngle=t[0],n.endAngle=t[1]}return n}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class mC extends gC{constructor(t,e,i){super(t,Pk.axis,e),this.spec.componentType=Pk.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=Tw.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,n)}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=kw(s,e,i,n);const h=fw(this.spec.inside,n,e,i),c=fw(this.spec.baseValue,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(fC(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=fw(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case Dk.lineAxis:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.axis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p);case Dk.circleAxis:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.circleAxis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?Dk.circleAxis:Dk.lineAxis,this._axisComponentType}}mC.componentType=Pk.axis;let vC=class extends uC{constructor(t,e){super(t,Pk.label,e),this.spec.componentType=Pk.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=W(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=W(t).map((t=>y(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r,a,o;const l=W(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t)),h=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let c=fw(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},s),{labelIndex:e}),u=null!==(a=fw(n,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case Ik.line:case Ik.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case Ik.rect:case Ik.rect3d:case Ik.interval:g=p.rectLabel;break;case Ik.symbol:case Ik.circle:case Ik.cell:g=p.symbolLabel;break;case Ik.arc:case Ik.arc3d:g=p.arcLabel;break;case Ik.polygon:case Ik.path:default:g=p.pointLabel}const f=null!==(o=u.data)&&void 0!==o?o:[],m=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};f&&f.length>0?f.forEach(((e,n)=>{if(t.elements[n]){const s=kw(i,e,t.elements[n],d);j(e,m,s)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const n=kw(i,t,e,d);f.push(j({},m,n))}));else{const t=kw(i,e.getDatum(),e,d),n=j({},m,t);f.push(n)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return j({},g,{data:f,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return j({},o,{size:e,dataLabels:l})}(l,c,n,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};vC.componentType=Pk.label;class yC extends gC{constructor(t,e,i){super(t,Pk.grid,e),this.spec.componentType=Pk.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=y(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=y(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=Tw.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,n)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=kw(n,t,e,i);const d=fw(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(s=this._targetAxis.getSpec())||void 0===s?void 0:s.scale;h=y(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case Fk.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case Fk.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const n=fw(this.spec.inside,i,t,e),s=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);s&&(c=Object.assign(fC(h,s,n,d,this.spec.layout,!0),c))}this._getGridComponentType()===Fk.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=fw(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case Fk.lineAxisGrid:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.grid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p);case Fk.circleAxisGrid:return((t,e,i,n)=>{var s,r,a,o;const l=null!==(r=null===(s=null==e?void 0:e.components)||void 0===s?void 0:s.circleGrid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,n))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=Fk.circleAxisGrid:this._gridComponentType=Fk.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case Dk.circleAxis:this._gridComponentType=Fk.circleAxisGrid;break;case Dk.lineAxis:default:this._gridComponentType=Fk.lineAxisGrid}else if(this.spec.scale){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?Fk.lineAxisGrid:Fk.circleAxisGrid:Fk.lineAxisGrid}else this._gridComponentType=Fk.lineAxisGrid;return this._gridComponentType}}yC.componentType=Pk.grid;const _C=(t,e,i)=>e.filter((e=>t.callback(e,i))),bC=(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!u(s)){if(u(t))return;t[s]=e}return e})),e;const r=n(e,i);return u(s)||u(e)?r:(e[s]=r,e)};function xC(t){return t.reduce(((t,e)=>t+e),0)}const SC={min:X,max:K,average:function(t){return 0===t.length?0:xC(t)/t.length},sum:xC};function AC(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function kC(t,e,i,n,s){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function wC(t,e,i,n){return kC(t,e,i,"min",n)}function TC(t,e,i,n){return kC(t,e,i,"max",n)}function CC(t,e,i,n){return kC(t,e,i,"average",n)}function EC(t,e,i,n){return kC(t,e,i,"sum",n)}const MC=(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:s,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=AC;if("min"===s?l=wC:"max"===s?l=TC:"average"===s?l=CC:"sum"===s&&(l=EC),e.length){const t={};if(a){for(let i=0,n=e.length;i{const r=t[s];if(r.length<=i){const t=r.map((t=>t.i));n=n.concat(t)}else{const t=l(i,r,!0,o);n=n.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const BC=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(dw)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(dw,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(dw,!0),t.setGraphicAttribute("visible",!1)):s=c,r=e}))}}(a,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},RC=()=>{Tw.registerTransform("filter",{transform:_C,markPhase:"beforeJoin"},!0)},OC=()=>{Tw.registerTransform("map",{transform:bC,markPhase:"beforeJoin"},!0)},IC=()=>{Tw.registerTransform("sampling",{transform:MC,markPhase:"afterEncode"},!0)},PC=()=>{Tw.registerTransform("markoverlap",{transform:BC,markPhase:"afterEncode"},!0)},LC=(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},DC=(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},FC=(t,e,i)=>{var n,s,r,a;const o=null!==(n=t.getFinalAnimationAttributes())&&void 0!==n?n:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(s=o.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},jC=(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},NC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("width");return{from:p(n)?{x:e+n/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:n}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),n=t.getFinalAnimationAttribute("height");return{from:p(n)?{y:e+n/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:n}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("width"),s=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(n)?(o.x=e+n/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=s+a/2,o.height=0,o.y1=void 0):(o.y=(s+r)/2,o.y1=(s+r)/2,o.height=void 0),{from:o,to:{x:e,y:s,x1:i,y1:r,width:n,height:a}}}}},zC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("width");return{to:p(n)?{x:e+n/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),n=t.getFinalAnimationAttribute("height");return{to:p(n)?{y:e+n/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+n)/2,o.x1=(e+n)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+s)/2,o.y1=(i+s)/2,o.height=void 0),{to:o}}}};const VC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:s,x1:r,width:a}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("x"),s=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{from:{x:t,x1:u(s)?void 0:t,width:u(r)?void 0:0},to:{x:n,x1:s,width:r}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{from:{x:a,x1:u(s)?void 0:a,width:u(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)};const HC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(s)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("x"),s=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{to:{x:t,x1:u(s)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{to:{x:a,x1:u(s)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const GC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:s,y1:r,height:a}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{from:{y:t,y1:u(s)?void 0:t,height:u(r)?void 0:0},to:{y:n,y1:s,height:r}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{from:{y:a,y1:u(s)?void 0:a,height:u(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)};const UC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(s)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(n,n+r):Math.max(n,s);return{to:{y:t,y1:u(s)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(n,n+r):Math.min(n,s);return{to:{y:a,y1:u(s)?void 0:a,height:u(r)?void 0:0}}}(t,e)},WC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s,endAngle:s},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==n?void 0:n.endAngle},to:{startAngle:null==n?void 0:n.startAngle}}:{from:{endAngle:null==n?void 0:n.startAngle},to:{endAngle:null==n?void 0:n.endAngle}}})(t,e)},YC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==n?void 0:n.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==n?void 0:n.startAngle}}})(t,e)},KC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAnimationAttributes(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:s,outerRadius:s},to:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:null==n?void 0:n.innerRadius}}:{from:{outerRadius:null==n?void 0:n.innerRadius},to:{outerRadius:null==n?void 0:n.outerRadius}}})(t,e)},XC=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>{const n=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==n?void 0:n.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==n?void 0:n.innerRadius}}})(t,e)},$C=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,e&&e.center&&(A(e.center.x)&&(s.x=e.center.x),A(e.center.y)&&(s.y=e.center.y)),"area"===t.mark.markType&&(s.x1=s.x,s.y1=s.y),n.map((t=>Object.assign({},t,s)))},ZC=(t,e,i)=>({from:{points:$C(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),qC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:$C(t,e)}}),JC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var n;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),QC=(t,e,i)=>({from:{points:JC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),tE=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:JC(t,e,i)}}),eE=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var n;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),iE=(t,e,i)=>({from:{points:eE(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),nE=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:eE(t,e,i)}}),sE=(t,e,i)=>{var n,s;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),u=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&A(p.x)?p.x:c,f=p&&A(p.y)?p.y:u,m=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:m}};case"y":return{from:{y:f},to:{y:v}};default:return{from:{x:g,y:f},to:{x:m,y:v}}}},rE=(t,e,i)=>{var n,s;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(n=null==h?void 0:h.width())&&void 0!==n?n:i.width,u=null!==(s=null==h?void 0:h.height())&&void 0!==s?s:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,f=d(l)?l.call(null,t.getDatum(),t,i):l,m=f&&A(f.x)?f.x:p,v=f&&A(f.y)?f.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:m}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:m,y:v}}}},aE=(t,e,i)=>{var n,s,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=null==o?void 0:o.scaleX)&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=null==o?void 0:o.scaleY)&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},oE=(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},lE={symbol:["_mo_hide_","visible"]},hE=(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());let r;e&&W(e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),t.mark&&t.mark.markType&&(r=lE[t.mark.markType])&&r.forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{Uf(t,n,s)&&(delete n[t],delete s[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(n).forEach((t=>{u(s[t])&&(u(a[t])||H(n[t],a[t])?delete n[t]:s[t]=a[t])})),{from:n,to:s}},cE=(t,e,i)=>{var n;const s=null!==(n=t.getFinalAnimationAttribute("angle"))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},dE=(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},uE=()=>{Tw.registerAnimationType("clipIn",LC)},pE=()=>{Tw.registerAnimationType("clipOut",DC)},gE=()=>{Tw.registerAnimationType("fadeIn",FC)},fE=()=>{Tw.registerAnimationType("fadeOut",jC)},mE=()=>{Tw.registerAnimationType("growCenterIn",NC)},vE=()=>{Tw.registerAnimationType("growCenterOut",zC)},yE=()=>{Tw.registerAnimationType("growHeightIn",GC)},_E=()=>{Tw.registerAnimationType("growHeightOut",UC)},bE=()=>{Tw.registerAnimationType("growWidthIn",VC)},xE=()=>{Tw.registerAnimationType("growWidthOut",HC)},SE=()=>{Tw.registerAnimationType("growPointsIn",ZC)},AE=()=>{Tw.registerAnimationType("growPointsOut",qC)},kE=()=>{Tw.registerAnimationType("growPointsXIn",QC)},wE=()=>{Tw.registerAnimationType("growPointsXOut",tE)},TE=()=>{Tw.registerAnimationType("growPointsYIn",iE)},CE=()=>{Tw.registerAnimationType("growPointsYOut",nE)},EE=()=>{Tw.registerAnimationType("growAngleIn",WC)},ME=()=>{Tw.registerAnimationType("growAngleOut",YC)},BE=()=>{Tw.registerAnimationType("growRadiusIn",KC)},RE=()=>{Tw.registerAnimationType("growRadiusOut",XC)},OE=()=>{Tw.registerAnimationType("moveIn",sE)},IE=()=>{Tw.registerAnimationType("moveOut",rE)},PE=()=>{Tw.registerAnimationType("scaleIn",aE)},LE=()=>{Tw.registerAnimationType("scaleOut",oE)},DE=()=>{Tw.registerAnimationType("rotateIn",cE)},FE=()=>{Tw.registerAnimationType("rotateOut",dE)},jE=()=>{Tw.registerAnimationType("update",hE)},NE=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var zE,VE,HE;t.ChartEvent=void 0,(zE=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",zE.rendered="rendered",zE.renderFinished="renderFinished",zE.animationFinished="animationFinished",zE.regionSeriesDataFilterOver="regionSeriesDataFilterOver",zE.afterInitData="afterInitData",zE.afterInitEvent="afterInitEvent",zE.afterInitMark="afterInitMark",zE.rawDataUpdate="rawDataUpdate",zE.viewDataFilterOver="viewDataFilterOver",zE.viewDataUpdate="viewDataUpdate",zE.viewDataStatisticsUpdate="viewDataStatisticsUpdate",zE.markDeltaYUpdate="markDeltaYUpdate",zE.viewDataLabelUpdate="viewDataLabelUpdate",zE.scaleDomainUpdate="scaleDomainUpdate",zE.scaleUpdate="scaleUpdate",zE.dataZoomChange="dataZoomChange",zE.drill="drill",zE.layoutStart="layoutStart",zE.layoutEnd="layoutEnd",zE.layoutRectUpdate="layoutRectUpdate",zE.playerPlay="playerPlay",zE.playerPause="playerPause",zE.playerEnd="playerEnd",zE.playerChange="playerChange",zE.playerForward="playerForward",zE.playerBackward="playerBackward",zE.scrollBarChange="scrollBarChange",zE.brushStart="brushStart",zE.brushChange="brushChange",zE.brushEnd="brushEnd",zE.brushClear="brushClear",zE.legendSelectedDataChange="legendSelectedDataChange",zE.legendFilter="legendFilter",zE.legendItemClick="legendItemClick",zE.legendItemHover="legendItemHover",zE.legendItemUnHover="legendItemUnHover",zE.tooltipShow="tooltipShow",zE.tooltipHide="tooltipHide",zE.tooltipRelease="tooltipRelease",zE.afterResize="afterResize",zE.afterRender="afterRender",zE.afterLayout="afterLayout",t.Event_Source_Type=void 0,(VE=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",VE.window="window",VE.canvas="canvas",t.Event_Bubble_Level=void 0,(HE=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",HE.chart="chart",HE.model="model",HE.mark="mark";const GE=`${uk}_waterfall_default_seriesField`,UE=`${uk}_CORRELATION_X`,WE=`${uk}_CORRELATION_Y`,YE=`${uk}_CORRELATION_SIZE`,KE=`${uk}_MEASURE_CANVAS_ID`,XE=`${uk}_DEFAULT_DATA_INDEX`,$E=`${uk}_DEFAULT_DATA_KEY`,ZE=`${uk}_DEFAULT_DATA_SERIES_FIELD`,qE=`${uk}_DEFAULT_SERIES_STYLE_NAME`;var JE;t.AttributeLevel=void 0,(JE=t.AttributeLevel||(t.AttributeLevel={}))[JE.Default=0]="Default",JE[JE.Theme=1]="Theme",JE[JE.Chart=2]="Chart",JE[JE.Base_Series=3]="Base_Series",JE[JE.Series=4]="Series",JE[JE.Mark=5]="Mark",JE[JE.User_Chart=6]="User_Chart",JE[JE.User_Series=7]="User_Series",JE[JE.User_Mark=8]="User_Mark",JE[JE.User_SeriesStyle=9]="User_SeriesStyle",JE[JE.Built_In=99]="Built_In";const QE=`${uk}_STACK_KEY`,tM=`${uk}_STACK_START`,eM=`${uk}_STACK_END`,iM=`${uk}_STACK_START_PERCENT`,nM=`${uk}_STACK_END_PERCENT`,sM=`${uk}_STACK_START_OffsetSilhouette`,rM=`${uk}_STACK_END_OffsetSilhouette`,aM=`${uk}_STACK_TOTAL`,oM=`${uk}_STACK_TOTAL_PERCENT`,lM=`${uk}_STACK_TOTAL_TOP`,hM=`${uk}_SEGMENT_START`,cM=`${uk}_SEGMENT_END`;var dM,uM;t.LayoutZIndex=void 0,(dM=t.LayoutZIndex||(t.LayoutZIndex={}))[dM.Axis_Grid=50]="Axis_Grid",dM[dM.CrossHair_Grid=100]="CrossHair_Grid",dM[dM.Region=450]="Region",dM[dM.Mark=300]="Mark",dM[dM.Node=400]="Node",dM[dM.Axis=100]="Axis",dM[dM.MarkLine=500]="MarkLine",dM[dM.MarkArea=100]="MarkArea",dM[dM.MarkPoint=500]="MarkPoint",dM[dM.DataZoom=500]="DataZoom",dM[dM.ScrollBar=500]="ScrollBar",dM[dM.Player=500]="Player",dM[dM.Legend=500]="Legend",dM[dM.CrossHair=500]="CrossHair",dM[dM.Indicator=500]="Indicator",dM[dM.Title=500]="Title",dM[dM.Label=500]="Label",dM[dM.Brush=500]="Brush",dM[dM.CustomMark=500]="CustomMark",dM[dM.Interaction=700]="Interaction",t.LayoutLevel=void 0,(uM=t.LayoutLevel||(t.LayoutLevel={}))[uM.Indicator=10]="Indicator",uM[uM.Region=20]="Region",uM[uM.Axis=30]="Axis",uM[uM.DataZoom=40]="DataZoom",uM[uM.Player=40]="Player",uM[uM.ScrollBar=40]="ScrollBar",uM[uM.Legend=50]="Legend",uM[uM.Title=70]="Title",uM[uM.CustomMark=70]="CustomMark";const pM=["linear","radial","conical"],gM={x0:0,y0:0,x1:1,y1:1},fM={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},mM={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},vM={linear:gM,radial:fM,conical:mM},yM={label:{name:"label",type:"text"}},_M=`${uk}_rect_x`,bM=`${uk}_rect_x1`,xM=`${uk}_rect_y`,SM=`${uk}_rect_y1`,AM={data:!0},kM={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},wM=Object.assign(Object.assign({},yM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),TM=Object.assign(Object.assign({},yM),{bar3d:{name:"bar3d",type:"rect3d"}}),CM={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},EM=Object.assign(Object.assign({},yM),CM),MM=Object.assign(Object.assign({},yM),{point:{name:"point",type:"symbol"}}),BM=Object.assign(Object.assign(Object.assign({},yM),CM),{area:{name:"area",type:"area"}}),RM=Object.assign(Object.assign(Object.assign({},yM),CM),{area:{name:"area",type:"area"}}),OM=Object.assign(Object.assign({},yM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),IM=Object.assign(Object.assign({},yM),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),PM=Object.assign(Object.assign({},yM),{rose:{name:"rose",type:"arc"}}),LM=Object.assign(Object.assign({},yM),{area:{name:"area",type:"path"}}),DM=Object.assign(Object.assign({},yM),{group:{name:"group",type:"group"}}),FM=Object.assign(Object.assign({},DM),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),jM=Object.assign(Object.assign({},yM),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),NM=Object.assign(Object.assign({},yM),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),zM=Object.assign(Object.assign({},yM),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),VM=Object.assign(Object.assign({},yM),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),HM=Object.assign(Object.assign({},yM),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),GM=Object.assign(Object.assign({},yM),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),UM=Object.assign(Object.assign({},wM),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),WM=Object.assign(Object.assign({},yM),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),YM=Object.assign(Object.assign({},yM),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),KM=Object.assign(Object.assign({},yM),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),XM=Object.assign(Object.assign({},DM),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),$M=Object.assign(Object.assign({},yM),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),ZM=Object.assign(Object.assign({},yM),{sunburst:{name:"sunburst",type:"arc"}}),qM=Object.assign(Object.assign({},wM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),JM=Object.assign(Object.assign({},TM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),QM=Object.assign(Object.assign({},yM),{circlePacking:{name:"circlePacking",type:"arc"}}),tB=Object.assign(Object.assign({},yM),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),eB=Object.assign(Object.assign({},yM),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),iB=Object.assign({},BM),nB=Object.assign(Object.assign({},yM),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),sB=Object.assign(Object.assign({},yM),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var rB;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(rB||(rB={}));const aB={[ck.bar]:wM,[ck.bar3d]:TM,[ck.line]:EM,[ck.scatter]:MM,[ck.area]:BM,[ck.radar]:RM,[ck.pie]:OM,[ck.pie3d]:IM,[ck.rose]:PM,[ck.geo]:yM,[ck.map]:LM,[ck.circularProgress]:FM,[ck.link]:jM,[ck.dot]:NM,[ck.wordCloud]:zM,[ck.wordCloud3d]:zM,[ck.funnel]:VM,[ck.funnel3d]:HM,[ck.linearProgress]:GM,[ck.waterfall]:UM,[ck.boxPlot]:WM,[ck.treemap]:YM,[ck.sankey]:KM,[ck.gauge]:XM,[ck.gaugePointer]:$M,[ck.sunburst]:ZM,[ck.rangeColumn]:qM,[ck.rangeColumn3d]:JM,[ck.circlePacking]:QM,[ck.heatmap]:tB,[ck.correlation]:eB,[ck.rangeArea]:iB,[ck.liquid]:nB,[ck.venn]:sB};function oB(t){var e,i;const{type:n}=t;return n===ck.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const lB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},hB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function cB(t,e){var i;if(!t)return[];const n=vB(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?fB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>gB(i)?uB(t,i,e):i)).filter(p)}))):i.map((i=>gB(i)?uB(t,i,e):i)).filter(p):[]}return[]}function dB(t,e){var i,n;return fB(t)?null!==(n=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function uB(t,e,i){var n;const s=vB(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=lB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=hB[e];return n?t[n]:void 0}(a,e.key))&&void 0!==n?n:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new ae(r);if(p(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=Jt(t,i,n),a=qt(s,r,e.l),l=new ae(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const pB=(t,e,i)=>{if(e&&gB(t)){const n=uB(e,t,i);if(n)return n}return t};function gB(t){return t&&"palette"===t.type&&!!t.key}function fB(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function mB(t){return _(t)?{dataScheme:t}:t}function vB(t,e){var i,n;const{type:s}=null!=e?e:{};let r;if(!e||u(s))r=null==t?void 0:t.default;else{const a=oB(e);r=null!==(n=null!==(i=null==t?void 0:t[`${s}_${a}`])&&void 0!==i?i:null==t?void 0:t[s])&&void 0!==n?n:null==t?void 0:t.default}return r}class yB extends YS{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!fB(this._range))return void super.range(this._range);const t=dB(this._range,this._domain);super.range(t)}}const _B={linear:fA,band:XS,point:class extends XS{constructor(t){super(!1),this.type=_S.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:YS,threshold:bA,colorOrdinal:yB};function bB(t){const e=_B[t];return e?new e:null}function xB(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function SB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function AB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function kB(t){return!!y(t)&&(!!t.endsWith("%")&&Df(t.substring(0,t.length-1)))}function wB(t,e,i,n=0){var s,r;return S(t)?t:kB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(s=t.percent)&&void 0!==s?s:0)+(null!==(r=t.offset)&&void 0!==r?r:0):n}function TB(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((n=>{o[n]=wB(t[n],e.size,i)}))})),o}function CB(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||kB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function EB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const MB=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i},BB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],RB={default:{dataScheme:BB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},OB="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",IB={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:OB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:OB,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},PB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},LB=Object.assign(Object.assign({},PB),{label:{space:0}}),DB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},FB="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",jB={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:FB,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:FB,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},NB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},zB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},VB={horizontal:Object.assign(Object.assign({},NB),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:zB}),vertical:Object.assign(Object.assign({},NB),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:zB})},HB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},GB={horizontal:Object.assign(Object.assign({},NB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:HB}),vertical:Object.assign(Object.assign({},NB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:HB})},UB={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},WB={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},YB={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function KB(t,e){return t&&e.key in t?t[e.key]:e.default}function XB(t){return t&&"token"===t.type&&!!t.key}const $B={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},ZB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:RB,token:$B,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:IB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:VB,sizeLegend:GB,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:PB,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:LB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:WB,markArea:UB,markPoint:YB,polarMarkLine:WB,polarMarkArea:UB,polarMarkPoint:YB,geoMarkPoint:YB,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:jB,crosshair:DB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},qB={name:"dark",colorScheme:{default:{dataScheme:BB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},JB=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>JB(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>JB(t[i],e[i])))),QB=(t,e,i)=>{if(u(e))return t;const n=e[0];return u(n)?t:1===e.length?(t[n]=i,t):(u(t[n])&&("number"==typeof e[1]?t[n]=[]:t[n]={}),QB(t[n],e.slice(1),i))};function tR(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let n;if(!p(i)||"object"!=typeof i)return i;if(i instanceof mi||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}(i))return i;const s=_(i),r=i.length;n=s?new Array(r):"object"==typeof i?{}:c(i)||S(i)||y(i)?i:x(i)?new Date(+i):void 0;const a=s?void 0:Object.keys(Object(i));let o=-1;if(n)for(;++o<(a||i).length;){const t=a?a[o]:o,s=i[t];(null==e?void 0:e.includes(t.toString()))?n[t]=s:n[t]=tR(s,e)}return n}function eR(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];p(n[r])&&"object"==typeof n[r]&&!_(t[r])?iR(t,e,r,i):nR(t,r,n[r])}}}}function iR(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(_(r)){if(n)a=[];else if(_(s))a=s;else if(b(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{if(g(e))e.type===s&&(_(t[s])?t[s].length>=e.index&&(t[s][e.index]=n?sR({},t[s][e.index],i):i):t[s]=n?sR({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?sR({},t[s][r],i):i)}else t.id===e&&(t[s]=n?sR({},t[s],i):i)}))}function aR(t,...e){return sR(oR(t),...e.map(oR))}function oR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const n=t[i];return e[i]=mB(n),e}),{}));return t}(t.colorScheme),{series:n}=t,{mark:s,markByName:r}=t;let a;return(s||r)&&(a=Object.keys(aB).reduce(((t,e)=>{var i;const a=null!==(i=null==n?void 0:n[e])&&void 0!==i?i:{};return t[e]=lR(a,e,s,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function lR(t,e,i,n){if(!aB[e])return t;const s={};return Object.values(aB[e]).forEach((({type:e,name:r})=>{s[r]=sR({},null==i?void 0:i[W(e)[0]],null==n?void 0:n[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),s)}const hR=["animationThreshold","colorScheme","name","padding"];function cR(t,e,i,n){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((r=>{const a=t[r];hR.includes(r)?s[r]=a:m(a)?gB(a)?s[r]=pB(a,e,n):XB(a)?s[r]=KB(i,a):s[r]=cR(a,e,i,n):s[r]=a})),s}const dR={[ZB.name]:ZB},uR=ZB.name,pR=new Map(Object.keys(dR).map((t=>[t,dR[t]]))),gR=new Map(Object.keys(dR).map((t=>[t,cR(dR[t])]))),fR=new Map(Object.keys(dR).map((t=>[t,t===uR]))),mR=(t,e)=>{if(!t)return;const i=bR(e);pR.set(t,i),gR.set(t,cR(i)),fR.set(t,!0)},vR=(t=uR,e=!1)=>(fR.has(t)&&!fR.get(t)&&mR(t,pR.get(t)),e?gR.get(t):pR.get(t)),yR=t=>pR.delete(t)&&gR.delete(t)&&fR.delete(t),_R=t=>!!y(t)&&pR.has(t),bR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:uR;return aR({},vR(i),t)};class xR{static registerInstance(t){xR.instances.set(t.id,t)}static unregisterInstance(t){xR.instances.delete(t.id)}static getInstance(t){return xR.instances.get(t)}static instanceExist(t){return xR.instances.has(t)}static forEach(t,e=[],i){const n=W(e);return xR.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}xR.instances=new Map;class SR{static registerTheme(t,e){mR(t,e)}static getTheme(t,e=!1){return vR(t,e)}static removeTheme(t){return yR(t)}static themeExist(t){return _R(t)}static getDefaultTheme(){return SR.themes.get(uR)}static setCurrentTheme(t){SR.themeExist(t)&&(SR._currentThemeName=t,xR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return SR.getTheme(SR._currentThemeName,t)}static getCurrentThemeName(){return SR._currentThemeName}}function AR(t,e){return y(t)?SR.themeExist(t)?SR.getTheme(t,e):{}:g(t)?t:{}}function kR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=kR(t[n],e)}return i}return _(t)?t.map((t=>kR(t,e))):t}function wR(t,e){if(!t)return t;if(m(t)){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(y(t[n])&&e.getFunction(t[n])){i[n]=e.getFunction(t[n]);continue}i[n]=wR(t[n],e)}return i}return _(t)?t.map((t=>wR(t,e))):t}SR.themes=pR,SR._currentThemeName=uR;function TR(t,e){for(let i=0;it.key===e))}function ER(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}function MR(t,e,i){const n=t.getStackSort(),s={};let r=null;return n&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var n;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(s[o]=null!==(n=s[o])&&void 0!==n?n:{nodes:{}},PR(t,a,s[o],l,e,r))})),n?BR(s):s}function BR(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):BR(t[e].nodes);return t}function RR(t,e){if("values"in t&&t.values.length){const i=function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return A(n)&&(t+=n),t}),0)}(t.values,e),n=function(t,e){const i=[];return t.forEach((t=>{const n=+t[e];A(n)&&i.push(n)})),0===i.length?null:K(i)}(t.values,nM);t.values.forEach((t=>{t[aM]=i,t[oM]=n,delete t[lM]}));const s=t.values.reduce(((t,e)=>e[eM]>t[eM]?e:t));s[lM]=!0}else for(const i in t.nodes)RR(t.nodes[i],e)}function OR(t){if(!t.values.length)return;const e=t.values[t.values.length-1][eM]/2;for(let i=0;i0){let n=0,s=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[tM]=n,n+=r[eM],r[eM]=n):(r[tM]=s,s+=r[eM],r[eM]=s),r[QE]=t.key}if(i)for(let i=0;i=0?n:s;r=a>=0?1:-1,l[iM]=0===h?0:Math.min(1,l[tM]/h)*r,l[nM]=0===h?0:Math.min(1,l[eM]/h)*r}}for(const n in t.nodes)IR(t.nodes[n],e,i)}function PR(t,e,i,n,s,r,a){if("values"in e)if(s&&e.values.forEach((t=>t[eM]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[n]))),i.series.push({s:t,values:e.values}),r){const n=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:n?r[n].sort[e[n]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),PR(t,e.nodes[o],i.nodes[o],n,s,r,l)}}function LR(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,n,s)=>FR(t.style(e,i,n,s)):B(t.style)||(e.style=FR(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,n,s,r)=>FR(t.state[e](i,n,s,r)):B(t.state[e])||(i[e]=FR(t.state[e]))})),e.state=i}return e}function DR(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,n,s,r)=>FR(t[i](e,n,s,r)):B(t[i])||(e[i]=FR(t[i]))})),e}function FR(t){return(null==t?void 0:t.angle)&&(t.angle=Gt(t.angle)),t}class jR{static registerChart(t,e){jR._charts[t]=e}static registerSeries(t,e){jR._series[t]=e}static registerComponent(t,e,i){jR._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){jR._marks[t]=e}static registerRegion(t,e){jR._regions[t]=e}static registerTransform(t,e){jR.transforms[t]=e}static registerLayout(t,e){jR._layout[t]=e}static registerAnimation(t,e){jR._animations[t]=e}static registerImplement(t,e){jR._implements[t]=e}static registerChartPlugin(t,e){jR._chartPlugin[t]=e}static registerComponentPlugin(t,e){jR._componentPlugin[t]=e}static createChart(t,e,i){if(!jR._charts[t])return null;return new(0,jR._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!jR._charts[t])return null;const i=jR._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!jR._regions[t])return null;return new(0,jR._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!jR._regions[t])return null;return new(0,jR._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!jR._series[t])return null;return new(0,jR._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!jR._series[t])return null;return new(0,jR._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!jR._marks[t])return null;const n=new(0,jR._marks[t])(e,i);return"group"===n.type&&n.setInteractive(!1),n}static getComponents(){return Object.values(jR._components)}static getComponentInKey(t){return jR._components[t].cmp}static getLayout(){return Object.values(jR._layout)}static getLayoutInKey(t){return jR._layout[t]}static getSeries(){return Object.values(jR._series)}static getSeriesInType(t){return jR._series[t]}static getRegionInType(t){return jR._regions[t]}static getAnimationInKey(t){return jR._animations[t]}static getImplementInKey(t){return jR._implements[t]}static getSeriesMarkMap(t){return jR._series[t]?jR._series[t].mark:{}}static getChartPlugins(){return Object.values(jR._chartPlugin)}static getComponentPlugins(){return Object.values(jR._componentPlugin)}static getComponentPluginInType(t){return jR._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}jR._charts={},jR._series={},jR._components={},jR._marks={},jR._regions={},jR._animations={},jR._implements={},jR._chartPlugin={},jR._componentPlugin={},jR.transforms={fields:qe,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},jR.dataParser={csv:hi,dsv:li,tsv:ci},jR._layout={};const NR=(t,e)=>{var i,n;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},zR=(t,e,i,n)=>{var s;const r=CS(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=W(n(l)),o=null===(s=l.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r){const e=[],n=[];o.forEach(((s,r)=>{var a;(null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(s),n.push(r))})),a.push({series:l,datum:e,key:VR(l,n)})}else if(p(i[1])){const e=[],n=[];o.forEach(((s,r)=>{var a;((null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(s[i[0]])&&p(s[i[1]])&&t>=s[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=s[0]&&a<=s[1]&&(r.push(e),h.push(n))}}));else{let e=1/0,n=0;o.forEach(((s,a)=>{if(p(s[i[0]])){const o=Math.abs(s[i[0]]-t),l=Math.sign(s[i[0]]-t);o`${t.id}_${e.join("_")}`,HR=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(W(e.layout.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))})(t,n,i)));return n.length?n:null},GR=(t,e)=>{if(!t)return null;const{x:i,y:n}=e,s=HR(t,(t=>"angle"===t.getOrient()),e),r=HR(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return s&&s.forEach((t=>{var e;const s=t.getScale();if(s&&CS(s.type)){const l=s.domain(),h=s.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:n-t.getLayoutStartPoint().y-c.y};let p=rk({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,n=X(e),s=K(e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,h);const g=ak(d),f=null===(e=r[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=zR(v,t,"polar",o);a.push({index:y,value:v,position:s.scale(v),axis:t,data:_})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&CS(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:n-t.getLayoutStartPoint().y-h.y};let d=rk({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=ak(c),g=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=r.invert(p);if(u(m))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=zR(m,t,"polar",o);a.push({index:v,value:m,position:r.scale(m),axis:t,data:y})}})),a.length?a:null};function UR(t){return"bottom"===t||"top"===t}function WR(t){return"left"===t||"right"===t}function YR(t){return"z"===t}function KR(t,e){return AB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function XR(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?UR(t)?"linear":"band":UR(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const $R=t=>t.fieldX[0],ZR=t=>t.fieldY[0],qR=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},JR=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},QR=(t,e)=>t?e?$R:qR:e?ZR:JR,tO=(t,e,i)=>{var n,s;if(!t)return null;const{x:r,y:a}=e,o=null!==(n=HR(t,(t=>UR(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=HR(t,(t=>WR(t.getOrient())),e))&&void 0!==s?s:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{CS(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((n=>{if(d.size>0){if(d.has(n)){const s=eO(n,i,t,QR(e,CS(n.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(n)){const r=eO(n,i,t,QR(e,s));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},eO=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return iO(t,a,n)},iO=(t,e,i)=>{const n=t.getScale();if(u(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=zR(e,t,"cartesian",null!=i?i:UR(t.getOrient())?$R:ZR);return{index:s,value:e,position:n.scale(e),axis:t,data:r}};class nO{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,n;(null!==(n=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:Cf)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Cf)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=tO(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=GR(this.chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),s=n.filter((t=>CS(t.getScale().type))),r=s.length?s:n.filter((t=>{const e=t.getOrient();return UR(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=iO(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var sO;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(sO||(sO={}));const rO={[sO.dimensionHover]:class extends nO{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!NR(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:n.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:n.slice()})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),Of(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Of(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[sO.dimensionClick]:class extends nO{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:n.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let aO=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(rO[t]){const e=new rO[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(rO[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class oO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const lO={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class hO{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),n=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let n=null;i.elements&&(n=i.elements);const s={event:t.event,chart:e,items:n,datums:n&&n.map((t=>t.getDatum()))};this.dispatch(t.type,s)},this.globalInstance=t,this._compiler=e}register(e,i){var n,s,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new oO);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var n,s,r,a;let o=!1;const l=this.getEventBubble((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const n=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,n),h.delete(e)}return this}dispatch(e,i,n){const s=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!s)return this;let r=!1;if(n){const t=s.getHandlers(n);r=this._invoke(t,e,i)}else{const n=s.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(n,e,i),!r){const n=s.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(n,e,i)}if(!r){const n=s.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(n,e,i)}if(!r){const n=s.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(n,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const n=this.getEventBubble(i).get(t);n&&n.getAllHandlers().forEach((t=>{e&&t.callback===e||n.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var n,s,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return lO[a]&&(a=lO[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(n=t.query)||void 0===n?void 0:n.consume;return o&&(null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return n.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const n=e.query;(null==n?void 0:n.throttle)?e.wrappedCallback=ft(e.callback,n.throttle):(null==n?void 0:n.debounce)&&(e.wrappedCallback=gt(e.callback,n.debounce));let s=this._getQueryLevel(n),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==n?void 0:n.nodeName)&&(o=n.nodeName),(null==n?void 0:n.markName)&&(l=n.markName),!(null==n?void 0:n.type)||s!==t.Event_Bubble_Level.model&&s!==t.Event_Bubble_Level.mark||(r=n.type),(null==n?void 0:n.source)&&(a=n.source),p(null==n?void 0:n.id)&&(h=null==n?void 0:n.id,s=t.Event_Bubble_Level.model),e.filter={level:s,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==n?void 0:n.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return NE.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&Tw.hasInteraction(e)}}function cO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function dO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const uO=new Map;function pO(t,e=!1){let i=e;return t.latestData instanceof mi&&(i=!1),i?P(t.latestData):t.latestData.slice()}const gO=(t,e)=>0===t.length?[]:1===t.length?pO(t[0],null==e?void 0:e.deep):t.map((t=>pO(t,null==e?void 0:e.deep)));function fO(t,e,i){cO(e=e instanceof gi?e:t.dataSet,"copyDataView",gO);const n=new mi(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView",level:yO.copyDataView}),n}function mO(t,e,i=[],n={}){var s,r,a;if(t instanceof mi)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?P(t.parser):{clone:!0},p=P(t.fields);let g;u.clone=!(!1===u.clone);const f=i.find((t=>t.name===o));if(f)g=f;else{const t={name:o};if(p&&(t.fields=p),g=new mi(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(s=n.onError)&&void 0!==s?s:Cf)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=n.onError)&&void 0!==r?r:Cf)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!y(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Tf("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function vO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var yO;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(yO||(yO={}));const _O=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._view)return;const s=new it(null!==(t=this._option.logLevel)&&void 0!==t?t:et.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&s.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new pC(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(n=this._container.canvas)&&void 0!==n?n:null,hooks:this._option.performanceHook},this._option),{mode:kO(this._option.mode),autoFit:!1,eventConfig:{gesture:Of(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:s,logLevel:s.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const n=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,s=t[n];t[n]=s?Object.assign(Object.assign(Object.assign({},s),e),{selector:[...s.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const n=this._compileChart.getRegionsInIds([t[e].regionId])[0];n&&n.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(fg.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=fg.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,n){var s,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};n.call(null,g)}.bind(this);this._viewListeners.set(n,{type:i,callback:t}),null===(s=this._view)||void 0===s||s.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const s={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};n.call(null,s)}.bind(this);this._windowListeners.set(n,{type:i,callback:t});const s=this._getGlobalThis();null==s||s.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const s={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};n.call(null,s)}.bind(this);this._canvasListeners.set(n,{type:i,callback:t});const s=null===(r=this.getStage())||void 0===r?void 0:r.window;null==s||s.addEventListener(i,t)}}removeEventListener(e,i,n){var s,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(s=this._viewListeners.get(n))||void 0===s?void 0:s.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(n)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(n))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(n)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(n))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(n)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),n=t.grammarType;u(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(u(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return Rf(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function TO(t,e){var n;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(n=null==e?void 0:e.onError)&&void 0!==n?n:Cf)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function CO(t){t.crosshair=W(t.crosshair||{}).map((e=>sR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function EO(t,e,i){var n;const{width:s,height:r}=t;if(p(s)&&p(r))return{width:s,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Pe(l,i.width,i.height);a=t,o=e}else if(h&&Rf(e.mode)){let t;t=y(h)?fg.getElementById(h):h;const{width:e,height:n}=Pe(t,i.width,i.height);a=e,o=n}else if(If(e.mode)&&(null===(n=e.modeParams)||void 0===n?void 0:n.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=s?s:a,o=null!=r?r:o,{width:a,height:o}}function MO(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function BO(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(SO||(SO={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(AO||(AO={}));class RO{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},RO.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=W(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}RO.defaultMarkInfo={};class OO{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new RO,this._markReverse=new RO,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(SO.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(SO.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(SO.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(SO.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(SO.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(SO.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[SO.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[SO.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(sO.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct();if(!s||!s.elements)return;const r=s.elements.filter((i=>{const n=i.getDatum();let s;return s=_(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s}));i.push(...r)}))}))})),i}}const IO={};Object.values(SO).forEach((t=>{IO[t]=!0}));const PO={[SO.STATE_HOVER]:SO.STATE_HOVER_REVERSE,[SO.STATE_SELECTED]:SO.STATE_SELECTED_REVERSE,[SO.STATE_DIMENSION_HOVER]:SO.STATE_DIMENSION_HOVER_REVERSE};function LO(t){return PO[t]}class DO{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const n=LO(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;if(this._disableTriggerEvent)return;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=LO(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=LO(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=LO(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class FO{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class jO extends FO{constructor(){super(...arguments),this.id=Lf(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class NO extends jO{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=xO.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class zO extends FO{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new NO(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class VO extends zO{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){if(t&&(j(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class HO extends VO{constructor(){super(...arguments),this.id=Lf(),this.stateKeyToSignalName=t=>`${uk}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===bO.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===bO.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?bO.none:bO.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?bO.exit:"update"===e.diffState?bO.update:bO.appear}}}}class GO{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>sR({},i,n,t);return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class UO extends FO{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=GO,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new RO,this._lastLayoutRect=null,this.id=Lf(),this.userId=t.id,this._spec=t,this.effect={},this.event=new aO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var n;null===(n=this._layout)||void 0===n||n.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${uk}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:n}=t,s=jR.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class WO{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var n;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(n=null==e?void 0:e.getSpec)||void 0===n?void 0:n.call(e)}_setLayoutAttributeFromSpec(t,e){var i,n,s,r;if(this._spec&&!1!==this._spec.visible){const a=TB(CB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:wB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:wB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:wB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:wB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:wB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:wB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=wB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=wB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,s,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=wB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(n)||(r.width-=n),u(s)||(r.width-=s),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(n)?u(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,s,r,a;A(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class YO extends UO{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new WO(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&H(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(n=this._spec.orient)&&void 0!==n?n:this._orient,this.layoutLevel=null!==(s=this._spec.layoutLevel)&&void 0!==s?s:this.layoutLevel}}class KO extends GO{_initTheme(t,e){return{spec:t,theme:this._theme}}}class XO extends YO{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var n;super(e,i),this.transformerConstructor=KO,this.modelType="region",this.specKey="region",this.type=XO.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new DO,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(n=e.coordinate)&&void 0!==n?n:"cartesian",this._option.animation&&(this.animate=new HO({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,n){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(n);const o=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return H(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||W(t.userId).includes(e.userId))&&(!p(t.specIndex)||W(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new OO(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in AO)B(t.stateStyle[AO[e]])||this.interaction.registerMark(AO[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function $O(t){const e=[],i=[],n=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&n.push(t)})),{startItems:e,endItems:n,middleItems:i}}function ZO(t,e,i){e?t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+s})}))})):t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+s,y:t.getLayoutStartPoint().y})}))}))}function qO(t,e,i,n){let s;t.forEach(((t,r)=>{t.length>1&&(s=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?s-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):s-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+n*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+n*a*r})})))}))}function JO(t,e,i,n,s){if(t.length){let r=0;const a="right"===s,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const n=e.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(n);t.setLayoutRect(s);const p=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),qO(c,!0,u,o),n&&ZO(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function QO(t,e,i,n){if(t.length){let i=0;const s="right"===n,r=s?-1:1;let a=s?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const n=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(n);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=s?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const n=e.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(n);t.setLayoutRect(s);const p=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=r?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),qO(c,!1,u,a),n&&ZO(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function eI(t,e,i,n){if(t.length){const i="top"===n,s=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const n=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(n);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),n=t.filter((t=>"region-relative-overlap"===t.layoutType)),s=i.concat(n),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:s,overlapItems:r}}layoutItems(t,e,i,n){this._layoutInit(t,e,i,n),this._layoutNormalItems(e);const s={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,s),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r){if(s.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(s,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,n))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=$O(t);n.length&&JO(n,e,i,!1,"left"),s.length&&JO(s,e,i,!0,"left"),r.length&&QO(r,e,0,"left")}(e,this,a),n.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=$O(t);n.length&&tI(n,e,i,!1,"top"),s.length&&tI(s,e,i,!0,"top"),r.length&&eI(r,e,0,"top")}(n,this,r),i.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=$O(t);n.length&&JO(n,e,i,!1,"right"),s.length&&JO(s,e,i,!0,"right"),r.length&&QO(r,e,0,"right")}(i,this,a),s.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=$O(t);n.length&&tI(n,e,i,!1,"bottom"),s.length&&tI(s,e,i,!0,"bottom"),r.length&&eI(r,e,0,"bottom")}(s,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);e.rect.width=Math.max(n.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(n.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),s=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=n-t.layoutPaddingLeft-t.layoutPaddingRight,i=s-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:s,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let s=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",n.left),this._layoutRelativeOverlap("right",n.right),s=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",n.top),this._layoutRelativeOverlap("bottom",n.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,s,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-s})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.getModelId()===e));return n||(null!==(i=this._onError)&&void 0!==i?i:Cf)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const n="left"===t.layoutOrient||"right"===t.layoutOrient,s=t.getLastComputeOutBounds(),r=this._getOutInLayout(s,t,e);n?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:n,y:s}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+r+t.x2-i.right,top:i.top-(s-t.y1),bottom:s+a+t.y2-i.bottom}}}iI.type="base";const nI=["line","area","trail"];function sI(t){return nI.includes(t)}class rI extends VO{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];p(n.domain)&&(s.domain=n.domain),p(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=c(sI)?n:!t.mark||sI(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),a=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),a=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!IO[t])).map((t=>[t,10])),n=!t.mark||sI(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(_(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uk)));n=t.datums.some((t=>i&&_(null==t?void 0:t.items)?e.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uk)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(wS(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class aI extends jO{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=xO.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const n=this.getVGrammarView();if(!n||!t)return;const s=this.getProductId();this._product=null===(i=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.call(n,t))||void 0===i?void 0:i.id(s),this._compiledProductId=s}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class oI extends aI{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${uk}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class lI extends jO{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,n){super(e),this.grammarType=xO.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=n,this.key=e.key,this.state=new rI(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new aO(n.getOption().eventDispatcher,n.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new oI(t)}stateKeyToSignalName(t){return`${uk}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=SO.STATE_NORMAL,n=t[i];e(t,["symbol"==typeof i?i:i+""]);const s=this._option.noSeparateStyle?null:{},r={};return Object.keys(n).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!d(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,n,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:s[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:s,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=SO.STATE_NORMAL;t[i];const n=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:s,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",s,!0),Object.keys(n).forEach((t=>{const e={};Object.keys(n[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,n,s;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(n=(i=this.model).getRegion)||void 0===n?void 0:n.call(i);r=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var n;return null===(n=i[r])||void 0===n?void 0:n.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===bO.appear&&this.runAnimationByState(bO.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(bO.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),n={mark:null,parent:null,element:null};return(t,e)=>(n.mark=e.mark,n.parent=e.mark.group,n.element=e,i(t,n))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class hI extends lI{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,n=i.range();return i.range(n.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Gt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(u(t))return;void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);if(s)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,i)(e,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;p(a)&&a<=n&&sR(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(TS(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=bB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];n||(n=this.stateStyle.normal[t]);const s=this._computeStateAttribute(n,t,e),r=d(null==n?void 0:n.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=s(r,a);return o=n.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>n.postProcess(s(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(n,r)=>i(t,n,e,r,s(n,r))}return s}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):pM.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):TS(null===(n=t.style.scale)||void 0===n?void 0:n.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,n){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const s=e.state;s&&Object.keys(s).forEach((e=>{const n=s[e];if("style"in n){const s=n.style;let r={stateValue:e};"level"in n&&(r.level=n.level),"filter"in n&&(r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r)),this.state.addStateInfo(r),this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,n;const{gradient:s,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=dB(cB(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(i=this.model).getSpec)||void 0===n?void 0:n.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},vM[s]),o);return(t,e)=>{const i={},n=this.getDataView();return Object.keys(u).forEach((s=>{const r=u[s];"stops"===s?i.stops=r.map((i=>{const{opacity:s,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,n)),p(s)&&(o=ae.SetOpacity(o,s)),{offset:d(a)?a(t,this._attributeContext,e,n):a,color:o||c[0]}})):d(r)?i[s]=r(t,this._attributeContext,e,n):i[s]=r})),i.gradient=s,i}}_computeBorderAttr(t){const{scale:i,field:n}=t,s=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(s).forEach((i=>{const n=s[i];d(n)?l[i]=n(t,this._attributeContext,e,this.getDataView()):l[i]=n})),"stroke"in l)pM.includes(null===(o=s.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(s.stroke)(t,e));else{const e=dB(cB(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let s=i,o=n;if(!(i&&n||"series"!==this.model.modelType)){const{scale:n,field:r}=this.model.getColorAttribute();i||(s=n),o||(o=r),l.stroke=(null==s?void 0:s.scale(t[o]))||e[0]}}return l}}}class cI extends hI{constructor(){super(...arguments),this.type=cI.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Tf("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Tf("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}cI.type="group";const dI=()=>{wb(),pb(),Tw.registerGraphic(Ik.group,Al),jR.registerMark(cI.type,cI)},uI={type:"fadeIn"};function pI(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return uI;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const gI={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},fI={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},mI=()=>{jR.registerAnimation("scaleInOut",(()=>fI))},vI=(t,e)=>({appear:pI(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Va,duration:gI.update.duration,easing:gI.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),yI=()=>{jR.registerAnimation("line",vI)},_I=()=>{pC.useRegisters([SE,AE,kE,wE,TE,CE,uE,pE])},bI={measureText:(t,e,i,n)=>((t,e,i)=>$b(t,e,i,{fontFamily:$B.fontFamily,fontSize:$B.fontSize}))(e,i,n).measure(t)};class xI{static instance(){return xI.instance_||(xI.instance_=new xI),xI.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class SI{constructor(){this.id=Lf(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Tf("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class AI extends SI{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class kI{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>jR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>jR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>jR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return jR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>jR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){jR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&xI.instance().registerFunction(t,e)}static unregisterFunction(t){t&&xI.instance().unregisterFunction(t)}static getFunction(t){return t?xI.instance().getFunction(t):null}static getFunctionList(){return xI.instance().getFunctionNameList()}static registerMap(t,e,i){const n=jR.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=jR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,uO.get(e);var e}static hideTooltip(t=[]){xR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return it.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,n){var s,r,a,o,l,h;this.id=Lf(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=gt(((...t)=>{this._doResize()}),100),this._option=j(this._option,{animation:!1!==i.animation},n),this._onError=null===(s=this._option)||void 0===s?void 0:s.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:f}=c,m=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=Rf(p);v?qm(qs):"node"===p&&Ry(qs),v&&d&&(this._container=y(d)?fg.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=SR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new wO({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==f?["poptipForText"]:[]},m),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new hO(this,this._compiler),this._event=new aO(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),xR.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=sR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=kR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;kI.getFunctionList()&&kI.getFunctionList().length&&(t=wR(t,kI)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=jR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(n=this._chartSpecTransformer)||void 0===n?void 0:n.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=jR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,n,s;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(n=this._option)||void 0===n||n.onError("chart is already initialized"));const r=jR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return EO(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:pk,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:gk})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof gi?t:new gi,dO(this._dataSet,"dataview",di),dO(this._dataSet,"array",n),cO(this._dataSet,"stackSplit",_O),cO(this._dataSet,"copyDataView",gO);for(const t in jR.transforms)cO(this._dataSet,t,jR.transforms[t]);for(const t in jR.dataParser)dO(this._dataSet,t,jR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,n,s,r,a,o,l,h,c,d;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(n=this._currentTheme)||void 0===n?void 0:n.fontFamily)):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(d=this._compiler)||void 0===d||d.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,n,s,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const n=t?bO.appear:bO.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(n,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(n,!0)}))}}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(n=this._compiler)||void 0===n||n.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,xR.unregisterInstance(this)}updateData(t,e,n,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n,s)}))}_updateDataById(t,e,i){const n=this._spec.data.find((e=>e.name===t||e.id===t));n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=W(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,n){return u(this._dataSet)?this:this._chart?((null==n?void 0:n.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=W(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const n=W(this._spec.data);return W(t).forEach((t=>{var e;const{id:i,values:s,parser:r,fields:a}=t,o=n.find((t=>t.name===i));if(o)o instanceof mi?(o.setFields(P(a)),o.parse(s,P(r))):(o.values=s,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=mO(t,this._dataSet,n,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});_(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,s);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,n){const s=this._updateSpec(t,e,n);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var n,s;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;H(r.theme,this._spec.theme)?H(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=MO(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,n=!1,s){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||rR(this._spec,t,e,n),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,n,s)}return this}))}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||rR(this._spec,t,e,i),this._chart){const s=this._chart.getModelInFilter(t);if(s)return this._updateModelSpec(s,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,s){n&&(e=sR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:s,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,n;return this._beforeResize(t,e)?(null===(n=(i=this._compiler).resize)||void 0===n||n.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,n,s,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e,!1),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(n=this._event)||void 0===n||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const n=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));n>=0&&(this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const n=this._option.theme,s=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(n)&&B(s))this._currentTheme=AR(this._currentThemeName,!0);else if(y(n)&&(!s||y(s))||y(s)&&(!n||y(n))){const t=aR({},AR(this._currentThemeName,!0),AR(n,!0),AR(s,!0));this._currentTheme=t}else{const t=aR({},AR(this._currentThemeName),AR(n),AR(s));this._currentTheme=cR(t)}var r;r=R(this._currentTheme,"component.poptip"),j(rx.poptip,sx,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(n=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(n=!0);const s=this._autoSize;return this._autoSize=!!Rf(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==s&&(n=!0),n}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return AR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!SR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!SR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const n=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==n?void 0:n.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);n&&n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield TO(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,n;return i(this,void 0,void 0,(function*(){if(!Rf(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(n=this._option)||void 0===n||n.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?fg.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,n){var s;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o){const e=Object.keys(t),s=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=s?o.dataToPosition(s,n):o.dataToPosition(t,n),a?EB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||u(t)||B(e))return null;if(!_(t)){const{axisId:s,axisIndex:r}=e;let a;if(p(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):p(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return Tf("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?EB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Tf("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return xI.instance().getFunction(t)}registerFunction(t,e){t&&e&&xI.instance().registerFunction(t,e)}unregisterFunction(t){t&&xI.instance().unregisterFunction(t)}getFunctionList(){return xI.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);n&&n[t]&&n[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier({regionIndex:t})[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier({regionId:t})[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=jR.getChartPlugins();t.length>0&&(this._chartPlugin=new AI(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}kI.InstanceManager=xR,kI.ThemeManager=SR,kI.globalConfig={uniqueTooltip:!0},kI.Utils=bI,kI.vglobal=fg;jR.registerRegion("region",XO),jR.registerLayout("base",iI),dI(),pC.useRegisters([RC,OC]),pC.useRegisters([PE,LE,gE,fE,OE,IE,DE,FE,jE]),Yw(),Ww(),mR(qB.name,qB),it.getInstance(et.Error);const wI=(t="chart",e,i)=>{var n,s,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(n=e.region)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(s=e.series)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(ck).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=jR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:n}=f,s=W(null!==(h=null===(l=i.component)||void 0===l?void 0:l[n])&&void 0!==h?h:[]);null===(d=W(null!==(c=e[n])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const n=s[i];n.type===t&&f.modelInfo.push(Object.assign(Object.assign({},n),{spec:e}))}))}else{const n=jR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(n.length>0){f.modelType="component";const s=t;f.specKey=s;const r=W(null!==(p=null===(u=i.component)||void 0===u?void 0:u[s])&&void 0!==p?p:[]);W(null!==(g=e[s])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];n.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},TI=(t,e,i,n)=>{const{spec:s,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,n,s,r)=>{const a=wI(t,s,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||W(e).some((e=>d(e)?e(t,i,n):JB(t.spec,e)))))})})(a,r,t,e,i,n);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=sR({},i),m=d(s)?s(g,t,e):s;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:sR(f,m),hasChanged:!0};const i=sR({},t,m);QB(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}};class CI{constructor(t){this.id=Lf(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const EI=t=>{jR.registerChartPlugin(t.type,t)};class MI extends CI{constructor(){super(MI.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[MI.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,n)=>{n?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[MI.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let n,s;switch(i){case"render":case"updateModelSpec":n=!1,s=!0;break;case"updateSpec":case"setCurrentTheme":n=!0,s=!1;break;case"updateSpecAndRecompile":n=!1,s=!1}if(n&&this.release(),this._initialized||this.onInit(t,e),n||s){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,n){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,n))}_applyQueries(t,e){const i=[],n=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:s}=this._check(t);e&&(s?i.push(t):n.push(t))})),!i.length&&!n.length)return!1;let s,r;this._baseChartSpec||(this._baseChartSpec=tR(this._option.globalInstance.getSpec(),["data",MI.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return n.length>0?(s=tR(this._baseChartSpec,["data",MI.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(n.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,s,r);s=e.chartSpec})),a=!0):(s=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,s,r);s=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(s,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const n in t)switch(n){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const s=TI(t,n,e,i);e=s.chartSpec,r||(r=s.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=tR(i,["data",MI.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let n=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,n||(n=e.hasChanged)})),n&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}MI.pluginType="chart",MI.specKey="media",MI.type="MediaQueryPlugin";const BI=/\{([^}]+)\}/,RI=/\{([^}]+)\}/g,OI=/:/;class II extends CI{constructor(){super(II.type),this.type="formatterPlugin",this._timeModeFormat={utc:Fe.getInstance().timeUTCFormat,local:Fe.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=We.getInstance().format,this._numericSpecifier=We.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:n}=t;if(!n)return;this._spec=null!==(i=null==e?void 0:e[II.specKey])&&void 0!==i?i:{};const{timeMode:s,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:s&&this._timeModeFormat[s]&&(this._timeFormatter=this._timeModeFormat[s]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),jR.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,n)=>{const s=_(i)?i[n]:i;return s?this._formatSingleLine(t,e,s):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let n;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?n=this._isNumericFormatterCache.get(i):(n=BI.test(i),this._isNumericFormatterCache.set(i,n))),n){const t=i.replace(RI,((t,i)=>{if(!OI.test(i)){const n=e[i.trim()];return void 0!==n?n:t}const n=i.split(":"),s=e[n.shift()],r=n.join(":");return this._formatSingleText(s,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(He.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}II.pluginType="chart",II.specKey="formatter",II.type="formatterPlugin";const PI=()=>{EI(II)};function LI(t){return 2===t.length&&A(t[0])&&A(t[1])&&t[1]>=t[0]}function DI(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!A(a.min),extendable_max:!A(a.max)}}function FI(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function jI(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function NI(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function zI(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const VI=(t,e)=>{var i,n,s,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const f=c.domain(),m=f[1]-f[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return m*e+f[0]}));return xA(v)};class HI extends CI{constructor(){super(HI.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!wS(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const n=this._checkEnableSync(i);if(!n)return;if(!n.zeroAlign)return;const s=this._getTargetAxis(i,n);s&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===s.id},(()=>{((t,e)=>{var i,n,s,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(s=null===(n=(i=t).getDomainAfterSpec)||void 0===n?void 0:n.call(i))&&void 0!==s?s:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&LI(c)&&LI(d)))return;const u=DI(t,c),p=DI(e,d),{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!jI(u,p))return}else if(0===_&&0===b){if(!jI(p,u))return}else if(y||A)if(y&&!A){if(!FI(u,p))return}else if(A&&!y){if(!FI(p,u))return}else{if(f===b)return;if(f>b){if(!NI(u,p))return}else if(!NI(p,u))return}else{if(0===f&&0===_){if(!zI(u,p))return}else if(0===b&&0===g&&!zI(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){cO(e.getOption().dataSet,"tickAlign",VI);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}HI.pluginType="component",HI.type="AxisSyncPlugin";const GI=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,UI=(t,e)=>{var i;let n,s;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(n=t.split("\n"),n=n.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(s=t.text,n=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s},cd||(cd=ld.CreateGraphic("richtext",{})),cd.setAttributes(a),cd.AABBBounds);var a;return{width:r.width(),height:r.height(),text:n}},WI="vchart-tooltip-container",YI={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function KI(t,e){return R(e,`component.${t}`)}function XI(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=jR.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const $I={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ZI(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function qI(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function JI(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const QI=(t,e,i)=>{var n;const s=null!==(n="band"===e?KI("axisBand",i):["linear","log","symlog"].includes(e)?KI("axisLinear",i):{})&&void 0!==n?n:{},r=UR(t)?KI("axisX",i):WR(t)?KI("axisY",i):KI("axisZ",i);return sR({},KI("axis",i),s,r)},tP=(t,e,i)=>{var n;const s=null!==(n="band"===e?KI("axisBand",i):"linear"===e?KI("axisLinear",i):{})&&void 0!==n?n:{},r=KI("angle"===t?"axisAngle":"axisRadius",i);return sR({},KI("axis",i),s,r)},eP=t=>"band"===t||"ordinal"===t||"point"===t;function iP(t,e){return{id:t,label:t,value:e,rawValue:t}}function nP(t,e,i,n){for(let s=0,r=t.length;s=e)return r}}return null}const sP=(t=3,e,i,n,s,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,f=0,m=0;if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!n.size&&Number.isFinite(f),y=!!s.size&&Number.isFinite(m),_=o&&!v&&p(l),b=o&&!y&&p(h);let x,S,A;c&&(x=_?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:y,axis:g});let k,w=0,T=0;if(r&&n.forEach((({axis:t,value:i})=>{var n;i=null!=i?i:"";let s=null;const a=t.getScale();if(CS(a.type))A=a.bandwidth(),0===A&&a.step&&(w=a.step());else if(wS(a.type)){const n=e.fieldX[0],r=e.fieldX2,a=nP(e.getViewData().latestData,+i,n,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[n]} ~ ${a[r]}`):A=1,f=t}s=t.niceLabelFormatter}if(x&&(null===(n=r.label)||void 0===n?void 0:n.visible)&&!_){const e=ZI(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=s,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=s,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&s.forEach((({axis:t,value:i})=>{var n;i=null!=i?i:"";let s=null;const r=t.getScale();if(CS(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(wS(r.type)){const n=e.fieldY[0],r=e.fieldY2,a=nP(e.getViewData().latestData,+i,n,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[n]} ~ ${a[r]}`):k=1,m=t}s=t.niceLabelFormatter}if(S&&(null===(n=a.label)||void 0===n?void 0:n.visible)&&!b){const e=ZI(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=s,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=s,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!_){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(aP(t,n),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=f+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&rP(t,"top",r.label),e.visible&&rP(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(aP(t,s),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=m+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&rP(t,"left",a.label),e.visible&&rP(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:w,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},rP=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=XI(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},aP=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},oP=(t,e,i,n)=>{const{x:s,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:s+i/2,y:r},end:{x:s+i/2,y:r+a}};else if("rect"===o){const o=hP(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(s-o/2-n/2,h),y:r},end:{x:Math.min(s+i+o/2+n/2,c),y:r+a}}}return l},lP=(t,e,i,n)=>{const{leftPos:s,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:s,y:a+i/2},end:{x:s+r,y:a+i/2}};else if("rect"===o){const o=hP(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:s,y:Math.max(a-o/2-n/2,h)},end:{x:s+r,y:Math.min(a+i+o/2+n/2,c)}}}return l},hP=(t,e,i)=>{var n,s,r;let a=0;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(s=t.style)||void 0===s?void 0:s.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const n=i.getLayoutRect();a=t.style.size(n,i)-e}return a},cP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const n=t(e);S(n)&&(i=n)}return i},dP={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},uP=(t,e)=>{var i,n;return null!==(n=null===(i=dP[t])||void 0===i?void 0:i[0])&&void 0!==n?n:e},pP=(t,e)=>{var i,n;return null!==(n=null===(i=dP[t])||void 0===i?void 0:i[1])&&void 0!==n?n:e},gP=(t,e,i)=>{const n=new Map,s=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?n.set(t.getSpecIndex(),{value:e,axis:t}):s.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!n.size,type:"rect"},a={visible:!!s.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=sP(3,e,i,n,s,r,a);return o?oP(r,o,d,h):l?lP(a,l,u,c):void 0},fP={fontFamily:$B.fontFamily,spacing:10,wordBreak:"break-word"};function mP(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:fP),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const vP=t=>{var e;const{backgroundColor:i,border:n,shadow:s}=t,r={lineWidth:null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0,shadow:!!s};(null==n?void 0:n.color)&&(r.stroke=n.color),i&&(r.fill=i),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=null!=n?n:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},yP=(t,e)=>p(e)?t.map((t=>e[t])):void 0,_P=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),bP=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function xP(e,i,n){var s,r,a;const o=Object.assign({regionIndex:0},i),l=n.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=SP(e,h),d=null!==(s=o.activeType)&&void 0!==s?s:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),f=h.getLayoutRect(),m=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),y=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>_P(i,n)(t)&&_P(s,r)(t)&&(u(a)||_P([a],[o])(t))));return l},_=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),f.width),y:Math.min(Math.max(t.y,0),f.height)}))(t),s=null!==(e=o.x)&&void 0!==e?e:g.x+n.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+n.y;return{canvasX:s,canvasY:r,clientX:v.x+s,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const s=new Map;c.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>y(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:_({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};n.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return kI.globalConfig.uniqueTooltip&&kI.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const s=Object.assign(Object.assign({},y(i)),e),r=[{datum:[s],series:i.series}],o=[{value:s[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:s,model:i.series,source:t.Event_Source_Type.chart,event:_(i.pos),item:void 0,itemMap:new Map};n.processor.mark.showTooltip({datum:s,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return kI.globalConfig.uniqueTooltip&&kI.hideTooltip(u.id),d}return"none"}const SP=(t,e)=>{const i=e.getSeries(),n=[];return i.forEach((e=>{var i,s,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(s=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=yP(c,t);let y=yP(d,t);const _=bP(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(_P(c,v));if(!_&&(y=yP(d,i),!bP(y)))return;const s=e.type===ck.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(s)||isNaN(s.x)||isNaN(s.y)||n.push({pos:s,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=CS(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",s=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];s.length>0&&s.forEach((([t,i])=>{var n,s,a,o;const l=null!==(o=null===(a=null===(s=null===(n=e.getViewDataStatistics)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var n;const s=null!==(n=null==t?void 0:t.slice())&&void 0!==n?n:[];s[i]=e,h.push(s)}))})),r=h})),r.forEach((s=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(_P(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=yP(d,o),!bP(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:c,dimensionData:s,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(_P(c,s));if(!_&&(y=yP(d,r),!bP(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:c,dimensionData:s,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===ck.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(_P(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=yP(d,i),!bP(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:s},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),n},AP=t=>{var e,i,n;if(!1===(null==t?void 0:t.visible))return[];const s={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(n=null==t?void 0:t.group)||void 0===n?void 0:n.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(s).forEach((e=>{var i;s[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(s).filter((t=>s[t]))};const kP=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null};class wP{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class TP extends wP{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?W(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const n=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[n]},this._getSeriesStyle=(t,e,i)=>{var n;for(const i of W(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let n=this._seriesCacheInfo.dimensionFields;return i[0]&&(n=n.filter((t=>t!==i[0]))),n.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:EP(e.title,{seriesId:this.series.id},!0),content:MP(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=AP(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}}return null}}const CP=(t,e,i)=>{const n=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),n):Object.assign(Object.assign({},n),t)},EP=(t,e,i)=>p(t)?d(t)?(...n)=>CP(t(...n),e,i):CP(t,e,i):void 0,MP=(t,e,i)=>{const n=p(t)?W(t).map((t=>d(t)?(...n)=>W(t(...n)).map((t=>CP(t,e,i))):CP(t,e,i))):void 0;return n},BP=(t,e,i)=>{var n;let s={};switch(t){case"mark":case"group":e&&(s=null!==(n=kP(e,t))&&void 0!==n?n:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=kP(n,"dimension",s);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...W(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}}return s},RP=(t,e,i)=>{var n,s;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=i[t]?P(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=OP(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&AP(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...W(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},OP=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),IP=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},PP=(t,e,i,n,s)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==n?void 0:n[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==n?void 0:n[0],s].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let s;if(s=d(t)?t(e,i):t,n){const{formatFunc:i,args:r}=XI(void 0,n,t,e);i&&r&&(s=i(...r))}return s},DP=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class FP{}FP.dom=`${uk}_TOOLTIP_HANDLER_DOM`,FP.canvas=`${uk}_TOOLTIP_HANDLER_CANVAS`;const jP=20,NP={key:"其他",value:"..."},zP=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const n=Fe.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?n.timeFormat:n.timeUTCFormat)(e,t)},VP=(t,e,i)=>{var n,s,r,a;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const o={title:{},content:[]},l=DP(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:f,hasShape:m,valueFormatter:v}=null!=l?l:{},y=!1!==LP(h,e,i);if(l&&y){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:zP(LP(c,t,i,v),p,g),valueStyle:LP(f,t,i),hasShape:m}}else o.title={hasShape:!1,visible:!1};const _=((t,e,i)=>{if(u(t))return t;let n=[];return W(t).forEach((t=>{d(t)?n=n.concat(W(t(e,i))):n.push(t)})),n})(t.content,e,i),{maxLineCount:b=jP}=t,x=t.othersLine?Object.assign(Object.assign({},NP),t.othersLine):NP,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=_?_:[]){const n=HP(e,t,i);if(!1!==n.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},n),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===n.id)))&&void 0!==a?a:[];for(const n of e){for(const e of t){const t=HP(n,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},HP=(t,e,i)=>{const n=zP(LP(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),s=zP(LP(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==LP(e.visible,t,i)&&(p(n)||p(s)),a=LP(e.isKeyAdaptive,t,i),o=LP(e.spaceRow,t,i),l=LP(e.shapeType,t,i),h=LP(e.shapeColor,t,i),c=LP(e.shapeFill,t,i),d=LP(e.shapeStroke,t,i),u=LP(e.shapeLineWidth,t,i),g=LP(e.shapeHollow,t,i),f=LP(e.keyStyle,t,i),m=LP(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:f,valueStyle:m,spaceRow:o,datum:t}};class GP extends CI{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:n}=i;return n?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,n,s;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(s=null===(n=(i=a.handler).showTooltip)||void 0===n?void 0:n.call(i,h,e,t))&&void 0!==s?s:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var n,s,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,f=null===(n=e.dimensionInfo)||void 0===n?void 0:n[0],m={x:1/0,y:1/0};let{offsetX:v,offsetY:y}=this._option;if(!u)return this._cacheTooltipPosition=void 0,m;const{activeType:_,data:b}=t,x=u[_],k=DP(x.position,b,e),w=null!==(s=DP(x.positionMode,b,e))&&void 0!==s?s:"mark"===_?"mark":"pointer",T=this._getParentElement(u),{width:C=0,height:E=0}=null!=i?i:{},M="canvas"===u.renderMode,B=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),R=null!==(a=null==B?void 0:B.width)&&void 0!==a?a:pk,O=null!==(o=null==B?void 0:B.height)&&void 0!==o?o:gk;let I=!1;const P={width:0,height:0};let L={x:0,y:0},D={x:0,y:0},F=1,j=1;if(Rf(this._env)&&!u.confine){if(P.width=window.innerWidth,P.height=window.innerHeight,!M){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:m;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();L={x:e.x-D.x,y:e.y-D.y},F=GI(t,e),j=GI(T,D)}}else P.width=R,P.height=O;const N=j/F;let z,V,H,G,U=k,W=k;const Y=({orient:t,mode:i,offset:n})=>{var s;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=n?n:v,"mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(s=null==f?void 0:f.axis)||void 0===s?void 0:s.getCoordinateType())){I=!0;const t=gP(e.dimensionInfo,lk(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else U=t;if(I)switch(uP(t)){case"left":z=r-C*N-v;break;case"right":z=a+v;break;case"center":z=(r+a)/2-C*N/2;break;case"centerLeft":z=(r+a)/2-C*N-v;break;case"centerRight":z=(r+a)/2+v}},K=({orient:t,mode:i,offset:n})=>{var s;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(y=null!=n?n:y,"mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(s=null==f?void 0:f.axis)||void 0===s?void 0:s.getCoordinateType())){I=!0;const t=gP(e.dimensionInfo,lk(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else W=t;if(I)switch(pP(t)){case"top":V=r-E*N-y;break;case"bottom":V=a+y;break;case"center":V=(r+a)/2-E*N/2;break;case"centerTop":V=(r+a)/2-E*N-y;break;case"centerBottom":V=(r+a)/2+y}};if(g(k)){if(g(X=k)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:n}=k;z=cP(t,c),V=cP(i,c),H=cP(e,c),G=cP(n,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(k)){const{x:t,y:e}=k;S(t)||d(t)?z=cP(t,c):Y(t),S(e)||d(e)?V=cP(e,c):K(e)}}else p(k)&&(Y({orient:k,mode:w}),K({orient:k,mode:w}));var X;let $,Z;const{canvasX:q,canvasY:J}=c;if(A(z))$=z;else if(A(H))$=R-C*N-H;else{const t=q;switch(uP(U,"right")){case"center":$=t-C*N/2;break;case"left":case"centerLeft":$=t-C*N-v;break;case"right":case"centerRight":$=t+v}}if(A(V))Z=V;else if(A(G))Z=O-E*N-G;else{const t=J;switch(pP(W,"bottom")){case"center":Z=t-E*N/2;break;case"top":case"centerTop":Z=t-E*N-y;break;case"bottom":case"centerBottom":Z=t+y}}$*=F,Z*=F,Rf(this._env)&&($+=L.x,Z+=L.y),$/=j,Z/=j;const{width:Q,height:tt}=P,et=()=>$*j+D.x<0,it=()=>($+C)*j+D.x>Q,nt=()=>Z*j+D.y<0,st=()=>(Z+E)*j+D.y>tt,rt=()=>{et()&&(I?$=-D.x/j:"center"===uP(k,"right")?$+=v+C/2:$+=2*v+C)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(I?$=(Q-D.x)/j-C:"center"===uP(k,"right")?$-=v+C/2:$-=2*v+C)},lt=()=>{it()&&($=(Q-D.x)/j-C)},ht=()=>{nt()&&(I?Z=-D.y/j:"center"===pP(k,"bottom")?Z+=y+E/2:Z+=2*y+E)},ct=()=>{nt()&&(Z=0-D.y/j)},dt=()=>{st()&&(I?Z=(tt-D.y)/j-E:"center"===pP(k,"bottom")?Z-=y+E/2:Z-=2*y+E)},ut=()=>{st()&&(Z=(tt-D.y)/j-E)};switch(uP(k,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(pP(k,"bottom")){case"center":case"centerTop":case"centerBottom":nt()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:Z};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:C,height:E},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},YI),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:YI.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:YI.offsetY})}_getTooltipBoxSize(t,e){var i,n,s;if(!e||u(this._attributes)){const e=null!==(n=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==n?n:{};this._attributes=((t,e,i)=>{var n,s,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,maxContentHeight:y,align:_}=l,b=Ie(d.padding),x=CB(d.padding),S=mP(Object.assign({textAlign:"right"===_?"right":"left"},u),i),A=mP(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=mP(m,i),w={fill:!0,size:null!==(n=null==g?void 0:g.size)&&void 0!==n?n:8,spacing:null!==(s=null==g?void 0:g.spacing)&&void 0!==s?s:6},T={panel:vP(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:w,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:y,enterable:h,transitionDuration:c,align:_},{title:C={},content:E=[]}=t;let M=x.left+x.right,B=x.top+x.bottom,R=x.top+x.bottom,O=0;const I=E.filter((t=>(t.key||t.value)&&!1!==t.visible)),P=!!I.length;let L=0,D=0,F=0,j=0;if(P){const t=[],e=[],i=[],n=[];let s=0;T.content=I.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,C={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=sR({},A,mP(b,void 0,{})),{width:n,height:s,text:r}=UI(h,i);C.key=Object.assign(Object.assign({width:n,height:s},i),{text:r}),y?e.push(n):t.push(n),o=Math.max(o,s)}if(p(m)){const t=sR({},k,mP(x,void 0,{})),{width:e,height:n,text:s}=UI(m,t);C.value=Object.assign(Object.assign({width:e,height:n},t),{text:s}),i.push(e),o=Math.max(o,n)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,C.shape=t;const i=null!=f?f:w.size;o=Math.max(i,o),n.push(i)}else C.shape={visible:!1};return C.height=o,s+=o,aY.autoWidth&&!1!==Y.multiLine;if(H){Y=sR({},S,mP(U,void 0,{})),X()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:P?Math.ceil(O):void 0);const{text:t,width:e,height:i}=UI(G,Y);T.title.value=Object.assign(Object.assign({width:X()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),N=T.title.value.width,z=T.title.value.height,V=z+(P?T.title.spaceRow:0)}return B+=V,R+=V,T.title.width=N,T.title.height=z,X()?M+=O||N:M+=Math.max(N,O),P&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-x.left-x.right-j-L-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=M,T.panel.height=B,T.panelDomHeight=R,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(s=this._attributes)&&void 0!==s?s:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:n,canvasY:s}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(Rf(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,n=null==t?void 0:t.getBoundingClientRect();h={x:n.x-c.x,y:n.y-c.y},d=GI(t,n),u=GI(l,c)}return n*=d,s*=d,Rf(this._env)&&(n+=h.x,s+=h.y),n/=u,s/=u,{x:n,y:s}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:n=0,y:s}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(function(t,e,i){return!e||(i?(de=e.x1,ue=e.x2,pe=e.y1,ge=e.y2,de>ue&&([de,ue]=[ue,de]),pe>ge&&([pe,ge]=[ge,pe]),t.x>=de&&t.x<=ue&&t.y>=pe&&t.y<=ge):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(r,{x1:n,y1:s,x2:n+e,y2:s+i},!1))return!0;const a={x:n,y:s},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Ce([c,a,o],r.x,r.y)||Ce([c,l,h],r.x,r.y)||Ce([c,a,h],r.x,r.y)||Ce([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}GP.specKey="tooltip";const UP=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",WP=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let YP;const KP=(t=document.body)=>{if(u(YP)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),YP=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return YP};function XP(t){var e,i,n;const{panel:s={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:f="left"}=null!=t?t:{},{fill:m,shadow:v,shadowBlur:y,shadowColor:_,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:w=0,width:T=0}=s,{value:C={}}=o,{shape:E={},key:M={},value:B={}}=l,R=function(t,e){if(!t)return;const{size:i}=sR({},e,t),n={};return n.width=UP(i),n}(E),O=$P(M),I=$P(B),{bottom:P,left:L,right:D,top:F}=CB(h),j="right"===f?"marginLeft":"marginRight";return{align:f,panel:{width:UP(T+2*w),minHeight:UP(g+2*w),paddingBottom:UP(P),paddingLeft:UP(L),paddingRight:UP(D),paddingTop:UP(F),borderColor:k,borderWidth:UP(w),borderRadius:UP(A),backgroundColor:m?`${m}`:"transparent",boxShadow:v?`${b}px ${x}px ${y}px ${S}px ${_}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?UP(null==r?void 0:r.spaceRow):"0px"},$P(sR({},C,null==r?void 0:r.value))),content:{},shapeColumn:{common:R,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return ZP.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=ZP.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,n){const s=null==Bf?void 0:Bf.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(ZP.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}ZP.type="tooltipModel";const qP={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},JP={boxSizing:"border-box"},QP={display:"inline-block",verticalAlign:"top"},tL={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},eL={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},iL={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},nL={lineHeight:"normal",boxSizing:"border-box"};class sL extends ZP{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const m=()=>c?e(c):f,v=WP(u),_=t=>new vc({symbolType:t,size:v,fill:!0});let b=_(l);const x=b.getParsedPath();x.path||(b=_(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let w=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,n]=w.split(" ").map((t=>Number(t))),s=Number(p.slice(0,-2));w=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}if(!h||y(h)||d)return f=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){f=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(n=h.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class rL extends ZP{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const aL={overflowWrap:"normal",wordWrap:"normal"};class oL extends ZP{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=J(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=J(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(sR({},QP,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[],o=(t,e)=>{var i,n;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=s,c=sR({},o?eL:tL,Object.assign(Object.assign(Object.assign({height:UP(l)},aL),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return y(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:n}=a[e],{valueColumn:r}=s;return sR({},iL,Object.assign(Object.assign(Object.assign({height:UP(n)},aL),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,n,r,l;const{height:h}=a[e],{shapeColumn:c}=s,d=o(t,e),u=`calc((${null!==(n=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==n?n:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return sR({},nL,Object.assign(Object.assign({height:UP(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=y(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=y(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n;const s=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(n=t.shapeFill)&&void 0!==n?n:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class lL extends ZP{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new oL(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(sR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:n}=this._option.getTooltipAttributes();if(p(n)&&et+WP(e)),0);return Object.assign(Object.assign({},t),{width:`${a+KP(this._option.getContainer())}px`,maxHeight:UP(n),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class hL extends ZP{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new sL(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new rL(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(sR({},qP,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(n=r.shapeColumn.common)||void 0===n?void 0:n.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(s=this.textSpan)||void 0===s||s.setStyle({color:"inherit"})}setContent(){var t,e,i,n,s,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(n=this.textSpan)||void 0===n||n.setContent(null==h?void 0:h.value,null===(r=null===(s=l.title)||void 0===s?void 0:s.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const cL="99999999999999";class dL extends ZP{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:cL,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new hL(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new lL(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(sR({},JP,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const uL=t=>{jR.registerComponentPlugin(t.type,t)};class pL extends GP{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(pL.type),this.type=FP.dom,this._tooltipContainer=null==Bf?void 0:Bf.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Bf&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,n;const{tooltipActual:s,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=s,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=s.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(n=this._cacheCustomTooltipPosition)&&void 0!==n?n:{x:t,y:o}),r.updateElement(a,s,e);const i=this._getActualTooltipPosition(s,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=XP(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),n=t.relatedTarget;"html"===e&&i&&(u(n)||n!==this._compiler.getCanvas()&&!Le(n,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}pL.type=FP.dom;class gL extends GP{constructor(){super(gL.type),this.type=FP.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new sk({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:n}=e,s=n.position;e.changePositionOnly?p(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),s)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}gL.type=FP.canvas;const fL=()=>{uL(gL)},mL=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},vL={min:t=>t.length?X(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?X(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},yL=(t,e)=>{var i,n;let s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return{};s=TR([],s);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(n=(i=t[0]).getFields)||void 0===n?void 0:n.call(i);return _L(a,s,o)},_L=(t,e,i)=>{const n={};let s=[],r=[];return e.forEach((e=>{const a=e.key;n[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;s.length=0,t.forEach((t=>{t&&s.push(t[a])}));const d=s.length;if(h){r.length=0,s.forEach(((t,e)=>{Df(t)&&r.push(t)}));const t=s;s=r,r=t,c=s.length===d}else s=l.some((t=>"array-min"===t||"array-max"===t))?s.reduce(((t,e)=>(e&&e.forEach((e=>{Df(e)&&t.push(e)})),t)),[]):s.filter((t=>void 0!==t));e.filter&&(s=s.filter(e.filter)),l.forEach((t=>{if(e.customize)n[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(n[a][t]=o.domain.slice())}else if("allValid"===t)return;n[a][t]=vL[t](s),"array-max"===t&&(n[a].max=n[a][t]),"array-min"===t&&(n[a].min=n[a][t])}})),h&&(n[a].allValid=c)})),n},bL=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||s&&s.length&&t.forEach((t=>{s.forEach((e=>{Df(t[e])||(t[e]=0)}))})),t};class xL extends aI{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}function SL(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function AL(t,e,i){t&&(i.needDefaultSeriesField&&(t[ZE]=i.defaultSeriesField),t[XE]=e,t[$E]=i.getKey(t,e,i))}const kL=["appear","enter","update","exit","disappear","normal"];function wL(t={},e,i){const n={};for(let s=0;s{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var n;let s=t;return BL(s)&&delete s.type,s.oneByOne&&(s=CL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:EL,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=sR({},o[e],a);return BL(s)&&delete s.type,s.oneByOne&&(s=CL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:EL,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n.state=n.update,n}function TL(t,e,i){var n,s,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(n=e.animationAppear[t])&&void 0!==n?n:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(s=e.animationDisappear[t])&&void 0!==s?s:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=P(t),RL(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function CL(t,e,i){const{oneByOne:n,duration:s,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(s)?s(t,i,a):A(s)?s:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(n)?n(t,i,a):n;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(s)?s(t,r,o):A(s)?s:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(n)?n(t,r,o):n;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function EL(t,e){var i,n;return null!==(i=null==t?void 0:t[XE])&&void 0!==i?i:null===(n=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===n?void 0:n.elementIndex}function ML(t,e){var i,n,s,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(s=null===(n=t.animationAppear)||void 0===n?void 0:n[e])&&void 0!==s?s:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function BL(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function RL(t,e){if(_(t))t.forEach(((i,n)=>{t[n]=e(t[n],n),RL(t[n],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),RL(t[i],e)}function OL(t){var e,i,n,s;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(s=null===(n=t.getRawData())||void 0===n?void 0:n.latestData)||void 0===s?void 0:s.length)>=a)}class IL extends GO{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=W(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,n,s;const r=oB(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=lR(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return sR({},c,d,(null!==(s=null!==(n=this.stack)&&void 0!==n?n:null==d?void 0:d.stack)&&void 0!==s?s:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s,r){if(!t)return;W(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=s?s:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[n])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:n,innerRadius:s,direction:r}=t;return p(n)&&(i.outerRadius=n),p(s)&&(i.innerRadius=s),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>{const e=sR({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>sR({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}class PL extends UO{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${uk}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=IL,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=OL(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(cO(this._rawData.dataSet,"invalidTravel",bL),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,n;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=mO(s,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(n=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===n||n.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=fO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=fO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new xL(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(n=this._rawData.getFields())||void 0===n?void 0:n[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=X(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=_L(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(s=this._rawStatisticsCache[t])&&void 0!==s?s:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){cO(this._dataSet,"dimensionStatistics",yL);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new mi(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&TR(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){cO(this._dataSet,"dimensionStatistics",yL);const n=new mi(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=TR(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&TR(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new mi(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:n}=i,s=this._getSeriesDataKey(t);return void 0===n.get(s)?(n.set(s,0),s):(n.set(s,n.get(s)+1),`${s}_${n.get(s)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(cO(this._rawData.dataSet,"addVChartProperty",mL),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:SL.bind(this),call:AL}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,n,s){var r;const a=this._createMark({type:t.type,name:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:s.depend,key:t.dataKey});if(a){if(s.hasAnimation){const e=wL({},TL(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${n}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,s)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(n=this._option.mode)===t.RenderModeEnum["desktop-browser"]||n===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Of(n)||If(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var n;let s=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?s.enable=a:g(a)&&(s.enable=!0,s=sR(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=sR(r,o));const l=[];if(s.enable){const t=this._parseSelectorOfInteraction(s,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:s.trigger,triggerOff:s.triggerOff,blurState:SO.STATE_HOVER_REVERSE,highlightState:SO.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,n=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:n,reverseState:SO.STATE_SELECTED_REVERSE,state:SO.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,n=this._parseDefaultInteractionConfig(t);n&&n.length&&n.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const n=null!==(e=this._seriesField)&&void 0!==e?e:ZE;this.getMarksWithoutRoot().forEach((e=>{const s={},r={},a={};i.forEach((t=>{var i;const n=null===(i=t[e.name])||void 0===i?void 0:i.style;n&&(s[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(n).forEach((e=>{r[e]=!0,a[t.name][e]=n[e]})))})),e.state.addStateInfo({stateValue:qE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][n]]:!0===s[t[n]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var s,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(s=a[i[0][n]])||void 0===s?void 0:s[t]}return o=null===(r=a[i[n]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,qE,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,n;(null===(n=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new TP(this)}_compareSpec(t,e,i){var n,s;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return H(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},AM),kM),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(W(t.extensionMark).length!==W(e.extensionMark).length||(null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((n=>{var s,r;return i[n.name]=!0,(null===(s=e[n.name])||void 0===s?void 0:s.visible)!==(null===(r=t[n.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>kM[i]&&!H(t[i],e[i])))&&(r.reCompile=!0),a.some((n=>!i[n]&&!H(t[n],e[n])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof mi||vO(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();OL(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const n=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));n>=0&&this._rawData.transformsArr.splice(n,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:ZE,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new yB).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return cB(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:ZE}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,n,s,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:f,parent:m,isSeriesMark:v,depend:y,progressive:_,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:w=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:w});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(m)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==m&&m.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,f),c(l)&&T.setSkipBeforeLayouted(l),p(y)&&T.setDepend(...W(y));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(n=a.morph)||void 0===n?void 0:n.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(s=a.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(_)||T.setProgressiveConfig(_),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,sR({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:$E}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const n=this.getSeriesField();return n&&!i.includes(n)&&(e+=`_${t[n]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==eM&&t!==nM&&t!==tM&&t!==iM||(t=this.getStackValueField()),null!==(e=ER(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=aB[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Df(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),n=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=n?n:[]}_forEachStackGroup(t,e){var i,n;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(n=e.values)||void 0===n?void 0:n.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:ZE]}}function LL(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();wS(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n.index(t[e])-n.index(i[e]))*(s?-1:1)))}function DL(t){return{dataIndex:e=>{var i,n;const s="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[s],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(n=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==n?n:[]).indexOf(r)||0},dataCount:()=>{var e,i,n;const s="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(n=(null!==(i=null===(e=null==s?void 0:s.domain)||void 0===e?void 0:e.call(s))&&void 0!==i?i:[]).length)&&void 0!==n?n:0}}}PL.mark=yM,PL.transformerConstructor=IL;class FL extends PL{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=W(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=W(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&W(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const n={key:i,operations:[]},s=e.axisHelper.getScale(0);wS(s.type)?(n.operations=["max","min"],"log"===s.type&&(n.filter=t=>t>0)):n.operations=["values"],t.push(n)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${uk}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?W(this._spec.xField)[0]:W(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(eM),this.setFieldX2(tM)):(this.setFieldY(eM),this.setFieldY2(tM))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(nM),this.setFieldX2(iM)):(this.setFieldY(nM),this.setFieldY2(iM))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(rM),this.setFieldX2(sM)):(this.setFieldY(rM),this.setFieldY2(sM))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=W(this._spec.xField),this._specYField=W(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(W(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,n,s,r){const a=s();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,n);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(W(this.getDatumPositionValues(t,o)),this._scaleConfig)))),s()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(LL("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const jL="monotone";class NL{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],n=this._fieldY,s=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:n[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,n;return this._lineMark=this._createMark(CM.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(n=this._spec.line)||void 0===n?void 0:n.stateSort}),this._lineMark}initLineMarkStyle(e,i){var n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:"linear",closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,o=a===jL?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(CM.point,{morph:ML(this._spec,CM.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new mi(this._option.dataSet,{name:`${uk}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(sO.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const n in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][n]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:SO.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[CM.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(sO.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,sR({},this._spec[CM.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:SO.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var n,s,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(s=null===(n=e.stateStyle.normal)||void 0===n?void 0:n[i])||void 0===s?void 0:s.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class zL extends hI{setStyle(t,e="normal",i=0,n=this.stateStyle){if(u(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||s.includes(l))return;a&&r.includes(l)&&(TS(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,n);this.setAttribute(l,c,e,i,n)})),o&&this.setEnableSegments(o)}}class VL extends zL{constructor(){super(...arguments),this.type=VL.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===ck.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}VL.type="line";const HL=()=>{jR.registerMark(VL.type,VL),wb(),fb(),Tw.registerGraphic(Ik.line,xc),_I()};class GL extends hI{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class UL extends GL{constructor(){super(...arguments),this.type=UL.type}}UL.type="symbol";const WL=()=>{jR.registerMark(UL.type,UL),wb(),Cb(),Tw.registerGraphic(Ik.symbol,yc)};class YL extends IL{_transformLabelSpec(t){var e,i,n;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class KL extends SI{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function XL(t,e,i,n){switch(t){case r.cartesianBandAxis:return QI(KR(i,["z"]),"band",e);case r.cartesianLinearAxis:return QI(KR(i,["z"]),"linear",e);case r.cartesianLogAxis:return QI(KR(i,["z"]),"log",e);case r.cartesianSymlogAxis:return QI(KR(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return QI(KR(i),void 0,e);case r.polarBandAxis:return tP(i.orient,"band",e);case r.polarLinearAxis:return tP(i.orient,"linear",e);case r.polarAxis:return tP(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=W(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(n=KI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>UR(t.orient)));let d;d=p(c)?sR({},eP(c.type)?a:o,l):l;const u=s.find((t=>WR(t.orient)));let g;return g=p(u)?sR({},CS(u.type)?a:o,h):h,{xField:d,yField:g}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=W(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(n=KI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>"angle"===t.orient));let d;d=p(c)?sR({},eP(c.type)?a:o,l):l;const u=s.find((t=>"radius"===t.orient));let g;return g=p(u)?sR({},CS(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,n);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return $L(i,KI(t,e));default:return KI(t,e)}}const $L=(t,e)=>{var i;const n=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],s=sR({},e,n);return delete s.horizontal,delete s.vertical,s};class ZL extends GO{getTheme(t,e){return XL(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},CB(e)),{[n]:0}))}}class qL extends YO{static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]);return new this(n,Object.assign(Object.assign({},i),s))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new KL(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=ZL,this._delegateEvent=(e,i,n,s=null,r=null)=>{var a,o;i instanceof ia||this.event.emit(n,{model:this,node:e,event:i,item:s,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new HO({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!H(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}qL.transformerConstructor=ZL;class JL extends hI{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(Ik.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}JL.type="component";const QL=()=>{jR.registerMark(JL.type,JL)},tD=t=>t;class eD extends qL{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return W(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,n,s,r,a,o,l,h,d,u,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Fk.circleAxisGrid:Fk.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(s=null===(n=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===n?void 0:n.zIndex)&&void 0!==s?s:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wL(null===(o=jR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new aI(this._option,t)]}collectData(t,e){const i=[];return ok(this._regions,(n=>{var s;let r=this.collectSeriesField(t,n);if(r=_(r)?wS(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=n.getFieldAlias(r[0])),r){const t=n.getViewData();if(e)r.forEach((t=>{i.push(n.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(s=n.getViewDataStatistics)||void 0===s?void 0:s.call(n);r.forEach((e=>{var n;(null===(n=null==t?void 0:t.latestData)||void 0===n?void 0:n[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return ok(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;p(t)&&(this._seriesUserId=W(t)),p(i)&&(this._regionUserId=W(i)),p(e)&&(this._seriesIndex=W(e)),p(n)&&(this._regionIndex=W(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),ok(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&H(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(ok(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;t{var n,s;return(null===(n=null==e?void 0:e[i])||void 0===n?void 0:n.visible)!==(null===(s=null==t?void 0:t[i])||void 0===s?void 0:s.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var n;if(t.domainLine&&t.domainLine.visible?i.line=((n=LR(n=t.domainLine)).startSymbol=LR(n.startSymbol),n.endSymbol=LR(n.endSymbol),n):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,n,s)=>{var r;const a=t.label.style(e.rawValue,i,e,n,s);return FR(sR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:FR(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,n,s,r)=>FR(t[i](e.rawValue,n,e,s,r)):B(t[i])||(e[i]=FR(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,n,s)=>{var r;const a=t.tick.style(e,i,n,s);return FR(sR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:FR(t.tick.style)),t.tick.state&&(i.tick.state=DR(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,n,s)=>{var r;const a=t.subTick.style(e,i,n,s);return FR(sR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:FR(t.subTick.style)),t.subTick.state&&(i.subTick.state=DR(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const n=t.title,{autoRotate:s,angle:r,style:a={},background:o,state:l,shape:h}=n,c=e(n,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||s&&u(p)&&(p="left"===t.orient?-90:90,d=$I[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Gt(p):null,textStyle:sR({},d,FR(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:FR(h.style)}),h.state&&(i.title.state.shape=DR(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:FR(o.style)}),o.state&&(i.title.state.background=DR(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=DR(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=FR(t.background.style)),t.background.state&&(i.panel.state=DR(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var n,s;const r=t.grid.style(null===(n=e.datum)||void 0===n?void 0:n.rawValue,i,e.datum);return FR(sR({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:FR(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:FR(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=XI(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){dO(this._option.dataSet,"scale",tD),cO(this._option.dataSet,"ticks",PA);return new mi(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:n,tickStep:s,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:n,tickStep:s,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var n;null===(n=null==i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}eD.specKey="axes";const iD=()=>{Tw.registerGraphicComponent(Dk.lineAxis,((t,e)=>new vS(t,e))),Tw.registerGraphicComponent(Dk.circleAxis,(t=>new xS(t))),Tw.registerComponent(Pk.axis,mC),Tw.registerGraphicComponent(Fk.lineAxisGrid,((t,e)=>new jA(t,e))),Tw.registerGraphicComponent(Fk.circleAxisGrid,((t,e)=>new zA(t,e))),Tw.registerComponent(Pk.grid,yC),QL(),jR.registerAnimation("axis",(()=>({appear:{custom:AS},update:{custom:SS},exit:{custom:Ha}})))},nD=[HI];class sD extends eD{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,n){super(i,n),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),ok(this._regions,(t=>{const e=this.getOrient();UR(e)?t.setXAxisHelper(this.axisHelper()):WR(e)?t.setYAxisHelper(this.axisHelper()):YR(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:n}=i,s=e(i,["grid"]),r=this._axisMark.getProduct(),a=sR({x:t.x,y:t.y},this._axisStyle,s);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(sR({x:t.x,y:t.y},this._getGridAttributes(),n))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=UR(this.getOrient()),s=t=>{var e;return(n?!UR(t.getOrient()):UR(t.getOrient()))&&wS(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>s(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=KR(i,["z"]),YR(this._orient)&&(this.layoutType="absolute"),this._dataSet=n.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!JI(e))return null;const{axisType:t,componentName:n}=XR(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:n}]}const n=e.filter((t=>"z"===t.orient))[0];let s=!0;if(n){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>WR(t.orient)))[0];s=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));s||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!JI(t))return;const{axisType:n,componentName:s}=XR(t,i);t.type=n,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:s})})),a}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]),r=jR.getComponentInKey(s.type);return r?new r(n,Object.assign(Object.assign({},i),s)):(i.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:n,right:s,top:r,bottom:a}=this._innerOffset;let o=[];UR(this.getOrient())?A(e)&&(o=this._inverse?[e-s,n]:[n,e-s]):YR(this.getOrient())?A(e)&&(o=this._inverse?[e-s,n]:[n,e-s],this._scale.range(o)):A(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(nD.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){UR(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!UR(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!YR(this.getOrient())&&this._spec.innerOffset){const t=this._spec;WR(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=wB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=wB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=UR(this.getOrient())?t.fieldX:YR(this.getOrient())?t.fieldZ:t.fieldY,wS(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:wS(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(UR(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=UR(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:X(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return ok(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,n;let s;return s=t>0?null===(n=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===n?void 0:n[t]:UR(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:YR(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();ok(this._regions,(e=>{UR(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):WR(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):YR(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=UR(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const n={skipLayout:!1},s=UR(this.getOrient());this.pluginService&&(s?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),n=sR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(n);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,s))}return i}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return iP(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=qI(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(X(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=rD?10:s>=aD?5:s>=oD?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const n=this._scale.domain();if(this.extendDomain(n),this.includeZero(n),this.setDomainMinMax(n),this.niceDomain(n),this._scale.domain(n,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,n=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*n)/n:t}}class hD extends sD{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new fA}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}hD.type=r.cartesianLinearAxis,hD.specKey="axes",U(hD,lD);const cD=()=>{iD(),jR.registerComponent(hD.type,hD)};class dD extends sD{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new XS}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=NS(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:n,bandSizeLevel:s=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};s=Math.min(s,this._scales.length-1);for(let t=s;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===s?a:0;if(u(r)||t1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((n,s)=>{var r;const a=this._tickDataMap[s],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):n.domain();if(l&&l.length)if(i&&i.length){const n=[],s=[];i.forEach((e=>{l.forEach((i=>{const r=W(e).concat(i);if(s.push(r),o){const e=iP(i,this._getNormalizedValue(r,t));n.push(e)}}))})),o&&e.push(n.filter((t=>t.value>=0&&t.value<=1))),i=s}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>iP(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}});const uD=()=>{iD(),jR.registerComponent(dD.type,dD)};class pD extends hD{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),ok(this._regions,(t=>{UR(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=sR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new mi(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new aI(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,n,s,r,a,o;const l=Fe.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(n=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===n?void 0:n.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(s=this._spec.layers)||void 0===s?void 0:s[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const n=[],s=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();s&&s.length&&n.push(s.map((e=>iP(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&n.push(r.map((e=>iP(e.value,this._getNormalizedValue([e.value],t))))),n}transformScaleDomain(){}}pD.type=r.cartesianTimeAxis,pD.specKey="axes";class gD extends hD{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new yA}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}gD.type=r.cartesianLogAxis,gD.specKey="axes",U(gD,lD);class fD extends hD{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new _A}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}fD.type=r.cartesianSymlogAxis,fD.specKey="axes",U(fD,lD);class mD extends FL{constructor(){super(...arguments),this.type=ck.line,this.transformerConstructor=YL,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(wL(null===(i=jR.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),TL("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=DL(this);this._symbolMark.setAnimationConfig(wL(null===(n=jR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),TL("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}mD.type=ck.line,mD.mark=EM,mD.transformerConstructor=YL,U(mD,NL);class vD{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=W(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{vO(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof mi)return;const n=this.getSeriesData(t.id,i);n&&e(t,n,i)}))}getSeriesData(t,e){var i,n;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(n=this._onError)||void 0===n||n.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class yD{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{Ff(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{TR(e,[{key:t,operations:wS(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&TR(e,[{key:i.field,operations:wS(s.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?bB("colorOrdinal"):bB(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Ff(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(H(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!H(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Ff(n.domain)?e.reRender=!0:H(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Ff(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=wS(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=wS(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,n);e&&(n?(u(s[0])?s[0]=e.min:s[0]=Math.min(e.min,s[0]),u(s[1])?s[1]=e.max:s[1]=Math.max(e.max,s[1])):e.values.forEach((t=>{s.add(t)})))}))}));const r=s;wS(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(wS(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=wS(e.type),r=n.getRawDataStatisticsByField(t.field,s);if(!B(r))return"expand"===t.changeDomain?(s?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(s?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));wS(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:s})),s}}class _D{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const n=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),s=n||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=MR(t,!0);for(const e in a)for(const i in a[e].nodes)IR(a[e].nodes[i],t.getStackInverse(),s);if(r)for(const t in a)for(const e in a[t].nodes)OR(a[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&RR(a[i],n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class bD extends FO{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,n,s,r;super(e),this.type="chart",this.id=Lf(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pk,height:gk},this._viewRect={width:pk,height:gk},this._viewBox={x1:0,y1:0,x2:pk,y2:gk},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>W(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=CB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new aO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new vD(this._dataSet,null===(n=this._option)||void 0===n?void 0:n.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new _D(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=N(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=jR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]),r=new t(n,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]);let r;if(p(n.regionId)?r=this.getRegionsInUserId(n.regionId):p(n.regionIndex)&&(r=this.getRegionsInIndex([n.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(n,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:n.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var n;if((null!==(n=i.specKey)&&void 0!==n?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let n=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(n=!0);const s=jR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:n?"layout3d":"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,n,s,r;if(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===n||n.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===r||r.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof UO)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const n=this.getComponentByUserId(t);return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof hI))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof hI)return e}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&(s.markRunning(),s.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){W(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),W(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&vO(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=EO(this._spec,this._option,{width:pk,height:gk})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const n=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=cB(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new yD(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){MO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=cB(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),n=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(n))return e.reMake=!0,e;for(let n=0;n{MO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n,s;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(n=this._spec[a])&&void 0!==n?n:{};_(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,MO(t,i.updateSpec(null!==(s=o[i.getSpecIndex()])&&void 0!==s?s:{},o))):MO(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];MO(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:n=0,x2:s,y2:r}=e;i={width:s-t,height:r-n}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=TB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(B(t[n]))continue;const s=t[n];let r={stateValue:n};r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(SO.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(SO.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(SO.STATE_SELECTED)}clearHovered(){this.clearState(SO.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?W(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||d(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=i.slice();o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.startInteraction(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===sO.dimensionHover||n===sO.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>CS(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{var e,s,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(s=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===s?void 0:s[o])&&void 0!==a?a:n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const xD=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=W(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return W(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class SD{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,n)=>{const{spec:s,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(s,t,n);QB(t,r,l.spec),QB(n,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,n;e||(e=(e,i,n)=>{const{spec:s,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));QB(n,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(s,t)}))});const s={};return this.forEachRegionInSpec(t,e,s),this.forEachSeriesInSpec(t,e,s),null===(i=s.series)||void 0===i||i.forEach(((t,e)=>{var i,n;const r=(null!==(n=null!==(i=xD(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,s),Object.values(null!==(n=s.component)&&void 0!==n?n:{}).forEach((t=>t.forEach(((t,e)=>{var i,n,r;if(t){if(!t.regionIndexes){const e=null!==(n=null!==(i=xD(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const n=t.spec,{seriesId:s,seriesIndex:r}=n;if(p(s)){const t=W(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return W(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,s);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,n;const r=null===(i=s.region)||void 0===i?void 0:i[t];null===(n=null==r?void 0:r.seriesIndexes)||void 0===n||n.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),s}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,n,s;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(s=(n=this._option).getTheme)||void 0===s?void 0:s.call(n).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var n;return(null!==(n=t.region)&&void 0!==n?n:[]).map(((t,n)=>e(jR.getRegionInType("region"),{spec:t,specPath:["region",n],type:"region",regionIndexes:[n]},i)))}forEachSeriesInSpec(t,e,i){var n;return(null!==(n=t.series)&&void 0!==n?n:[]).map(((t,n)=>e(jR.getSeriesInType(t.type),{spec:t,specPath:["series",n],type:t.type,seriesIndexes:[n]},i)))}forEachComponentInSpec(t,e,i){var n,s,a;const o=[],l=jR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=jR.getComponentInKey(t.type);o.push(e(n,t,i))})))}if(c&&!g){const n=c.getSpecInfo(t,i);(null==n?void 0:n.length)>0&&(g=!0,n.forEach((t=>{const n=jR.getComponentInKey(t.type);o.push(e(n,t,i))})))}return d&&!g&&(null===(s=d.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((n=>{var s;null===(s=n.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(n,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const n="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],s=i.find((i=>{if(!n.includes(i.orient))return!1;if(p(i.seriesId)){if(W(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(W(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return s}_applyAxisBandSize(t,e,i){const{barMaxWidth:n,barMinWidth:s,barWidth:r,barGapInGroup:a}=i;let o=!1;S(s)?(t.minBandSize=s,o=!0):S(r)?(t.minBandSize=r,o=!0):S(n)&&(t.minBandSize=n,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class AD extends SD{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:n}=i;"top"!==n&&"bottom"!==n||(e.x=!0),"left"!==n&&"right"!==n||(e.y=!0),"z"===n&&(e.z=!0),R(i,"trimPadding")&&sR(i,BO(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class kD extends AD{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),CO(t)}}class wD extends bD{constructor(){super(...arguments),this.transformerConstructor=kD,this.type="line",this.seriesType=ck.line,this._canStack=!0}}wD.type="line",wD.seriesType=ck.line,wD.transformerConstructor=kD;function TD(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const CD=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TD(t,e)}),ED=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TD(t,e)}),MD={type:"fadeIn"},BD={type:"growCenterIn"};function RD(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MD;case"scaleIn":return BD;default:return CD(t)}}class OD extends hI{constructor(){super(...arguments),this.type=OD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}OD.type="rect";const ID=()=>{jR.registerMark(OD.type,OD),wb(),xb(),Tw.registerGraphic(Ik.rect,kc),pC.useRegisters([yE,_E,bE,xE,mE,vE])};function PD(t,e,i){var n,s;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_M]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):xB(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bM]):xB(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[xM]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):xB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[SM]):xB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},FD.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:ML(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FD.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const n=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let s;if(cO(this._option.dataSet,"addVChartProperty",mL),n){const t=([t],{scaleDepth:e})=>{var i,n;let s=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[n,s]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[n]}-${t[s]}`;r[e]||(r[e]={[n]:t[n],[s]:t[s]},i.push(r[e]))})),i};cO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();s=new mi(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:SL.bind(this),call:AL}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new xL(this._option,s)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,s,r,a;e._bar_series_position_calculated=!0,t?(i=SM,n=xM,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=bM,n=_M,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=MR(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PD(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:s,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,n;let s,r,a;e?(s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(n=(i=this[a]).getScale)||void 0===n?void 0:n.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=xB(this[s](t),o),d=xB(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,n;if(!this._spec.stackCornerRadius)return;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,n=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[tM],s=t[eM],r=t[iM],h=t[nM];i=Math.min(i,e,s),n=Math.max(n,e,s),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[tM]:i,[eM]:n}),a?{[iM]:o,[nM]:l}:void 0);t.push(kc(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,s),x1:this._getBarXEnd(h,s),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,n,s;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>xB(this._dataToPosY(t),a),y1:t=>xB(this._dataToPosY1(t),a)}:{y:t=>xB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>xB(this._dataToPosX(t),r),x1:t=>xB(this._dataToPosX1(t),r)}:{x:t=>xB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,n,s,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,s=DL(this);this._barMark.setAnimationConfig(wL(null===(e=jR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),TL(this._barMarkName,this._spec,this._markAttributeContext),s))}_getBarWidth(t,e){var i,n;const s=this._groups?this._groups.fields.length:1,r=u(e)?s:Math.min(s,e),a=null!==(n=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==n?n:6,o=void 0!==this._spec.barWidth&&r===s,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=MB(this._spec.barWidth,a)),l&&(c=Math.max(c,MB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,MB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,n){var s,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===n?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===n?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(s=h.getBandwidth)||void 0===s?void 0:s.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=W(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=MB(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(n+=u*y+(u-1)*p,s+=g*(y+p)):(s+=g*(n+p),n+=n+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-n/2+s}const _=wS(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],n=this._fieldY,s=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:n[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._barBackgroundViewData)||void 0===n||n.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}FD.type=ck.bar,FD.mark=wM,FD.transformerConstructor=DD;const jD=()=>{IC(),ID(),jR.registerAnimation("bar",((t,e)=>({appear:RD(t,e),enter:CD(t,!1),exit:ED(t,!1),disappear:ED(t)}))),uD(),cD(),jR.registerSeries(FD.type,FD)};class ND extends AD{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),CO(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const n=t.series.some((t=>"horizontal"===t.direction)),s=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(n?["left","right"]:["top","bottom"]).includes(t.orient)));if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(s,e,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class zD extends bD{constructor(){super(...arguments),this.transformerConstructor=ND,this.type="bar",this.seriesType=ck.bar,this._canStack=!0}}zD.type="bar",zD.seriesType=ck.bar,zD.transformerConstructor=ND;class VD extends zL{constructor(){super(...arguments),this.type=VD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}VD.type="area";const HD=()=>{jR.registerMark(VD.type,VD),wb(),hb(),Tw.registerGraphic(Ik.area,zc),_I()};class GD extends TP{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of W(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const UD=()=>{jR.registerAnimation("area",vI),yI(),mI()};class WD extends YL{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,n;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(n=l.style)||void 0===n?void 0:n.visible),u=!1!==h.visible&&!1!==(null===(s=h.style)||void 0===s?void 0:s.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=sR({},f.style,g.style),l.state=sR({},f.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class YD extends FL{constructor(){super(...arguments),this.type=ck.area,this.transformerConstructor=WD,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},n=this._spec.area||{},s=!1!==n.visible&&!1!==(null===(t=n.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(YD.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:s&&"point"!==r,customShape:n.customShape,stateSort:n.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,n,s,r;const a=null!==(n=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==n?n:null===(r=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.curveType,o=a===jL?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return xB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return xB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(wL(null===(e=jR.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),TL("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wL(null===(i=jR.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),TL("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=DL(this);this._symbolMark.setAnimationConfig(wL(null===(n=jR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),TL("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new GD(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,s,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}YD.type=ck.area,YD.mark=BM,YD.transformerConstructor=WD,U(YD,NL);class KD extends AD{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),CO(t)}}class XD extends bD{constructor(){super(...arguments),this.transformerConstructor=KD,this.type="area",this.seriesType=ck.area,this._canStack=!0}}XD.type="area",XD.seriesType=ck.area,XD.transformerConstructor=KD;class $D extends PL{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?W(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?W(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=W(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(W(t)),n=this.radiusAxisHelper.dataToPosition(W(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};wS(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};wS(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&LL(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const ZD=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{asStartAngle:n,asEndAngle:s,asMiddleAngle:r,asRadian:a,asRatio:o,asQuadrant:l,asK:h}=e,c=e.angleField(),d=e.startAngle(),u=e.endAngle(),p=e.minAngle(),g=(t,e,i)=>{t[n]=e,t[s]=e+i,t[r]=e+i/2,t[a]=i,t[l]=function(t){return(t=Kt(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let f=0,m=-1/0;for(let t=0;tNumber(t[c]))),_=u-d;let b=d,x=_,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const n=Math.pow(10,e),s=t.map((t=>(isNaN(t)?0:t)/i*n*100)),r=100*n,a=s.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=s.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/n))}(y);if(i.forEach(((t,e)=>{const i=t[xk],n=f?i/f:0;let s=n*_;s{g(e,d+i*t,t)}))}else{const t=x/S;b=d,i.forEach((e=>{const i=e[a]===p?p:e[xk]*t;g(e,b,i),b+=i}))}return 0!==f&&(i[i.length-1][s]=u),i};function qD(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const JD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qD(t,!0,bO.appear)}),QD={type:"fadeIn"},tF=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qD(t,!0,bO.enter)}),eF=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qD(t,!0,bO.exit)}),iF=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qD(t,!0,bO.exit)});function nF(t,e){if(!1===e)return{};switch(e){case"fadeIn":return QD;case"growRadius":return JD(Object.assign(Object.assign({},t),{growField:"radius"}));default:return JD(Object.assign(Object.assign({},t),{growField:"angle"}))}}class sF extends hI{constructor(t,e){super(t,e),this.type=rF.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this.getAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>Wt({x:0,y:0},this.getAttribute("centerOffset",e,i,n),e[Tk])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class rF extends sF{constructor(){super(...arguments),this.type=rF.type}}rF.type="arc";const aF=()=>{wb(),ob(),Tw.registerGraphic(Ik.arc,Gc),pC.useRegisters([BE,RE,EE,ME]),jR.registerMark(rF.type,rF)};class oF extends IL{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);n=sR({},this._theme,i,t);const s=(t,e)=>sR({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(n.label)?n.label=n.label.map((t=>s(t.position,t))):n.label=s(n.label.position,n.label)}return{spec:n,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:n,centerY:s}=t;return p(n)&&(i.centerX=n),p(s)&&(i.centerY=s),Object.keys(i).length>0?i:void 0}}class lF extends $D{constructor(){super(...arguments),this.transformerConstructor=oF,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e,i,n;const{width:s,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:s/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:r/2}},this._startAngle=Mk,this._endAngle=Bk,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[Tk];if(u(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return Wt(this.computeCenter(t),(i+n)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,n=2*Math.PI;const s=p(t),r=p(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(p(this._spec.startAngle)?Gt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Gt(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?Gt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;cO(this._dataSet,"pie",ZD),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Gt(this._spec.minAngle):0,asStartAngle:Ak,asEndAngle:kk,asRatio:Sk,asMiddleAngle:Tk,asRadian:Ek,asQuadrant:Ck,asK:wk}},!1);const e=new mi(this._dataSet,{name:`${uk}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new xL(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},lF.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:ML(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:$E,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return hk(Ak)(t)}endAngleScale(t){return hk(kk)(t)}_computeLayoutRadius(){return((t,e,i,n=0,s=0*Math.PI)=>{if(S(t))return t;if(d(t))return t(e(),i());const r=e();return"auto"===t&&r.width>0&&r.height>0?Xt(r,i(),n,s):Math.min(r.width/2,r.height/2)})(this._spec.layoutRadius,this.getLayoutRect,this.getCenter,this._startAngle,this._endAngle)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:SB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:SB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,n){if(super.initMarkStyleWithSpec(e,i,n),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const n in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[n]),n,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:hk(yk).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const n=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];n.forEach((t=>{i[t]=!0}));const s=super._compareSpec(t,e,i);return t=null!=t?t:{},n.some((i=>t[i]!==e[i]))&&(s.reRender=!0,s.change=!0),s}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Tk];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return Wt(this.computeCenter(t),n,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n;if(i===bO.appear)return this._startAngle;if(i===bO.disappear)return this._endAngle;const s=[bO.disappear,bO.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[XE];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[XE]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[XE])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[XE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Wt({x:0,y:0},a,e[Tk]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Wt({x:0,y:0},a,e[Tk]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Wt({x:0,y:0},a,e[Tk]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Wt({x:0,y:0},a,e[Tk]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}lF.transformerConstructor=oF,lF.mark=OM;class hF extends lF{constructor(){super(...arguments),this.type=ck.pie}}hF.type=ck.pie;const cF=()=>{aF(),jR.registerAnimation("pie",((t,e)=>({appear:nF(t,e),enter:tF(t),exit:eF(t),disappear:iF(t)}))),jR.registerSeries(hF.type,hF)};class dF extends SD{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=W(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return p(r)&&s.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),s}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class uF extends dF{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,layoutRadius:t.layoutRadius})}}class pF extends bD{constructor(){super(...arguments),this.transformerConstructor=uF}}pF.transformerConstructor=uF;class gF extends pF{constructor(){super(...arguments),this.transformerConstructor=uF,this.type="pie",this.seriesType=ck.pie}}gF.type="pie",gF.seriesType=ck.pie,gF.transformerConstructor=uF;class fF extends SD{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var n;if("bar"===e.type){const s=this._findBandAxisBySeries(e,i,t.axes);if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize){const t=g(e.autoBandSize)&&null!==(n=e.autoBandSize.extend)&&void 0!==n?n:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(s,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&sR(e,BO(this.type,t))})),this._transformAxisSpec(t)}}class mF extends bD{constructor(){super(...arguments),this.transformerConstructor=fF,this.type="common",this._canStack=!0}}mF.type="common",mF.transformerConstructor=fF;const vF={rect:SF,symbol:bF,arc:kF,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=bF(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:function(t,e,i){const n=t.series,s=t.labelSpec||{},r=n.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=s.position||"withChange",o=s.offset||0,l=e?e(r.data):r.data,h=yF(t,l,s.formatMethod);return h.x=function(t,e,i,n){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-n:e.totalPositionX(t,"end")+(t.end>=t.start?n:-n);return e.totalPositionX(t,"index",.5)}(l,n,a,o),h.y=function(t,e,i,n){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-n;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+n;return e.totalPositionY(t,"end")+(t.end>=t.start?-n:n)}(l,n,a,o),"horizontal"===n.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),ph(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const s=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[n.getDimensionField()[0]])}));s&&(s.data=i,e.push(s))})),e},overlap:{strategy:[]}}},line:wF,area:wF,rect3d:SF,arc3d:kF,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function yF(t,e,i,n){var s;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(s=t.labelSpec.textType)&&void 0!==s?s:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=XI(i,n,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function _F(t){return d(t)?e=>t(e.data):t}function bF(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=_F(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:xF(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function xF(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function SF(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=_F(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(n=o.getXAxisHelper())||void 0===n?void 0:n.isInverse():null===(s=o.getYAxisHelper())||void 0===s?void 0:s.isInverse();let u,p=h;y(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],n=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][n]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:AF(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function AF(t){return[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function kF(t){var e;const{labelSpec:i}=t,n=null!==(e=_F(i.position))&&void 0!==e?e:"outside",s=n;let r;return r=i.smartInvert?i.smartInvert:y(n)&&n.includes("inside"),{position:s,smartInvert:r}}function wF(t){var e,i,n,s;const{labelSpec:r,series:a}=t,o=null===(n=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===n?void 0:n.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(s=r.position)&&void 0!==s?s:"end",data:l}}class TF extends qL{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,H(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}TF.type=r.label;class CF extends hI{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=CF.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}CF.type="text";class EF extends CF{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}EF.type="text",EF.constructorType="label";const MF=()=>{jR.registerMark(EF.constructorType,EF),wb(),Mb(),Ab(),Tw.registerGraphic(Ik.text,ph)};class BF extends ZL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class RF extends TF{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=BF,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],n=(null==e?void 0:e.region)||[];return n.forEach(((n,s)=>{(n.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:n={}}=i;return Object.values(n).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,s],regionIndexes:[s]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const n=i.getProduct();n&&n.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(n.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),ok(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let s=0;s{if(e.visible){const s=this._labelInfoMap.get(n),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),s.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const n=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});n&&(n.setSkipBeforeLayouted(!0),this._marks.addMark(n),this._labelComponentMap.set(n,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(n))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,n;const{labelMark:s,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(s,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,s,r)}(null===(n=null===(i=s.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&s.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(n.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var s,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(s=this._spec)||void 0===s?void 0:s.centerOffset)&&void 0!==r?r:0,h=sR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:n.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:n}=e;return n.overlap&&!g(n.overlap)&&(n.overlap={}),(null!==(i=vF[t])&&void 0!==i?i:vF.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},N(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,n)=>{if(i[n.labelIndex]){const{labelSpec:e,labelMark:s}=i[n.labelIndex];return s.skipEncode?{data:t}:yF(i[n.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let n;n=_(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:n}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const n=i.getProduct().getGroupGraphicItem();n&&t.push(n)})),t}}RF.type=r.label,RF.specKey="label",RF.transformerConstructor=BF;var OF;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(OF||(OF={}));const IF={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class PF extends qL{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:n}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,n,e,t.activeType);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||H(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,n){const s=i?this._handleOutEvent:n?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};_(e)?e.forEach((t=>{this.event.on(t,r,s)})):this.event.on(e,r,s)}_eventOff(t,e,i){const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,n)})):this.event.off(t,n)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),n={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},n),{x:n.x-this.getLayoutStartPoint().x,y:n.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Of(e)||If(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=W(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const n=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=R(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{IF[t].includes(e.getOrient())&&s.push(i)}))),!s.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==n&&(this.gridZIndex=n)}_parseField(t,i){var n,s,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,f=e(d,["strokeOpacity","fillOpacity","opacity"]),m="line"===a.type;let v=m?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},f),m)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(s=null===(n=this._spec[i])||void 0===n?void 0:n.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},n=t.style||{},{fill:s="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=n,h=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:s,stroke:r,outerBorder:Object.assign({stroke:s,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((n=>{const s=n.axis;var r,a,o;if(a=e,o=i,((r=n).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const n=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));n&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:n,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:n,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){UR(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{CS(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{value:this._getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,n){var s;let r=t,a=e;if(i&&i.length)if("dimension"===n){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let n;if(e>-1){const i=t.data[e];n=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:WR(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=null==n?void 0:n.y:r=null==n?void 0:n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=lk(this._regions,"cartesian");if(!e)return;const{x:i,y:n,offsetWidth:s,offsetHeight:r,bandWidth:a,bandHeight:o}=sP(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),n&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0}))),i&&this._layoutVertical(i,a,s),n&&this._layoutHorizontal(n,o,r)}_layoutVertical(t,e,i){var n,s;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=oP(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var n,s;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=lP(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s;if(s="x"===t?this._xCrosshair:this._yCrosshair,s)s.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?s=new ox(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(s=new lx(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s}}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new nx(e)),null==n||n.add(t)),function(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}LF.specKey="crosshair",LF.type=r.cartesianCrosshair;class DF{constructor(e){this._showTooltipByHandler=(e,i)=>{var n,s,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(n=a.handler)||void 0===n?void 0:n.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let n;const s=this.component.getChart(),r=s.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),n=[...null!==(e=tO(s,a,!0))&&void 0!==e?e:[],...null!==(i=GR(s,a))&&void 0!==i?i:[]],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!CS(i.getScale().type))return!1;let n;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){n=e;break}if(p(n))break}return p(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:n}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,n)=>{var s,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const n=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(p(n.visible)||p(n.activeType)?d.visible=AP(n).includes(t):p(e.visible)||p(e.activeType)?d.visible=AP(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=n.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==n?void 0:n.length)&&(OP(n).every((t=>{var e;return!AP(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=AP(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=BP(t,i,n),f=RP(t,i,n),m=sR({},P(e[t]),f),v=g.title,y=PP(void 0,m,u.shape,void 0,v);p(m.title)?m.title=EP(m.title,Object.assign(Object.assign({},v),y)):m.title=EP(v,y,!0);const _=W(g.content);if(p(m.content)){const t=IP(_);m.content=MP(m.content,(e=>PP(e,m,u.shape,t)))}else m.content=MP(_,(t=>PP(void 0,m,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),m),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,n))}_updateActualTooltip(t,e){var i,n,s,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=VP(a,t,e),l=!!p(o)&&!1!==DP(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(n=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==n?n:h,this._cacheActualTooltip.content=null!==(r=null===(s=a.updateContent)||void 0===s?void 0:s.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class FF extends DF{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(u(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class jF extends DF{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(u(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t,e){var i;let n,s;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(s=!0)}return{tooltipInfo:n,ignore:s}}}class NF extends DF{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:W(n),series:s}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(u(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("group"))}getMouseEventData(t,e){var i,n;let s,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?W(r.triggerMark):[]).includes(null===(n=t.mark)||void 0===n?void 0:n.name)&&(s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:s,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:n}=t,s=e;if(["line","area"].includes(i.type))return W(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=W(n)[0][a];return r.filter((t=>t[a]===o))}}const zF=t=>p(t)&&!_(t),VF=t=>p(t)&&_(t);class HF extends ZL{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:n,theme:s}=super._initTheme(t,e);return n.style=sR({},this._theme,n.style),n.offset=sR({},s.offset,t.offset),n.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:s.transitionDuration,{spec:n,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=AP(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:If(this._option.mode)||!Rf(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?y(t.parentElement)&&(t.parentElement=fg.getElementById(t.parentElement)):Rf(this._option.mode)&&(t.parentElement=null==Bf?void 0:Bf.body)}}class GF extends qL{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=HF,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,n,s;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return;const r=Rf(null===(s=this._option)||void 0===s?void 0:s.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:n},ignore:{mark:s,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(s&&zF(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&VF(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(n)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(n)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,n,s)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),s)o=!a.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],s=this._isSameAsCache(n,i,t);o=!a.showTooltip(n,i,s),o&&(this._cacheInfo=n,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,n&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&kI.globalConfig.uniqueTooltip&&l&&kI.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:n,ignore:s}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s;const r=n;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:n,ignore:s}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=n,e.ignore[i]=s}return e},this._hideTooltipByHandler=e=>{var i,n,s,r;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(s=this._spec.handler)||void 0===s?void 0:s.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!_(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?FP.canvas:FP.dom,s=jR.getComponentPluginInType(t);s||Cf("Can not find tooltip handler: "+t);const r=new s;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new jF(this),dimension:new FF(this),group:new NF(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=W(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(Of(i)||If(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const n=xP(t,e,this);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(VF(t)){if(zF(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>NR(t,e[i])))))return!1}else{if(VF(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:n,y:s}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return n>=a&&n<=a+l&&s>=o&&s<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(p(n.nativeEvent)){const t=n.nativeEvent;s=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(s)&&Le(s,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}GF.type=r.tooltip,GF.transformerConstructor=HF,GF.specKey="tooltip";function UF(t,i){const{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:y,padding:_}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=function(t){var e,i;const n=Object.assign({},t);return B(t.style)||(n.textStyle=FR(t.style)),B(t.textStyle)||sR(n.textStyle,FR(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&FR(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&FR(n.background.style),n}(n)),B(s.focusIconStyle)||FR(s.focusIconStyle),s.shape&&(s.shape=LR(s.shape)),s.label&&(s.label=LR(s.label)),s.value&&(s.value=LR(s.value)),s.background&&(s.background=LR(s.background)),kB(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*i.width/100),kB(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*i.width/100),kB(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*i.width/100),b.item=s,"scrollbar"===r.type?(B(r.railStyle)||FR(r.railStyle),B(r.sliderStyle)||FR(r.sliderStyle)):(B(r.textStyle)||FR(r.textStyle),r.handler&&LR(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(sR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const WF=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},YF=(t,e)=>{var i,n,s;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:ZE;return _(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class KF extends qL{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{ok(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),ok(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=AB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:n,seriesIndex:s}=this._spec;p(n)&&(this._seriesUserId=W(n)),p(e)&&(this._regionUserId=W(e)),p(s)&&(this._seriesIndex=W(s)),p(i)&&(this._regionUserIndex=W(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(H(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new aI(this._option,e),this._initSelectedData(),ok(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,n,s;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(ok(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(n=(i=this.effect).onSelectedDataChange)||void 0===n||n.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)H(n,this._cacheAttrs)||this._legendComponent.setAttributes(sR({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(sR({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:n,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(n-s)/2:"end"===i&&(o=n-s):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+s,i.y2=i.y1+r,i}onDataUpdate(){var e,i,n;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());H(t,this._cacheAttrs)||this._legendComponent.setAttributes(sR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(n=this.getChart())||void 0===n||n.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}KF.specKey="legends";class XF extends KF{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!_(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),ok(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:yO.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){cO(this._option.dataSet,"discreteLegendFilter",YF),cO(this._option.dataSet,"discreteLegendDataMake",WF);const t=new mi(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return ok(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,n;const s=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return s;if(!t.getRawData())return s;const a=this._option.globalScale.getScaleSpec(r);if(!a)return s;if(this._spec.field)return this._spec.field;if(!Ff(a.domain))return s;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(n=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==n?n:s}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=ER(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},UF(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return QA}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(XA.legendItemClick,(i=>{const n=R(i,"detail.currentSelected");e&&this.setSelectedData(n),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:n,event:i})})),this._legendComponent.addEventListener(XA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(XA.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const n=t.style("fillOpacity"),s=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(n)?n:1,strokeOpacity:A(s)?s:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,n,s;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(s=null===(n=this._spec.item)||void 0===n?void 0:n.value)&&void 0!==s?s:{},{formatFunc:h}=XI(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=XI(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}XF.specKey="legends",XF.type=r.discreteLegend;kI.useRegisters([()=>{IC(),PC(),HL(),WL(),yI(),mI(),uD(),cD(),jR.registerSeries(mD.type,mD),jR.registerChart(wD.type,wD)},()=>{IC(),PC(),HL(),HD(),WL(),UD(),uD(),cD(),jR.registerSeries(YD.type,YD),jR.registerChart(XD.type,XD)},()=>{jD(),jR.registerChart(zD.type,zD)},()=>{cF(),jR.registerChart(gF.type,gF)},()=>{jR.registerChart(mF.type,mF)},cD,uD,()=>{jR.registerComponent(XF.type,XF)},()=>{jR.registerComponent(GF.type,GF)},()=>{jR.registerComponent(LF.type,LF)},()=>{Tw.registerGraphicComponent(Pk.label,(t=>new Hx(t))),Tw.registerComponent(Pk.label,vC),MF(),QL(),jR.registerComponent(RF.type,RF,!0)},fL,PI,Yw,Ww]),kI.useRegisters([()=>{$y(qs)}]),t.ARC_END_ANGLE=kk,t.ARC_K=wk,t.ARC_MIDDLE_ANGLE=Tk,t.ARC_QUADRANT=Ck,t.ARC_RADIAN=Ek,t.ARC_RATIO=Sk,t.ARC_START_ANGLE=Ak,t.ARC_TRANSFORM_VALUE=xk,t.AxisSyncPlugin=HI,t.BASE_EVENTS=NE,t.CORRELATION_SIZE=YE,t.CORRELATION_X=UE,t.CORRELATION_Y=WE,t.CanvasTooltipHandler=gL,t.DEFAULT_CHART_HEIGHT=gk,t.DEFAULT_CHART_WIDTH=pk,t.DEFAULT_CONICAL_GRADIENT_CONFIG=mM,t.DEFAULT_DATA_INDEX=XE,t.DEFAULT_DATA_KEY=$E,t.DEFAULT_DATA_SERIES_FIELD=ZE,t.DEFAULT_GRADIENT_CONFIG=vM,t.DEFAULT_LABEL_ALIGN=mk,t.DEFAULT_LABEL_LIMIT=fk,t.DEFAULT_LABEL_TEXT=vk,t.DEFAULT_LABEL_VISIBLE=yk,t.DEFAULT_LABEL_X=_k,t.DEFAULT_LABEL_Y=bk,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=gM,t.DEFAULT_MEASURE_CANVAS_ID=KE,t.DEFAULT_RADIAL_GRADIENT_CONFIG=fM,t.DEFAULT_SERIES_STYLE_NAME=qE,t.DomTooltipHandler=pL,t.Factory=jR,t.FormatterPlugin=II,t.GradientType=pM,t.MediaQuery=MI,t.POLAR_DEFAULT_RADIUS=.6,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=Bk,t.POLAR_START_ANGLE=-90,t.POLAR_START_RADIAN=Mk,t.PREFIX=uk,t.SEGMENT_FIELD_END=cM,t.SEGMENT_FIELD_START=hM,t.STACK_FIELD_END=eM,t.STACK_FIELD_END_OffsetSilhouette=rM,t.STACK_FIELD_END_PERCENT=nM,t.STACK_FIELD_KEY=QE,t.STACK_FIELD_START=tM,t.STACK_FIELD_START_OffsetSilhouette=sM,t.STACK_FIELD_START_PERCENT=iM,t.STACK_FIELD_TOTAL=aM,t.STACK_FIELD_TOTAL_PERCENT=oM,t.STACK_FIELD_TOTAL_TOP=lM,t.ThemeManager=SR,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=kI,t.WaterfallDefaultSeriesField=GE,t.builtinThemes=dR,t.computeActualDataScheme=dB,t.darkTheme=qB,t.dataScheme=BB,t.default=kI,t.defaultThemeName=uR,t.getActualColor=pB,t.getColorSchemeBySeries=vB,t.getDataScheme=cB,t.getMergedTheme=bR,t.getTheme=vR,t.hasThemeMerged=fR,t.isColorKey=gB,t.isProgressiveDataColorScheme=fB,t.isTokenKey=XB,t.lightTheme=ZB,t.queryColorFromColorScheme=uB,t.queryToken=KB,t.registerCanvasTooltipHandler=fL,t.registerChartPlugin=EI,t.registerDomTooltipHandler=()=>{uL(pL)},t.registerFormatPlugin=PI,t.registerMediaQuery=()=>{EI(MI)},t.registerTheme=mR,t.removeTheme=yR,t.themeExist=_R,t.themes=pR,t.token=$B,t.transformColorSchemeToStandardStruct=mB,t.version="1.11.12",t.vglobal=fg,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 1856da1aad..57a90c288d 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "1.11.11", + "version": "1.11.12", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -130,7 +130,7 @@ "@visactor/vgrammar-sankey": "0.13.20", "@visactor/vgrammar-venn": "0.13.20", "@visactor/vgrammar-util": "0.13.20", - "@visactor/vutils-extension": "workspace:1.11.11" + "@visactor/vutils-extension": "workspace:1.11.12" }, "publishConfig": { "access": "public", diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index 97e94c46e4..7dbfd1fd30 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "1.11.11", + "version": "1.11.12", "description": "The extension module for VUtil from VisActor", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/wx-vchart/miniprogram/src/vchart/index.js b/packages/wx-vchart/miniprogram/src/vchart/index.js index 0f5e7dd084..6964dc3260 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function et(t){return Number(t)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&S(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):st(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Warn&&st(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Info&&st(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Debug&&st(this._method||"log","DEBUG",e),this}}function at(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;tt(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(tt)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ct,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:dt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ft=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}yt=!1;const kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mt=new RegExp(kt.source,"g");function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const wt=1e-12,Ct=Math.PI,Et=Ct/2,Pt=2*Ct,Bt=2*Math.PI,Rt=Math.abs,Lt=Math.atan2,Ot=Math.cos,It=Math.max,Dt=Math.min,Ft=Math.sin,jt=Math.sqrt,zt=Math.pow;function Ht(t){return t>1?0:t<-1?Ct:Math.acos(t)}function Nt(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function Kt(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class $t{static distancePP(t,e){return jt(zt(t.x-e.x,2)+zt(t.y-e.y,2))}static distanceNN(t,e,i,s){return jt(zt(t-i,2)+zt(e-s,2))}static distancePN(t,e,i){return jt(zt(e-t.x,2)+zt(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Zt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Zt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return qt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Jt extends Zt{}function Qt(t){return t*(Math.PI/180)}function te(t){return 180*t/Math.PI}const ee=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Pt;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function ie(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function se(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ne(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function re(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ne(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class ae{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new ae,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new ae;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ae(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=te(r.rotateDeg),r}}class oe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function le(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function he(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ce=/^#([0-9a-f]{3,8})$/,de={transparent:4294967040},ue={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ge(t){return S(t)?new _e(t>>16,t>>8&255,255&t,1):y(t)?new _e(t[0],t[1],t[2]):new _e(255,255,255)}function me(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function fe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ve{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ve(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ve(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ve?t:new ve(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(de[t]))return function(t){return S(t)?new _e(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new _e(t[0],t[1],t[2],t[3]):new _e(255,255,255,1)}(de[t]);if(p(ue[t]))return ge(ue[t]);const e=`${t}`.trim().toLowerCase(),i=ce.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new _e((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ge(t):8===e?new _e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new _e(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=le(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new _e(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ve.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new _e(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=he(this.color.r,this.color.g,this.color.b),r=le(u(t)?n.h:ft(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new _e(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ce.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new _e((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?ge(s):8===n?new _e(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=ue[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new ve(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=me(t.color.r),this.color.g=me(t.color.g),this.color.b=me(t.color.b),this}copyLinearToSRGB(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class _e{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${pe(this.r)+pe(this.g)+pe(this.b)+(1===this.opacity?"":pe(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=he(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ye(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new _e(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:he});function xe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Se,Ae,ke,Me,Te,we,Ce,Ee;function Pe(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Re(t,e,i){return null===t?e:null===e?t:(Se=t.x1,Ae=t.x2,ke=t.y1,Me=t.y2,Te=e.x1,we=e.x2,Ce=e.y1,Ee=e.y2,i&&(Se>Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce])),Se>=we||Ae<=Te||ke>=Ee||Me<=Ce?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Se,Te),y1:Math.max(ke,Ce),x2:Math.min(Ae,we),y2:Math.min(Me,Ee)})}var Le;function Oe(t,e,i){return!(t&&e&&(i?(Se=t.x1,Ae=t.x2,ke=t.y1,Me=t.y2,Te=e.x1,we=e.x2,Ce=e.y1,Ee=e.y2,Se>Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce]),Se>we||AeEe||Mee.x2||t.x2e.y2||t.y2Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),t.x>=Se&&t.x<=Ae&&t.y>=ke&&t.y<=Me):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function De(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Fe(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function je(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ze(t,e){const i=e?t.angle:Qt(t.angle),s=je(t);return[Fe({x:t.x1,y:t.y1},i,s),Fe({x:t.x2,y:t.y1},i,s),Fe({x:t.x2,y:t.y2},i,s),Fe({x:t.x1,y:t.y2},i,s)]}let He,Ne,Ve,Ge;function We(t){return He=1/0,Ne=1/0,Ve=-1/0,Ge=-1/0,t.forEach((t=>{He>t.x&&(He=t.x),Vet.y&&(Ne=t.y),Gee&&r>s||rn?o:0}function $e(t,e){return Math.abs(t-e)0&&Ye(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Ze=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Je{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Je.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Je.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Je.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Je.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Je.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Je.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Je.NUMBERS_CHAR_SET="0123456789",Je.FULL_SIZE_CHAR="字";const Qe=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ti(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ei(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function ii(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const si=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ni=6371008.8,ri={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ni,kilometers:6371.0088,kilometres:6371.0088,meters:ni,metres:ni,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ni/1852,radians:1,yards:6967335.223679999};function ai(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function oi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function li(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===Ie(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hi(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=Qt(t[0]),r=Qt(t[1]),a=Qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ri[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:te(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:te(l)}}class ci{static getInstance(){return ci.instance||(ci.instance=new ci),ci.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let ui;function pi(t,e){const i=di(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class gi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const mi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fi(t){let e;if(e=mi.exec(t))return new gi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const vi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class _i{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return _i.instance||(_i.instance=new _i),_i.instance}newFormat(t){const e=fi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):yi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=yi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?vi[8+ui/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=fi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=di(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=vi[8+n/3];return function(t){return s(r*t)+a}}}const yi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>pi(100*t,e),r:pi,s:function(t,e){const i=di(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(ui=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+di(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function bi(){return new xi}function xi(){this.reset()}xi.prototype={constructor:xi,reset:function(){this.s=this.t=0},add:function(t){Ai(Si,t,this.t),Ai(this,Si.s,this.s),this.s?this.t+=Si.t:this.s=Si.t},valueOf:function(){return this.s}};var Si=new xi;function Ai(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ki=1e-6,Mi=Math.PI,Ti=Mi/2,wi=Mi/4,Ci=2*Mi,Ei=180/Mi,Pi=Mi/180,Bi=Math.abs,Ri=Math.atan,Li=Math.atan2,Oi=Math.cos,Ii=Math.exp,Di=Math.log,Fi=Math.pow,ji=Math.sin,zi=Math.sign||function(t){return t>0?1:t<0?-1:0},Hi=Math.sqrt,Ni=Math.tan;function Vi(t){return t>1?0:t<-1?Mi:Math.acos(t)}function Gi(t){return t>1?Ti:t<-1?-Ti:Math.asin(t)}function Wi(){}function Ui(t,e){t&&Ki.hasOwnProperty(t.type)&&Ki[t.type](t,e)}var Yi={Feature:function(t,e){Ui(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sMi?t+Math.round(-t/Ci)*Ci:t,e]}function as(t,e,i){return(t%=Ci)?e||i?ns(ls(t),hs(e,i)):ls(t):e||i?hs(e,i):rs}function os(t){return function(e,i){return[(e+=t)>Mi?e-Ci:e<-Mi?e+Ci:e,i]}}function ls(t){var e=os(t);return e.invert=os(-t),e}function hs(t,e){var i=Oi(t),s=ji(t),n=Oi(e),r=ji(e);function a(t,e){var a=Oi(e),o=Oi(t)*a,l=ji(t)*a,h=ji(e),c=h*i+o*s;return[Li(l*n-c*r,o*i-h*s),Gi(c*n+l*r)]}return a.invert=function(t,e){var a=Oi(e),o=Oi(t)*a,l=ji(t)*a,h=ji(e),c=h*n-l*r;return[Li(l*n+h*r,o*i+c*s),Gi(c*i-o*s)]},a}function cs(t,e){(e=Ji(e))[0]-=t,ss(e);var i=Vi(-e[1]);return((-e[2]<0?-i:i)+Ci-ki)%Ci}function ds(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Wi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function us(t,e){return Bi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function ms(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function xs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Ss(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ds(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=xs(a);var t=function(t,e){var i=ys(e),s=e[1],n=ji(s),r=[ji(i),-Oi(i),0],a=0,o=0;_s.reset(),1===n?s=Ti+ki:-1===n&&(s=-Ti-ki);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Mi,w=m*x;if(_s.add(Li(w*k*ji(M),f*S+w*Oi(M))),a+=T?A+k*Ci:A,T^p>=i^y>=i){var C=ts(Ji(u),Ji(_));ss(C);var E=ts(r,C);ss(E);var P=(T^A>=0?-1:1)*Gi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ki||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(As))}return u}}function As(t){return t.length>1}function ks(t,e){return((t=t.x)[0]<0?t[1]-Ti-ki:Ti-t[1])-((e=e.x)[0]<0?e[1]-Ti-ki:Ti-e[1])}1===(fs=bs).length&&(vs=fs,fs=function(t,e){return bs(vs(t),e)});var Ms=Ss((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mi:-Mi,l=Bi(r-i);Bi(l-Mi)0?Ti:-Ti),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Mi&&(Bi(i-n)ki?Ri((ji(e)*(r=Oi(s))*ji(i)-ji(s)*(n=Oi(e))*ji(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ti,s.point(-Mi,n),s.point(0,n),s.point(Mi,n),s.point(Mi,0),s.point(Mi,-n),s.point(0,-n),s.point(-Mi,-n),s.point(-Mi,0),s.point(-Mi,n);else if(Bi(t[0]-e[0])>ki){var r=t[0]0,n=Bi(e)>ki;function r(t,i){return Oi(t)*Oi(i)>e}function a(t,i,s){var n=[1,0,0],r=ts(Ji(t),Ji(i)),a=Qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ts(n,r),u=is(n,h);es(u,is(r,c));var p=d,g=Qi(u,p),m=Qi(p,p),f=g*g-m*(Qi(u,u)-1);if(!(f<0)){var v=Hi(f),_=is(p,(-g-v)/m);if(es(_,u),_=Zi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Bi(_[0]-b)Mi^(b<=_[0]&&_[0]<=x)){var T=is(p,(-g+v)/m);return es(T,u),[_,Zi(T)]}}}function o(e,i){var n=s?t:Mi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ss(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Mi:-Mi),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||us(e,p)||us(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&us(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Oi(e),o=ji(e),l=s*i;null==n?(n=e+s*Ci,r=e-l/2):(n=cs(a,n),r=cs(a,r),(s>0?nr)&&(n+=s*Ci));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Bi(s[0]-t)0?0:3:Bi(s[0]-i)0?2:1:Bi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ds(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=xs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&gs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Cs,Math.min(ws,g)),m=Math.max(Cs,Math.min(ws,m))],b=[r=Math.max(Cs,Math.min(ws,r)),a=Math.max(Cs,Math.min(ws,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ps(t){return t}var Bs,Rs,Ls,Os,Is=bi(),Ds=bi(),Fs={point:Wi,lineStart:Wi,lineEnd:Wi,polygonStart:function(){Fs.lineStart=js,Fs.lineEnd=Ns},polygonEnd:function(){Fs.lineStart=Fs.lineEnd=Fs.point=Wi,Is.add(Bi(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function js(){Fs.point=zs}function zs(t,e){Fs.point=Hs,Bs=Ls=t,Rs=Os=e}function Hs(t,e){Ds.add(Os*t-Ls*e),Ls=t,Os=e}function Ns(){Hs(Bs,Rs)}var Vs=Fs,Gs=1/0,Ws=Gs,Us=-Gs,Ys=Us;var Ks,Xs,$s,qs,Zs={point:function(t,e){tUs&&(Us=t);eYs&&(Ys=e)},lineStart:Wi,lineEnd:Wi,polygonStart:Wi,polygonEnd:Wi,result:function(){var t=[[Gs,Ws],[Us,Ys]];return Us=Ys=-(Ws=Gs=1/0),t}},Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln={point:hn,lineStart:cn,lineEnd:pn,polygonStart:function(){ln.lineStart=gn,ln.lineEnd=mn},polygonEnd:function(){ln.point=hn,ln.lineStart=cn,ln.lineEnd=pn},result:function(){var t=on?[rn/on,an/on]:nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:[NaN,NaN];return Js=Qs=tn=en=sn=nn=rn=an=on=0,t}};function hn(t,e){Js+=t,Qs+=e,++tn}function cn(){ln.point=dn}function dn(t,e){ln.point=un,hn($s=t,qs=e)}function un(t,e){var i=t-$s,s=e-qs,n=Hi(i*i+s*s);en+=n*($s+t)/2,sn+=n*(qs+e)/2,nn+=n,hn($s=t,qs=e)}function pn(){ln.point=hn}function gn(){ln.point=fn}function mn(){vn(Ks,Xs)}function fn(t,e){ln.point=vn,hn(Ks=$s=t,Xs=qs=e)}function vn(t,e){var i=t-$s,s=e-qs,n=Hi(i*i+s*s);en+=n*($s+t)/2,sn+=n*(qs+e)/2,nn+=n,rn+=(n=qs*t-$s*e)*($s+t),an+=n*(qs+e),on+=3*n,hn($s=t,qs=e)}var _n=ln;function yn(t){this._context=t}yn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ci)}},result:Wi};var bn,xn,Sn,An,kn,Mn=bi(),Tn={point:Wi,lineStart:function(){Tn.point=wn},lineEnd:function(){bn&&Cn(xn,Sn),Tn.point=Wi},polygonStart:function(){bn=!0},polygonEnd:function(){bn=null},result:function(){var t=+Mn;return Mn.reset(),t}};function wn(t,e){Tn.point=Cn,xn=An=t,Sn=kn=e}function Cn(t,e){An-=t,kn-=e,Mn.add(Hi(An*An+kn*kn)),An=t,kn=e}var En=Tn;function Pn(){this._string=[]}function Bn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Rn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),qi(t,i(s))),s.result()}return r.area=function(t){return qi(t,i(Vs)),Vs.result()},r.measure=function(t){return qi(t,i(En)),En.result()},r.bounds=function(t){return qi(t,i(Zs)),Zs.result()},r.centroid=function(t){return qi(t,i(_n)),_n.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ps):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Pn):new yn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Ln(t){return function(e){var i=new On;for(var s in t)i[s]=t[s];return i.stream=e,i}}function On(){}function In(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),qi(i,t.stream(Zs)),e(Zs.result()),null!=s&&t.clipExtent(s),t}function Dn(t,e,i){return In(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Fn(t,e,i){return Dn(t,[[0,0],e],i)}function jn(t,e,i){return In(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function zn(t,e,i){return In(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Pn.prototype={_radius:4.5,_circle:Bn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Bn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},On.prototype={constructor:On,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Hn=16,Nn=Oi(30*Pi);function Vn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Hi(b*b+x*x+S*S),k=Gi(S/=A),M=Bi(Bi(S)-1)e||Bi((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Pi:0,E()):[f*Ei,v*Ei,_*Ei]},w.angle=function(t){return arguments.length?(y=t%360*Pi,E()):y*Ei},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Vn(o,T=t*t),P()):Hi(T)},w.fitExtent=function(t,e){return Dn(w,t,e)},w.fitSize=function(t,e){return Fn(w,t,e)},w.fitWidth=function(t,e){return jn(w,t,e)},w.fitHeight=function(t,e){return zn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function Xn(t){var e=0,i=Mi/3,s=Kn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Pi,i=t[1]*Pi):[e*Ei,i*Ei]},n}function $n(t,e){var i=ji(t),s=(i+ji(e))/2;if(Bi(s)2?t[2]*Pi:0),e.invert=function(e){return(e=t.invert(e[0]*Pi,e[1]*Pi))[0]*=Ei,e[1]*=Ei,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ir?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function nr(t){return Ni((Ti+t)/2)}function rr(t,e){var i=Oi(t),s=t===e?ji(t):Di(i/Oi(e))/Di(nr(e)/nr(t)),n=i*Fi(nr(t),s)/s;if(!s)return ir;function r(t,e){n>0?e<-Ti+ki&&(e=-Ti+ki):e>Ti-ki&&(e=Ti-ki);var i=n/Fi(nr(e),s);return[i*ji(s*t),n-i*Oi(s*t)]}return r.invert=function(t,e){var i=n-e,r=zi(s)*Hi(t*t+i*i),a=Li(t,Bi(i))*zi(i);return i*s<0&&(a-=Mi*zi(t)*zi(i)),[a/s,2*Ri(Fi(n/r,1/s))-Ti]},r}function ar(t,e){return[t,e]}function or(t,e){var i=Oi(t),s=t===e?ji(t):(i-Oi(e))/(e-t),n=i/s+t;if(Bi(s)ki&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},fr.invert=Qn(Gi),vr.invert=Qn((function(t){return 2*Ri(t)})),_r.invert=function(t,e){return[-e,2*Ri(Ii(t))-Ti]};var xr={exports:{}},Sr=function(t,e){this.p1=t,this.p2=e};Sr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Sr.prototype.run=function(){return this.p2[0]-this.p1[0]},Sr.prototype.slope=function(){return this.rise()/this.run()},Sr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Sr.prototype.isVertical=function(){return!isFinite(this.slope())},Sr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Sr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Sr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Sr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Sr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ar=Sr,kr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ar(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=kr(t.slice(0,s),e),o=kr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Mr=kr;!function(t){var e=Mr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=wr(Pr,e),{tolerance:s}=i;return Tr(t,s)};var Rr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Rr||(Rr={}));const Lr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+jr(e,6):jr(e,4))+"-"+jr(t.getUTCMonth()+1,2)+"-"+jr(t.getUTCDate(),2)+(r?"T"+jr(i,2)+":"+jr(s,2)+":"+jr(n,2)+"."+jr(r,3)+"Z":n?"T"+jr(i,2)+":"+jr(s,2)+":"+jr(n,2)+"Z":s||i?"T"+jr(i,2)+":"+jr(s,2)+"Z":"")}function Hr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ir;if(h)return h=!1,Or;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Rr.DSV;const i=wr(Gr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Hr(s).parse(t)},Ur=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Nr(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Vr(t)};function Kr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Xr(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Xr(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qr(t);default:throw new Error("unknown GeoJSON type")}}function Xr(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=$r(t.properties),e.geometry=qr(t.geometry),e}function $r(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=$r(s):e[i]=s})),e):e}function qr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return qr(t)})),e):(e.coordinates=Zr(t.coordinates),e)}function Zr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Zr(t)}))}function Jr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Qr(t){for(var e,i,s=Jr(t),n=0,r=1;r0}function ta(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Kr(t));var r=[];switch(t.type){case"GeometryCollection":return ea(t,(function(t){sa(t,s)})),t;case"FeatureCollection":return ta(t,(function(t){ta(sa(t,s),(function(t){r.push(t)}))})),oi(r)}return sa(t,s)}function sa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ea(t,(function(t){sa(t,e)})),t;case"LineString":return na(Jr(t),e),t;case"Polygon":return ra(Jr(t),e),t;case"MultiLineString":return Jr(t).forEach((function(t){na(t,e)})),t;case"MultiPolygon":return Jr(t).forEach((function(t){ra(t,e)})),t;case"Point":case"MultiPoint":return t}}function na(t,e){Qr(t)===e&&t.reverse()}function ra(t,e){Qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=aa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ca=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Rr.GEO;const i=wr(la,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ha(t))})):e.push(ha(t))})),e})(t);let o=t.features;return a&&(o=ia(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=oa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=oa.bounds(t);t.bbox=e}})),t.features=o,t},da={},ua=(t,e,i)=>{i.type=Rr.GEO;const s=wr(la,da,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return br(a,t)}))}:br(a,o));var a,o;return ca(r,s,i)},pa=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ga=0;function ma(){return ga>1e8&&(ga=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ga++}class fa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ma("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const va="_data-view-diff-rank";class _a{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ma("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[va]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[va]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[va]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Lr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ya{static GenAutoIncrementId(){return ya.auto_increment_id++}}ya.auto_increment_id=0;class ba{constructor(t){this.id=ya.GenAutoIncrementId(),this.registry=t}}const xa="named",Sa="inject",Aa="multi_inject",ka="inversify:tagged",Ma="inversify:paramtypes";class Ta{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===xa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var wa=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ca(e,0,s,t)}}function Pa(t){return e=>(i,s,n)=>Ea(new Ta(t,e))(i,s,n)}const Ba=Pa(Sa),Ra=Pa(Aa);function La(){return function(t){return wa.defineMetadata(Ma,null,t),t}}function Oa(t){return Ea(new Ta(xa,t))}const Ia="Singleton",Da="Transient",Fa="ConstantValue",ja="DynamicValue",za="Factory",Ha="Function",Na="Instance",Va="Invalid";class Ga{constructor(t,e){this.id=ya.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Va,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ga(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ia&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Wa{getConstructorMetadata(t){return{compilerGeneratedMetadata:wa.getMetadata(Ma,t),userGeneratedMetadata:wa.getMetadata(ka,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ua=(Ya=xa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ya&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const $a=Symbol("ContributionProvider");class qa{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Za(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ja{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Qa extends Ja{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const to=Symbol.for("EnvContribution"),eo=Symbol.for("VGlobal");var io=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},so=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},no=function(t,e){return function(i,s){e(i,s,t)}};let ro=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ya.GenAutoIncrementId(),this.hooks={onSetEnv:new Qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ro=io([La(),no(0,Ba($a)),no(0,Oa(to)),so("design:paramtypes",[Object])],ro);const ao=Pt-1e-8;class oo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ao)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Pt)<0&&(s+=Pt),(n%=Pt)<0&&(n+=Pt),nn;++o,a-=Et)g(a);else for(a=s-s%Et+Et,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ho=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,co={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},uo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let po,go,mo,fo,vo,_o;var yo,bo,xo,So,Ao,ko,Mo,To,wo;function Co(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Eo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=Qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Pt:C>0&&0===r&&(C-=Pt);const E=Math.ceil(Math.abs(C/(Et+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Vo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Go(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Wo(t,e,i){const s=null!=e?e:Rt(i[i.length-1].x-i[0].x)>Rt(i[i.length-1].y-i[0].y)?Mo.ROW:Mo.COLUMN;return"monotoneY"===t?new Vo(t,s):new No(t,s)}class Uo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Yo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return function(t,e){Go(t,e)}(new Uo(n,s),t),n}function Ko(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Xo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Ko(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Ko(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("basis",i,t);return function(t,e){Go(t,e)}(new Xo(n,s),t),n}function qo(t){return t<0?-1:1}function Zo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(qo(r)+qo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Jo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Qo(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class tl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Qo(this,this._t0,Jo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Qo(this,Jo(this,e=Zo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Qo(this,this._t0,e=Zo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class el extends tl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function il(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("monotoneX",i,t);return function(t,e){Go(t,e)}(new tl(n,s),t),n}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("monotoneY",i,t);return function(t,e){Go(t,e)}(new el(n,s),t),n}let nl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function rl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Rt(t[t.length-1].x-t[0].x)>Rt(t[t.length-1].y-t[0].y)?Mo.ROW:Mo.COLUMN);return function(t,e){Go(t,e)}(new nl(r,e,n),t),r}class al extends Uo{lineEnd(){this.context.closePath()}}function ol(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return function(t,e){Go(t,e)}(new al(n,s),t),n}function ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>wt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>wt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function hl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Go(new e(o,s,a),i),o}}const cl=hl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const dl=hl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ul(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return $o(t,i);case"monotoneX":return il(t,i);case"monotoneY":return sl(t,i);case"step":return rl(t,.5,i);case"stepBefore":return rl(t,0,i);case"stepAfter":return rl(t,1,i);case"catmullRom":return cl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ol(t,i)}}class pl extends lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new oo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([uo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([uo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([uo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([uo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([uo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([uo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([uo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([uo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([uo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[uo.M]=t=>`M${t[1]} ${t[2]}`,t[uo.L]=t=>`L${t[1]} ${t[2]}`,t[uo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[uo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[uo.A]=t=>{const e=[];Po(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[uo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Mo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.y-e.p1.y)}if(this.direction===Mo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const gl=["l",0,0,0,0,0,0,0];function ml(t,e,i){const s=gl[0]=t[0];if("a"===s||"A"===s)gl[1]=e*t[1],gl[2]=i*t[2],gl[3]=t[3],gl[4]=t[4],gl[5]=t[5],gl[6]=e*t[6],gl[7]=i*t[7];else if("h"===s||"H"===s)gl[1]=e*t[1];else if("v"===s||"V"===s)gl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),Bl=Object.assign(Object.assign({},Al),{points:[],cornerRadius:0,closePath:!0}),Rl=Object.assign(Object.assign({},Al),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},Al),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ll=Object.assign(Object.assign({},Al),{symbolType:"circle",size:10,keepDirIn3d:!0}),Ol=Object.assign(Object.assign(Object.assign({},Al),bl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},Al),bl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Dl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Al),{fill:!0,cornerRadius:0}),Fl=Object.assign(Object.assign({},Dl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const jl=new class{},zl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/;function Ul(t,e,i,s,n){if(!e||e<=0)return 0;const r=jl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Yl(t,a)),a}function Yl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i--,i<=0)return e;return i}function Kl(t,e){const i=jl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var Xl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $l=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Ol.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Yl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Yl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};$l=Xl([La()],$l);var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Zl=Symbol.for("TextMeasureContribution");let Jl=class extends $l{};Jl=ql([La()],Jl);const Ql=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Da,this.options=e,this.id=ya.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Wa}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,xa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ga(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Xa(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Sa],multiInject:s[Aa]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Fa:case Ha:e=t.cache;break;case Na:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ia&&(t.cache=e,t.activated=!0)}},th=Symbol.for("CanvasFactory"),eh=Symbol.for("Context2dFactory");function ih(t){return Ql.getNamed(th,jl.global.env)(t)}const sh=1e-4,nh=Math.sqrt(3),rh=1/3;function ah(t){return t>-bh&&tbh||t<-bh}const lh=[0,0],hh=[0,0],ch=[0,0];function dh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function uh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ph(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function gh(t){return(t%=Bt)<0&&(t+=Bt),t}function mh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function fh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Bt);let d=Math.atan2(l,o);return d<0&&(d+=Bt),d>=s&&d<=n||d+Bt>=s&&d+Bt<=n}function yh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(ah(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Sh=[-1,-1,-1],Ah=[-1,-1];function kh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function Mh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(ah(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,rh):Math.pow(i,rh),s=s<0?-Math.pow(-s,rh):Math.pow(s,rh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+nh*Math.sin(e)))/(3*a),h=(-o+i*(s-nh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Sh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&kh(),p=ph(e,s,r,o,Ah[0]),u>1&&(g=ph(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ah(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Sh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=uh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Sh[0]=-l,Sh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Bt-1e-4){s=0,n=Bt;const e=r?1:-1;return a>=Sh[0]+t&&a<=Sh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Bt,n+=Bt);let c=0;for(let e=0;e<2;e++){const i=Sh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Bt+t),(t>=s&&t<=n||t+Bt>=s&&t+Bt<=n)&&(t>Ct/2&&t<1.5*Ct&&(e=-e),c+=e)}}return c}function Ch(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Eh(t,e){let i=Ch(t[0]);i<0&&(i+=Bt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Bt?n=i+Bt:e&&i-n>=Bt?n=i-Bt:!e&&i>n?n=i+(Bt-Ch(i-n)):e&&i1&&(i||(h+=mh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Ph[0]=S,Ph[1]=A,Eh(Ph,Boolean(a[6])),S=Ph[0],A=Ph[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case uo.M:u=f,p=v,c=u,d=p;break;case uo.L:if(i){if(yh(c,d,f,v,e,s,n))return!0}else h+=mh(c,d,f,v,s,n)||0;c=f,d=v;break;case uo.C:if(i){if(vh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Mh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(fh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case uo.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=mh(c,d,o,l,s,n),i){if(_h(f,v,_,k,k+M,T,e,w,n))return!0}else h+=wh(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case uo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(yh(u,p,o,p,e,s,n)||yh(o,p,o,l,e,s,n)||yh(o,l,u,l,e,s,n)||yh(u,l,u,p,e,s,n))return!0}else h+=mh(o,p,o,l,s,n),h+=mh(u,l,u,p,s,n);break;case uo.Z:if(i){if(yh(c,d,u,p,e,s,n))return!0}else h+=mh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ih=Symbol.for("VWindow"),Dh=Symbol.for("WindowHandlerContribution");let Fh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new Qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Ql.getNamed(Dh,t.env).configure(this,t),this.actived=!0)},this._uid=ya.GenAutoIncrementId(),this.global=jl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Fh=Lh([La(),Oh("design:paramtypes",[])],Fh);var jh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(i,s){e(i,s,t)}};let Nh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=jl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Rh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:bl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Je(Object.assign({defaultFontParams:{fontFamily:bl.fontFamily,fontSize:bl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Ql.get(Ih),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Vh;Nh=jh([La(),Hh(0,Ba($a)),Hh(0,Oa(Zl)),zh("design:paramtypes",[Object])],Nh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Vh||(Vh={}));const Gh=new ae;let Wh=class{constructor(){this.matrix=new ae}init(t){return this.mode=Vh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Vh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Gh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}scale(t,e,i){return this.mode===Vh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Vh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}translate(t,e){return this.mode===Vh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Vh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Wh=jh([La(),zh("design:paramtypes",[])],Wh);const Uh={arc:kl,area:Ml,circle:Tl,line:El,path:Pl,symbol:Ll,text:Ol,rect:Rl,polygon:Bl,richtext:Il,richtextIcon:Fl,image:Dl,group:wl,glyph:Cl},Yh=Object.keys(Uh);function Kh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Xh={arc:Object.assign({},Uh.arc),area:Object.assign({},Uh.area),circle:Object.assign({},Uh.circle),line:Object.assign({},Uh.line),path:Object.assign({},Uh.path),symbol:Object.assign({},Uh.symbol),text:Object.assign({},Uh.text),rect:Object.assign({},Uh.rect),polygon:Object.assign({},Uh.polygon),richtext:Object.assign({},Uh.richtext),richtextIcon:Object.assign({},Uh.richtextIcon),image:Object.assign({},Uh.image),group:Object.assign({},Uh.group),glyph:Object.assign({},Uh.glyph)};class $h{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Yh.forEach((t=>{this._defaultTheme[t]=Object.create(Xh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Yh.forEach((s=>{const n=Object.create(Xh[s]);t&&t[s]&&Kh(n,t[s]),i[s]&&Kh(n,i[s]),e[s]&&Kh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Yh.forEach((t=>{Kh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const qh=new $h;function Zh(t,e){return t.glyphHost?Zh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):qh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Zh(t.attachedThemeGraphic)||qh.getTheme()}var Jh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Qh extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ya.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Jh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(ac(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ac(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=ac(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=ac(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=rc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ac(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(ac(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,ac(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):ac(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof sc))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=rc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new oc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ic,this.rootWheelEvent=new sc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class dc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return dc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class uc{static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class pc{static Avaliable(){return!!jl.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){jl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var gc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(gc||(gc={}));class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Bt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Bt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Bt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=ya.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===So.END?this.removeAnimate(e):e.status===So.RUNNING||e.status===So.INITIAL?(this.animateCount++,e.advance(t)):e.status===So.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let bc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ya.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc;this.id=t,this.timeline=e,this.status=So.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=It(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&Ao.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:xo.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===So.RUNNING&&(this.status=So.PAUSED)}resume(){this.status===So.PAUSED&&(this.status=So.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===So.RUNNING&&(this.status=So.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=So.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};bc.mode=Ao.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=ko.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=ko.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=ko.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ko.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return rt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const Ac=200,kc="cubicOut",Mc=1e3,Tc="quadInOut";var wc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(wc||(wc={}));const Cc=[!1,!1,!1,!1],Ec=[0,0,0,0],Pc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Ec[0]=t[0],Ec[2]=t[0],Ec[1]=t[1],Ec[3]=t[1],Ec):t:t:0,Bc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Rc=[1,2,3,0,1,2,3,0];function Lc(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;Bc[0].x=i,Bc[1].y=i,Bc[2].x=-i,Bc[3].y=-i;const n=Math.ceil(t/Et)%4,r=Math.ceil(e/Et)%4;if(s.add(Ot(t)*i,Ft(t)*i),s.add(Ot(e)*i,Ft(e)*i),n!==r||e-t>Ct){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:jc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}jc.TimeOut=1e3/60;const zc=new jc,Hc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Nc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Vc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Vc||(Vc={}));class Gc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Oc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Wc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:xo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:xo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Uc extends Wc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=jl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Yc extends Wc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=jl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Kc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Xc extends _c{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?mc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function $c(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function qc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{ut(e,s)&&ut(i,n)||t.push(e,i,s,n,s,n)};function id(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function sd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function ad(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),hd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},cd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Zt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return hd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return hd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);cd(n[0],s,i),cd(n[1],e-s,i)}};var dd;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(dd||(dd={}));class ud{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dd.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===dd.Color1){const e=ud.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ve.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ud.store1[t]=e,ud.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=ud.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ve.parseColorString(t);return n&&(ud.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ud.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===dd.Color1){if(ud.store1[t])return;ud.store1[t]=i,ud.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ud.store255[t])return;ud.store255[t]=i,ud.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function pd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function gd(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>md(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):md(t,e,i,s,n)}function md(t,e,i,s,n){if(!t||!e)return t&&pd(t)||e&&pd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ud.Get(t,dd.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ud.Get(e,dd.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:pd(a)})))});return o?gd(r,l,i,s,n):gd(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_d(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_d(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_d(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),pd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}ud.store255={},ud.store1={};const fd=[0,0,0,0],vd=[0,0,0,0];function _d(t,e,i){return ud.Get(t,dd.Color255,fd),ud.Get(e,dd.Color255,vd),`rgba(${Math.round(fd[0]+(vd[0]-fd[0])*i)},${Math.round(fd[1]+(vd[1]-fd[1])*i)},${Math.round(fd[2]+(vd[2]-fd[2])*i)},${fd[3]+(vd[3]-fd[3])*i})`}const yd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=gd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},bd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?id(t):[],n=id(e);i&&s&&(i.fromTransform&&sd(s,i.fromTransform.clone().getInverse()),sd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Sd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Ad=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Sd.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?ud.Get(t[n],dd.Color255):t[n],to:"string"==typeof r?ud.Get(r,dd.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class kd extends _c{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;bd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&yd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Md=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=xd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Ad(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new kd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Tc)),c};class Td extends _c{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;bd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&yd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const wd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Dc.includes(t))(i)||(e[i]=t[i])})),e},Cd=(t,e,i)=>{const s=wd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=jl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Ed=(t,e,i)=>{const s=[],n=i?null:wd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:wd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=rd(t.attribute),n=ad(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(jl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ad(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(jl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ad(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(jl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return od(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return od(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(jl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ld(i)}];const s=[];return cd(i,e,s),s})(t,e).forEach((t=>{s.push(jl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return cd(r,e,h),h})(t,e).forEach((t=>{s.push(jl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=id(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(jl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(jl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Cd(t,s,e),s};class Bd{static GetImage(t,e){var i;const s=Bd.cache.get(t);s?"fail"===s.loadState?jl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Bd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Bd.cache.get(t);s?"fail"===s.loadState?jl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Bd.cache.set(t,s),s.dataPromise=jl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Bd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Bd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=jl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=jl.global.loadBlob(t):"json"===e&&(i.dataPromise=jl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Bd.isLoading&&Bd.toLoadAueue.length){Bd.isLoading=!0;const t=Bd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Bd.cache.set(i,n),n.dataPromise=jl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Bd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Bd.loading()})).catch((t=>{console.error(t),Bd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Bd.loading()}))}}),0)}static loadImage(t,e){const i=Rd(t,Bd.toLoadAueue);if(-1!==i)return Bd.toLoadAueue[i].marks.push(e),void Bd.loading();Bd.toLoadAueue.push({url:t,marks:[e]}),Bd.loading()}static improveImageLoading(t){const e=Rd(t,Bd.toLoadAueue);if(-1!==e){const t=Bd.toLoadAueue.splice(e,1);Bd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Rd(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Jt,this._updateTag=yo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;zd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),zd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else zd.x=n,zd.y=r;return zd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;jl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return jl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ae),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&yo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&yo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&yo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&yo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=yo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===bo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Id;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Id;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(jl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:Ac,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:kc),c&&this.setAttributes(c,!1,{type:xo.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:xo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=yo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=yo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&yo.UPDATE_SHAPE_AND_BOUNDS)===yo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=yo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=yo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=yo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=yo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=yo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=yo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=yo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&yo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Od.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Od),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=fl.x,y:e=fl.y,scaleX:i=fl.scaleX,scaleY:s=fl.scaleY,angle:n=fl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ot(a),m=Ft(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),jl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(fl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ld.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),jl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:xo.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=gd(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=gd(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=gd(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Zh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:jl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new pl).fromString(t):this.pathProxy=new pl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",jl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new nc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Nd.mixin(lc);class Vd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Gd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Wd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Ud=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Yd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Wd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Gd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Wd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Vd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Vd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Kd(t,e){return Xd(t)}function Xd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let tu=0;function eu(){return tu++}var iu;function su(t){const e=[];let i=0,s="";for(let n=0;nnu.set(t,!0)));const ru=new Map;function au(t){if(nu.has(t))return!0;if(ru.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>ru.set(t,!0)));const ou=eu(),lu=eu(),hu=eu(),cu=eu(),du=eu(),uu=eu(),pu=eu(),gu=eu(),mu=eu(),fu=eu();eu();const vu=eu();eu();const _u=eu(),yu=eu(),bu=eu(),xu=Symbol.for("GraphicService"),Su=Symbol.for("GraphicCreator"),Au={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},ku=Object.keys(Au);var Mu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Mu||(Mu={}));let Tu=class t extends Nd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=uu,this._childUpdateTag=yo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new $h),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new $h)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===bo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&yo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;jl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),jl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=fl.x,y:e=fl.y,dx:i=fl.dx,dy:s=fl.dy,scaleX:n=fl.scaleX,scaleY:r=fl.scaleY,angle:a=fl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Zh(this).group;this._AABBBounds.clear();const i=jl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Pc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=yo.CLEAR_BOUNDS,this._childUpdateTag&=yo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&yo.UPDATE_BOUNDS||(this._childUpdateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),jl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),jl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,jl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{jl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),jl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&yo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=jl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wu(t){return new Tu(t)}Tu.NOWORK_ANIMATE_ATTR=Hd;class Cu extends Tu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new $h,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{jl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{jl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Eu=Symbol.for("TransformUtil"),Pu=Symbol.for("GraphicUtil"),Bu=Symbol.for("LayerService"),Ru=Symbol.for("StaticLayerHandlerContribution"),Lu=Symbol.for("DynamicLayerHandlerContribution"),Ou=Symbol.for("VirtualLayerHandlerContribution");var Iu,Du=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ju=Iu=class{static GenerateLayerId(){return`${Iu.idprefix}_${Iu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=jl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Ql.get(Ru):"dynamic"===t?Ql.get(Lu):Ql.get(Ou),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Cu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Iu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ju.idprefix="visactor_layer",ju.prefix_count=0,ju=Iu=Du([La(),Fu("design:paramtypes",[])],ju);var zu=new ba((t=>{t(eo).to(ro).inSingletonScope(),t(Ih).to(Fh),t(Pu).to(Nh).inSingletonScope(),t(Eu).to(Wh).inSingletonScope(),t(Bu).to(ju).inSingletonScope()}));function Hu(t,e){return!(!t&&!e)}function Nu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Vu(t,e,i){return i&&t*e>0}function Gu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Wu(t,e){return t*e>0}function Uu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Yu(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Xu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Rt(l-o),c=l>o;let d=!1;if(n=Bt-wt)e.moveTo(i+n*Ot(o),s+n*Ft(o)),e.arc(i,s,n,o,l,!c),r>wt&&(e.moveTo(i+r*Ot(l),s+r*Ft(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*Ot(f),P=n*Ft(f),B=r*Ot(_),R=r*Ft(_);let L,O,I,D;if((T>wt||M>wt)&&(L=n*Ot(v),O=n*Ft(v),I=r*Ot(b),D=r*Ft(b),hwt){const t=Dt(x,w),r=Dt(S,w),o=Ku(I,D,E,P,n,t,Number(c)),l=Ku(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Lt(o.y01,o.x01),Lt(o.y11,o.x11),!c),e.arc(i,s,n,Lt(o.cy+o.y11,o.cx+o.x11),Lt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Lt(l.y11,l.x11),Lt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ot(Lt(l.y01,l.x01)),s+l.cy+r*Ft(Lt(l.y01,l.x01))):e.moveTo(i+L,s+n*Ft(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*Ot(v),s+n*Ft(v));if(!(r>wt)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>wt){const t=Dt(k,C),n=Dt(A,C),o=Ku(B,R,L,O,r,-n,Number(c)),l=Ku(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Lt(o.y01,o.x01),Lt(o.y11,o.x11),!c),e.arc(i,s,r,Lt(o.cy+o.y11,o.cx+o.x11),Lt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Lt(l.y11,l.x11),Lt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ot(Lt(l.y01,l.x01)),s+l.cy+t*Ft(Lt(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*Ot(b),s+r*Ft(b))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class $u{static GetCanvas(){try{return $u.canvas||($u.canvas=jl.global.createCanvas({})),$u.canvas}catch(t){return null}}static GetCtx(){if(!$u.ctx){const t=$u.GetCanvas();$u.ctx=t.getContext("2d")}return $u.ctx}}class qu extends oe{static getInstance(){return qu._instance||(qu._instance=new qu),qu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=$u.GetCanvas(),s=$u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new qu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Zu{static GetSize(t){for(let e=0;e=t)return Zu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Zu.GenKey(t,e,i,s,n),l=Zu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Zu.GenKey(t,e,i,s,n);Zu.cache[l]?Zu.cache[l].push({width:a,height:o,pattern:r}):Zu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Zu.cache={},Zu.ImageSize=[20,40,80,160,320,640,1280,2560];const Ju=Symbol.for("ArcRenderContribution"),Qu=Symbol.for("AreaRenderContribution"),tp=Symbol.for("CircleRenderContribution"),ep=Symbol.for("GroupRenderContribution"),ip=Symbol.for("ImageRenderContribution"),sp=Symbol.for("PathRenderContribution"),np=Symbol.for("PolygonRenderContribution"),rp=Symbol.for("RectRenderContribution"),ap=Symbol.for("SymbolRenderContribution"),op=Symbol.for("TextRenderContribution"),lp=Symbol.for("InteractiveSubRenderContribution"),hp=["radius","startAngle","endAngle",...Id];class cp extends Nd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Zh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=jl.graphicService.updateCircleAABBBounds(i,Zh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Pc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,hp)}needUpdateTag(t){return super.needUpdateTag(t,hp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new pl;return o.arc(0,0,n,r,a),o}clone(){return new cp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cp.NOWORK_ANIMATE_ATTR}}function dp(t){return new cp(t)}function up(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function pp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function gp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}cp.NOWORK_ANIMATE_ATTR=Hd;class mp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=bu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Zh(this).text;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Zh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Hc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=jl.graphicUtil.textMeasure,k=new mp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===iu.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=pp(x,o),M=gp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Zh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Hc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=jl.graphicUtil.textMeasure,y=new mp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Zh(this).text,a=jl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Hc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=It(e,o)}));const t=pp(x,o),e=this.cache.verticalList.length*b,i=gp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>su(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===iu.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=It(e,o)}));const k=pp(x,o),M=this.cache.verticalList.length*b,T=gp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function _p(t){return new vp(t)}vp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Hd),vp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},vp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class yp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function bp(t,e,i,s,n){return n?t.arc(i,s,e,0,Pt,!1,n):t.arc(i,s,e,0,Pt),!1}var xp=new class extends yp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return bp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return bp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Sp=new class extends yp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function Ap(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var kp=new class extends yp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Ap(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return Ap(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ap(t,e/2+n,i,s,r)}};function Mp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Tp=new class extends yp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Mp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Mp(t,e/2+n,i,s)}};class wp extends yp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Cp=new wp;var Ep=new class extends wp{constructor(){super(...arguments),this.type="triangle"}};const Pp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Bp=Math.sin(Pt/10)*Pp,Rp=-Math.cos(Pt/10)*Pp;function Lp(t,e,i,s){const n=Bp*e,r=Rp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Pt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Op=new class extends yp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};const Ip=jt(3);function Dp(t,e,i,s){const n=e,r=n/Ip,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Fp=new class extends yp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Dp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Dp(t,e/2+n,i,s)}};function jp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var zp=new class extends yp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return jp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return jp(t,e/2+n,i,s)}};function Hp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Np=new class extends yp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Hp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Hp(t,e/2+n,i,s)}};const Vp=-.5,Gp=jt(3)/2,Wp=1/jt(12);function Up(t,e,i,s){const n=e/2,r=e*Wp,a=n,o=e*Wp+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Vp*n-Gp*r+i,Gp*n+Vp*r+s),t.lineTo(Vp*a-Gp*o+i,Gp*a+Vp*o+s),t.lineTo(Vp*l-Gp*h+i,Gp*l+Vp*h+s),t.lineTo(Vp*n+Gp*r+i,Vp*r-Gp*n+s),t.lineTo(Vp*a+Gp*o+i,Vp*o-Gp*a+s),t.lineTo(Vp*l+Gp*h+i,Vp*h-Gp*l+s),t.closePath(),!1}var Yp=new class extends yp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Up(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Up(t,e/2+n,i,s)}};var Kp=new class extends yp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var Xp=new class extends yp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends yp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const qp=jt(3);function Zp(t,e,i,s){const n=e*qp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Jp=new class extends wp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Zp(t,e/2/qp,i,s)}drawOffset(t,e,i,s,n){return Zp(t,e/2/qp+n,i,s)}};function Qp(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var tg=new class extends yp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Qp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Qp(t,e/4+n,i,s)}};function eg(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var ig=new class extends yp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return eg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return eg(t,e/4+n,i,s)}};function sg(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var ng=new class extends yp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return sg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return sg(t,e/4+n,i,s)}};function rg(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var ag=new class extends yp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return rg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return rg(t,e/4+n,i,s)}};function og(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var lg=new class extends yp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return og(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return og(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function hg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var cg=new class extends yp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return hg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return hg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function dg(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var ug=new class extends yp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return dg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return dg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function pg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function gg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var mg=new class extends yp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?gg(t,e,i,s):pg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?gg(t,e+2*n,i,s):pg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const fg=new Jt;class vg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;fg.x1=s.bounds.x1*t,fg.y1=s.bounds.y1*t,fg.x2=s.bounds.x2*t,fg.y2=s.bounds.y2*t,e.union(fg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const _g={};[xp,Sp,kp,Tp,Jp,Ep,Op,Fp,zp,Np,Yp,Kp,Xp,Cp,$p,tg,ig,ng,ag,mg,lg,cg,ug].forEach((t=>{_g[t.type]=t}));const yg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},bg=new Jt,xg=["symbolType","size",...Id];let Sg=class t extends Nd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=yu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Zh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=_g[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=yg[i]||i,!0===((n=i).startsWith("{const e=(new pl).fromString(t.d),i={};ku.forEach((e=>{t[e]&&(i[Au[e]]=t[e])})),r.push({path:e,attribute:i}),bg.union(e.bounds)}));const a=bg.width(),o=bg.height(),l=1/It(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new vg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new pl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/It(a,o);return r.transform(0,0,l,l),this._parsedPath=new vg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Zh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=jl.graphicService.updateSymbolAABBBounds(i,Zh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Pc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new pl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new pl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ag(t){return new Sg(t)}Sg.userSymbolMap={},Sg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Hd);const kg=["segments","points","curveType","curveTension",...Id];let Mg=class t extends Nd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ic(i,s,e))}doUpdateAABBBounds(){const t=Zh(this).line;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateLineAABBBounds(e,Zh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,e=new pl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Hd);const wg=["width","x1","y1","height","cornerRadius",...Id];class Cg extends Nd{constructor(t){super(t),this.type="rect",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Zh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateRectAABBBounds(e,Zh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=rd(t),r=new pl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Cg.NOWORK_ANIMATE_ATTR}}function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Hd;class Pg extends Nd{constructor(t){super(t),this.type="glyph",this.numberType=du,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=jl.graphicService.updateGlyphAABBBounds(this.attribute,Zh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Pg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Bg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Hd;class Rg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Lg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Hc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ul(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Hl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ul(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Og=["width","height","image",...Id];class Ig extends Nd{constructor(t){super(t),this.type="image",this.numberType=pu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Zh(this).image;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateImageAABBBounds(e,Zh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Hd);class Fg extends Ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Pc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Pc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Dl.width,height:e=Dl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class jg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Fg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Lg){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof Fg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Kl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof Fg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Fg)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof Fg?t.width:t.getWidthWithEllips(this.direction)})),i}}class zg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Fg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new jg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof Fg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,s=Ul(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==s){const[e,i]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Lg(i,t.newLine,t.character),new Lg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Hg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Id];class Ng extends Nd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=_u}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Il.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Il.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Il.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Il.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Il.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Il.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Il.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Il.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Zh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateRichTextAABBBounds(e,Zh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Il[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Rg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new zg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i,n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s)})),n}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Vg(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Hd);const Gg=["path","customPath",...Id];class Wg extends Nd{constructor(t){super(t),this.type="path",this.numberType=mu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Zh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pl?this.cache:t.path)}doUpdateAABBBounds(){const t=Zh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updatePathAABBBounds(e,Zh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new pl).fromString(t.path):t.customPath&&(this.cache=new pl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){return(new pl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Hd);const Yg=["segments","points","curveType","curveTension",...Id];class Kg extends Nd{constructor(t){super(t),this.type="area",this.numberType=hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Zh(this).area;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateAreaAABBBounds(e,Zh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ic(i,s,e))}getDefaultAttribute(t){return Zh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){const t=new pl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Hd);const $g=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Id];class qg extends Nd{constructor(t){super(t),this.type="arc",this.numberType=ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Zh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Zh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ee(e),i=e+r,s&&Rt(r)wt&&o>wt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Zh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=jt(a*a+o*o)}=this.attribute,h=Rt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>wt&&l>wt){const i=e>t?1:-1;let s=Nt(Number(l)/o*Ft(g)),n=Nt(Number(l)/a*Ft(g));return(m-=2*s)>wt?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>wt?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Zh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=jl.graphicService.updateArcAABBBounds(i,Zh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Pc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}getDefaultAttribute(t){return Zh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Rt(i-e),a=i>e;if(n=Bt-wt)o.moveTo(0+n*Ot(e),0+n*Ft(e)),o.arc(0,0,n,e,i,!a),s>wt&&(o.moveTo(0+s*Ot(i),0+s*Ft(i)),o.arc(0,0,s,i,e,a));else{const t=n*Ot(e),r=n*Ft(e),l=s*Ot(i),h=s*Ft(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Hd);const Jg=["points","cornerRadius",...Id];class Qg extends Nd{constructor(t){super(t),this.type="polygon",this.numberType=fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Zh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updatePolygonAABBBounds(e,Zh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ic(i,s,e))}getDefaultAttribute(t){return Zh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){const t=this.attribute.points,e=new pl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tm(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Hd;class em extends Tu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function im(t){return new em(t)}class sm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class nm extends sm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;Qd(i,s+(r+o)/2,!0,a)}return i}}class rm{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return rm.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};function dm(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function um(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function pm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function gm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),dm(t,t,[n+o,r+l,a+h]),dm(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),dm(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=om.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}dm(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),dm(i,i,[-s[0],-s[1],0]),pm(t,t,i)}}let mm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Qa(["graphic"]),onSetStage:new Qa(["graphic","stage"]),onRemove:new Qa(["graphic"]),onRelease:new Qa(["graphic"]),onAddIncremental:new Qa(["graphic","group","stage"]),onClearIncremental:new Qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new Qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Jt,this.tempAABBBounds2=new Jt,this._rectBoundsContribitions=[new sm],this._symbolBoundsContribitions=[new nm],this._imageBoundsContribitions=[new sm],this._circleBoundsContribitions=[new sm],this._arcBoundsContribitions=[new sm],this._pathBoundsContribitions=[new sm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new oo(t);return Ro(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=gp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=pp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){Qd(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),qt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Bt-wt?i.set(-a,-a,a,a):Lc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=wt?i.set(0,0,0,0):Math.abs(l-h)>Bt-wt?i.set(-n,-n,n,n):(Lc(h,l,n,i),Lc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Qd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Qd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&qt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};mm=lm([La(),cm(0,Ba(Su)),hm("design:paramtypes",[Object])],mm);const fm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let vm,_m;function ym(t){return vm||(vm=fm.CreateGraphic("text",{})),vm.initAttributes(t),vm.AABBBounds}const bm={x:0,y:0,z:0,lastModelMatrix:null};class xm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===wo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===wo.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Vu(o,l,n),p=Wu(o,c),g=Hu(n,r),m=Nu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;bm.x=n,bm.y=r,bm.z=a,bm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=om.allocate(),n=om.allocate();gm(n,t,e),pm(s,d||s,n),bm.x=0,bm.y=0,bm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),om.free(n)}if(g&&!d){const s=t.getOffsetXY(e);bm.x+=s.x,bm.y+=s.y,bm.z=a,i.setTransformForCurrent()}else if(p)bm.x=0,bm.y=0,bm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);bm.x+=s.x,bm.y+=s.y,this.transformWithoutTranslate(i,bm.x,bm.y,bm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),bm.x=0,bm.y=0,bm.z=0;return bm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Zh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Vu(d,u,h),y=Wu(d,g),b=Hu(h),x=Nu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&om.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Sm=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Am{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Am.IsGradientStr(t))try{const e=Sm(t)[0];if(e){if("linear"===e.type)return Am.ParseLinear(e);if("radial"===e.type)return Am.ParseRadial(e);if("conic"===e.type)return Am.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2,n=parseFloat(e.value)/180*Ct-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Bt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2;let n="angular"===e.type?parseFloat(e.value)/180*Ct:0;for(;n<0;)n+=Bt;for(;n>Bt;)n-=Bt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function km(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Mm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var Tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};class Em{constructor(){this.time=wo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Rh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Rh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Pm=new Em;let Bm=class{constructor(t){this.subRenderContribitions=t,this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Bm=Tm([La(),Cm(0,Ba($a)),Cm(0,Oa(lp)),wm("design:paramtypes",[Object])],Bm);class Rm{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Rh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Rh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Bt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Lm=new Rm;const Om=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=km(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Xu(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=km(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Xu(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Im=Lm,Dm=Pm;const Fm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=km(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=km(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},jm=Lm,zm=Pm;const Hm=new class extends Em{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Nm=Ct/2;function Vm(t,e,i,s,n,r){let a;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))a=[r=Rt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Rt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Rt(t[0]),i=Rt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Rt(a[0]),a[1]=Rt(a[1]),a[2]=Rt(a[2]),a[3]=Rt(a[3])}}else a=[0,0,0,0];if(s<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,s,n);const[o,l,h,c]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],d=Math.min(s/2,n/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],m=[l[0]-u[1],l[1]],f=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],y=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(m[0],m[1]),!q(m,f)){const e=m[0],i=m[1]+u[1];t.arc(e,i,u[1],-Nm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Nm,!1)}if(t.lineTo(y[0],y[1]),!q(y,b)){const e=y[0],i=y[1]-u[3];t.arc(e,i,u[3],Nm,Ct,!1)}if(t.lineTo(g[0],g[1]),!q(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],Ct,Ct+Nm,!1)}return t.closePath(),t}var Gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Wm{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=km(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Vm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=km(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Vm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Um=class{constructor(){this.time=wo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Um=Gm([La()],Um);let Ym=class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke}=t.attribute;let{width:v,height:_}=t.attribute;if(v=(null!=v?v:u-g)||0,_=(null!=_?_:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+v,s):e.moveTo(i+v,s),f[1]?e.lineTo(i+v,s+_):e.moveTo(i+v,s+_),f[2]?e.lineTo(i,s+_):e.moveTo(i,s+_),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Ym=Gm([La()],Ym);const Km=new Wm,Xm=Lm,$m=Pm;const qm=new class extends Wm{constructor(){super(...arguments),this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Zm=new class extends Em{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Pc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Vm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Jm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=km(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=km(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Qm=Lm,tf=Pm;var ef=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nf=function(t,e){return function(i,s){e(i,s,t)}};let rf=class extends xm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Rt(d-c),p=d>c;let g=!1;if(nwt||C>wt)&&(D=n*Ot(x),F=n*Ft(x),j=r*Ot(A),z=r*Ft(A),uwt){const t=Dt(k,P),r=Dt(M,P),a=Ku(j,z,R,L,n,t,Number(p)),o=Ku(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Lt(o.y11,o.x11),Lt(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>wt)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>wt){const t=Dt(w,B),n=Dt(T,B),a=Ku(O,I,D,F,r,-n,Number(p)),o=Ku(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Lt(a.y01,a.x01),Lt(a.y11,a.x11),!p);const t=Lt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*Ot(A),s+r*Ft(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Rt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Cc[s]=t,i&&(i=!(null!==(e=Cc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Cc[e]=!!t[e],i&&(i=!!Cc[e]);else Cc[0]=!1,Cc[1]=!1,Cc[2]=!1,Cc[3]=!1;return{isFullStroke:i,stroke:Cc}})(d);if((v||C)&&(e.beginPath(),Xu(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),Xu(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Rt(h-r)>=Bt-wt){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Bt;for(;i>Bt;)i-=Bt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),gd(o.color,l.color,h,!1)}(0,0,h,n);a||Vu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};rf=ef([La(),nf(0,Ba($a)),nf(0,Oa(Ju)),sf("design:paramtypes",[Object])],rf);var af=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},of=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lf=function(t,e){return function(i,s){e(i,s,t)}};let hf=class extends xm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Fm,zm,jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function cf(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Fo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function df(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),cf(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=Mo.ROW:"y"===s?m=Mo.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pf=class extends xm{constructor(){super(...arguments),this.numberType=gu}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;df(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),df(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ul(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function gf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function mf(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),cf(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),cf(t,l,1,s),o=!1):o=!0}t.closePath()}pf=uf([La()],pf);const ff=new class extends Rm{constructor(){super(...arguments),this.time=wo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Fc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Fc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Fc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Fc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},vf=Pm;var _f=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bf=function(t,e){return function(i,s){e(i,s,t)}};function xf(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return $o(t,i);case"monotoneX":return il(t,i);case"monotoneY":return sl(t,i);case"step":return rl(t,.5,i);case"stepBefore":return rl(t,0,i);case"stepAfter":return rl(t,1,i);case"catmullRom":return cl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ol(t,i)}}let Sf=class extends xm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=hu,this.builtinContributions=[ff,vf],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Zh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S,doStroke:A}=x,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=xf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=xf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=xf(e,C,{curveTension:b}),n=xf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=Mo.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Rt(E.x-P.x),L=Rt(E.y-P.y);B=null==E.x1?Mo.ROW:null==E.y1?Mo.COLUMN:Number.isFinite(R+L)?R>L?Mo.ROW:Mo.COLUMN:Mo.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),gf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),gf(t,e,i,s),e.length=0,i.length=0)}n=o})),gf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?Mo.ROW:Mo.COLUMN,Number.isFinite(u)||(h=Mo.COLUMN),Number.isFinite(p)||(h=Mo.ROW);const g=i*(h===Mo.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wf=function(t,e){return function(i,s){e(i,s,t)}};let Cf=class extends xm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=mu,this.builtinContributions=[kf,Af],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,g);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cf=Mf([La(),wf(0,Ba($a)),wf(0,Oa(sp)),Tf("design:paramtypes",[Object])],Cf);var Ef=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bf=function(t,e){return function(i,s){e(i,s,t)}};let Rf=class extends xm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=vu,this.builtinContributions=[Km,$m,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Gu(g,m,k,M,c),w=Uu(g,v,k,M),C=Hu(c,d),E=Nu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Vm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Rf=Ef([La(),Bf(0,Ba($a)),Bf(0,Oa(rp)),Pf("design:paramtypes",[Object])],Rf);var Lf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Of=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},If=function(t,e){return function(i,s){e(i,s,t)}};let Df=class extends xm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=yu,this.builtinContributions=[Jm,tf,Qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Zh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Df=Lf([La(),If(0,Ba($a)),If(0,Oa(ap)),Of("design:paramtypes",[Object])],Df);const Ff=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Jt)}allocate(t,e,i,s){if(!this.pools.length)return(new Jt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Jt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const jf=new class extends Em{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=Ff.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=ym(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Vm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&Ff.free(C),w()}};var zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nf=function(t,e){return function(i,s){e(i,s,t)}};let Vf=class extends xm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=bu,this.builtinContributions=[jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Zh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Hc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=am.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),am.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=It(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=pp(l,f),_=gp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=gp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Gf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qf=function(t,e){return function(i,s){e(i,s,t)}};let Zf=class extends xm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Kf,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Gf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Gf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Wf(d,u),b=Wf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Uf(h,_,y,d,u),A=Uf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Wf(k,M),w=Uf(h,Wf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Zf=Xf([La(),qf(0,Ba($a)),qf(0,Oa(np)),$f("design:paramtypes",[Object])],Zf);var Jf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tv=function(t,e){return function(i,s){e(i,s,t)}};let ev=class{constructor(t){this.groupRenderContribitions=t,this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Gu(u,f,p,g,h),k=Uu(u,v,p,g),M=Hu(h,c),T=Nu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Vm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Hm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===wo.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===wo.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave(),n.baseGlobalAlpha*=a;const o=Zh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=om.allocate(),i=om.allocate();gm(i,t,o),pm(e,l||e,i),n.modelMatrix=e,om.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&n.translate(h,c),s&&s.drawingCb&&(d=s.drawingCb()),n.modelMatrix!==l&&om.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};ev=Jf([La(),tv(0,Ba($a)),tv(0,Oa(ep)),Qf("design:paramtypes",[Object])],ev);var iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nv=function(t,e){return function(i,s){e(i,s,t)}};const rv=["","repeat-x","repeat-y","repeat"];let av=class extends xm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=pu,this.builtinContributions=[qm,Zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Vm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,rv[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Bd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Zh(t).image;this._draw(t,a,!1,i)}};av=iv([La(),nv(0,Ba($a)),nv(0,Oa(ip)),sv("design:paramtypes",[Object])],av);const ov=Symbol.for("IncrementalDrawContribution"),lv=Symbol.for("ArcRender"),hv=Symbol.for("AreaRender"),cv=Symbol.for("CircleRender"),dv=Symbol.for("GraphicRender"),uv=Symbol.for("GroupRender"),pv=Symbol.for("LineRender"),gv=Symbol.for("PathRender"),mv=Symbol.for("PolygonRender"),fv=Symbol.for("RectRender"),vv=Symbol.for("SymbolRender"),_v=Symbol.for("TextRender"),yv=Symbol.for("RichTextRender"),bv=Symbol.for("GlyphRender"),xv=Symbol.for("ImageRender"),Sv=Symbol.for("DrawContribution");var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Mv=Symbol.for("DrawItemInterceptor"),Tv=new Jt,wv=new Jt;class Cv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Tv.copy(s.dirtyBounds),wv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Tv),s.backupDirtyBounds.copy(wv)),!0}}class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Pv=class{constructor(){this.order=1,this.interceptors=[new Cv,new Rv,new Bv,new Ev]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===lu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&om.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Lv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ov=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iv=function(t,e){return function(i,s){e(i,s,t)}};const Dv=Symbol.for("RenderService");let Fv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Fv=Lv([La(),Iv(0,Ba(Sv)),Ov("design:paramtypes",[Object])],Fv);var jv=new ba((t=>{t(Dv).to(Fv)}));const zv=Symbol.for("PickerService"),Hv=Symbol.for("GlobalPickerService");var Nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Vv=Symbol.for("PickItemInterceptor");let Gv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Zh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=am.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Gv=Nv([La()],Gv);let Wv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Wv=Nv([La()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===lu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Uv=Nv([La()],Uv);var Yv=new ba(((t,e,i)=>{i(zv)||(t(Hv).toSelf(),t(zv).toService(Hv)),t(Uv).toSelf().inSingletonScope(),t(Vv).toService(Uv),t(Gv).toSelf().inSingletonScope(),t(Vv).toService(Gv),t(Wv).toSelf().inSingletonScope(),t(Vv).toService(Wv),Za(t,Vv)})),Kv=new ba((t=>{t(xu).to(mm).inSingletonScope(),t(Su).toConstantValue(fm)}));const Xv=Symbol.for("AutoEnablePlugins"),$v=Symbol.for("PluginService");var qv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jv=function(t,e){return function(i,s){e(i,s,t)}};let Qv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Ql.isBound(Xv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Qv=qv([La(),Jv(0,Ba($a)),Jv(0,Oa(Xv)),Zv("design:paramtypes",[Object])],Qv);var t_=new ba((t=>{t($v).to(Qv),function(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).whenTargetNamed(e)}(t,Xv)})),e_=new ba((t=>{Za(t,to)})),i_=new ba((t=>{t(Zl).to(Jl).inSingletonScope(),Za(t,Zl)})),s_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let r_=class{constructor(){this.type="static",this.offscreen=!1,this.global=jl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=ih({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};r_=s_([La(),n_("design:paramtypes",[])],r_);var a_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let l_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=jl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};l_=a_([La(),o_("design:paramtypes",[])],l_);var h_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},c_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let d_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=jl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=ih({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};d_=h_([La(),c_("design:paramtypes",[])],d_);var u_=new ba((t=>{t(r_).toSelf(),t(d_).toSelf(),t(l_).toSelf(),t(Ru).toService(r_),t(Lu).toService(d_),t(Ou).toService(l_)}));var p_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function g_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return p_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function f_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}};let b_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Zt,this.backupDirtyBounds=new Zt,this.global=jl.global,this.layerService=jl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Re(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Al.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Al.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,am.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=f_(e,i,Al.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Oe(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=Ff.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=am.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):g_(t,Al.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Ff.free(n),am.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Ql.get(ov);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class extends pf{constructor(){super(...arguments),this.numberType=gu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Zh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Vu(u,p,c),_=Wu(u,g),y=Hu(c),b=Nu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};S_=x_([La()],S_);var A_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let k_=class extends Sf{constructor(){super(...arguments),this.numberType=hu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Zh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Vu(u,d,c),m=Hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};k_=A_([La()],k_);var M_,T_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},w_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}},E_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(M_||(M_={}));let P_=class extends b_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=M_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return E_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Al.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Al.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return E_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return E_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>E_(this,void 0,void 0,(function*(){if(2!==t.count)yield m_(t,Al.zIndex,((i,s)=>{if(this.status===M_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return E_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return E_(this,void 0,void 0,(function*(){this.rendering&&(this.status=M_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=M_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return E_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>E_(this,void 0,void 0,(function*(){yield m_(t,Al.zIndex,(t=>E_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};P_=T_([La(),C_(0,Ra(dv)),C_(1,Ba(S_)),C_(2,Ba(k_)),C_(3,Ba($a)),C_(3,Oa(Mv)),w_("design:paramtypes",[Array,Object,Object,Object])],P_);var B_=new ba((t=>{t(Em).toSelf().inSingletonScope(),t(Rm).toSelf().inSingletonScope(),t(Sv).to(b_),t(ov).to(P_),t(uv).to(ev).inSingletonScope(),t(dv).toService(uv),Za(t,ep),t(Bm).toSelf().inSingletonScope(),Za(t,lp),Za(t,dv),t(Pv).toSelf().inSingletonScope(),t(Mv).toService(Pv),Za(t,Mv)}));function R_(){R_.__loaded||(R_.__loaded=!0,Ql.load(zu),Ql.load(Kv),Ql.load(jv),Ql.load(Yv),Ql.load(t_),function(t){t.load(e_),t.load(i_),t.load(u_)}(Ql),function(t){t.load(B_)}(Ql))}R_.__loaded=!1,R_();const L_=Ql.get(eo);jl.global=L_;const O_=Ql.get(Pu);jl.graphicUtil=O_;const I_=Ql.get(Eu);jl.transformUtil=I_;const D_=Ql.get(xu);jl.graphicService=D_;const F_=Ql.get(Bu);jl.layerService=F_;class j_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,jl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),jl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){jl.graphicService.hooks.onAttributeUpdate.taps=jl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onSetStage.taps=jl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class z_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class H_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,jl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),jl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){jl.graphicService.hooks.onAddIncremental.taps=jl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onClearIncremental.taps=jl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,jl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class N_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onRemove.unTap(this.key),jl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?jl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:jl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[si(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=si(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Zh(t).text)}getTransformOfText(t){const e=Zh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=Qe(h,c);o=t.x,l=t.y}const p=jl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));jl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===jl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Al.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Al.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&jl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===jl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const V_=new Jt;class G_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),jl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(V_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(V_,t.parent&&t.parent.globalTransMatrix)))})),jl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),jl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){jl.graphicService.hooks.beforeUpdateAABBBounds.taps=jl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.afterUpdateAABBBounds.taps=jl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onRemove.taps=jl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const W_=new Jt;class U_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ya.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Jt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Zh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,jl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),jl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&W_.copy(s)})),jl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(W_.equals(i)||this.tryLayout(t,!1))})),jl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){jl.graphicService.hooks.onAttributeUpdate.taps=jl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.beforeUpdateAABBBounds.taps=jl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.afterUpdateAABBBounds.taps=jl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onSetStage.taps=jl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const Y_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===gc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=gc.INITIAL,jl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),jl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:uc},{mode:"manual",cons:dc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==gc.INITIAL&&(this.status=gc.PAUSE,!0)}resume(){return this.status!==gc.INITIAL&&(this.status=gc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===gc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===gc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=gc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=gc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Y_.addTimeline(vc),Y_.setFPS(60);class K_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ud.Get(e,dd.Color1),this.ambient=i;const s=jt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Dt(It((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?ud.Get(e,dd.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function X_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function $_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class q_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=om.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=om.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&jl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ty="white";class ey extends Tu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ty}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new $h,this.hooks={beforeRender:new Qa(["stage"]),afterRender:new Qa(["stage"])},this.global=jl.global,!this.global.env&&J_()&&this.global.setEnv("browser"),this.window=Ql.get(Ih),this.renderService=Ql.get(Dv),this.pluginService=Ql.get($v),this.layerService=Ql.get(Bu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ty,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Y_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new cc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new K_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new q_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new z_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new j_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new H_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Zt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new G_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new U_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new N_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new Q_))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=Ql.get(zv));const i=this.pickerService.pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Ql.get(Ih),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ny=new ae(1,0,0,1,0,0),ry={x:0,y:0};let ay=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this.path=new pl,this._clearMatrix=new ae(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return am.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ry),function(t,e,i){return Bh(t,0,!1,e,i)}(this.path.commandList,ry.x,ry.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ry);const i=km(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Bh(t,e,!0,i,s)}(this.path.commandList,i,ry.x,ry.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ny,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>am.free(t))),this.stack.length=0}};ay=iy([La(),sy("design:paramtypes",[Object,Number])],ay);var oy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const hy={WIDTH:500,HEIGHT:500,DPR:1};let cy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=hy.WIDTH,height:n=hy.HEIGHT,dpr:r=hy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};cy.env="browser",cy=oy([La(),ly("design:paramtypes",[Object])],cy);var dy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uy=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Jt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};uy=dy([La()],uy);var py=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let my=class{constructor(){this._uid=ya.GenAutoIncrementId(),this.viewBox=new Jt,this.modelMatrix=new ae(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};my=py([La(),gy("design:paramtypes",[])],my);var fy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_y=function(t,e){return function(i,s){e(i,s,t)}};let yy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=jl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Jt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ae(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=om.allocate();if(um(i,e),a){if(i){const t=om.allocate();r.modelMatrix=pm(t,a,i),om.free(i)}}else um(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Zh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Zh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&om.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),am.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function by(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&by(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&by(t,a,i,s,n))}function xy(t,e){const i=t.length-1,s=[t[0]];return by(t,0,i,e,s),s.push(t[i]),s}yy=fy([La(),_y(0,Ba($a)),_y(0,Oa(Vv)),vy("design:paramtypes",[Object])],yy);let Sy=!1;const Ay=new ba((t=>{Sy||(Sy=!0,t(rf).toSelf().inSingletonScope(),t(lv).to(rf).inSingletonScope(),t(dv).toService(lv),t(Ju).toService(Bm),Za(t,Ju))}));let ky=!1;const My=new ba((t=>{ky||(ky=!0,t(Rf).toSelf().inSingletonScope(),t(fv).to(Rf).inSingletonScope(),t(dv).toService(fv),t(Ym).toSelf(),t(Um).toSelf(),t(rp).toService(Ym),t(rp).toService(Um),t(rp).toService(Bm),Za(t,rp))}));let Ty=!1;const wy=new ba((t=>{Ty||(Ty=!0,t(pf).toSelf().inSingletonScope(),t(S_).toSelf().inSingletonScope(),t(pv).to(pf).inSingletonScope(),t(dv).toService(pv))}));let Cy=!1;const Ey=new ba((t=>{Cy||(Cy=!0,t(Sf).toSelf().inSingletonScope(),t(hv).to(Sf).inSingletonScope(),t(dv).toService(hv),t(Qu).toService(Bm),Za(t,Qu),t(k_).toSelf().inSingletonScope())}));let Py=!1;const By=new ba((t=>{Py||(Py=!0,t(Df).toSelf().inSingletonScope(),t(vv).to(Df).inSingletonScope(),t(dv).toService(vv),t(ap).toService(Bm),Za(t,ap))}));let Ry=!1;const Ly=new ba((t=>{Ry||(Ry=!0,t(hf).toSelf().inSingletonScope(),t(cv).to(hf).inSingletonScope(),t(dv).toService(cv),t(tp).toService(Bm),Za(t,tp))}));let Oy=!1;const Iy=new ba((t=>{Oy||(Oy=!0,t(_v).to(Vf).inSingletonScope(),t(dv).toService(_v),t(op).toService(Bm),Za(t,op))}));let Dy=!1;const Fy=new ba((t=>{Dy||(Dy=!0,t(Cf).toSelf().inSingletonScope(),t(gv).to(Cf).inSingletonScope(),t(dv).toService(gv),t(sp).toService(Bm),Za(t,sp))}));let jy=!1;const zy=new ba((t=>{jy||(jy=!0,t(mv).to(Zf).inSingletonScope(),t(dv).toService(mv),t(np).toService(Bm),Za(t,np))}));var Hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ny=class{constructor(){this.numberType=du}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Zh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Ny=Hy([La()],Ny);let Vy=!1;const Gy=new ba((t=>{Vy||(Vy=!0,t(bv).to(Ny).inSingletonScope(),t(dv).toService(bv))}));var Wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yy=class extends xm{constructor(){super(),this.numberType=_u,this.builtinContributions=[jf],this.init()}drawShape(t,e,i,s,n){const r=Zh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Vu(o,l,!0),d=Vu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Zh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Vm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Zh(t).richtext;this._draw(t,s,!1,i)}};Yy=Wy([La(),Uy("design:paramtypes",[])],Yy);let Ky=!1;const Xy=new ba((t=>{Ky||(Ky=!0,t(yv).to(Yy).inSingletonScope(),t(dv).toService(yv))}));let $y=!1;const qy=new ba((t=>{$y||($y=!0,t(xv).to(av).inSingletonScope(),t(dv).toService(xv),t(ip).toService(Bm),Za(t,ip))}));const Zy=(t,e)=>(d(Qy.warnHandler)&&Qy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Jy=(t,e,i)=>{if(!d(Qy.errorHandler))throw new Error(t);Qy.errorHandler.call(null,t,e)},Qy={silent:!1,warnHandler:!1,errorHandler:!1},tb=J_(),eb=tb&&globalThis?globalThis.document:void 0;function ib(t){return("desktop-browser"===t||"mobile-browser"===t)&&tb}function sb(t){return nb(t)||"mobile-browser"===t}function nb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let rb=0;function ab(){return rb>=9999999&&(rb=0),rb++}function ob(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function lb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const hb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),cb=t=>e=>R(e,t),db=t=>{rt.getInstance().error(t)},ub=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||db("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&db("Access path missing closing bracket: "+t),a&&db("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return hb((i&&i.get||cb)(s),[n],e||n)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>ub(t,e,i)));return t=>s.map((e=>e(t)))}return ub(t,e,i)};pb("id");const gb=hb((function(t){return t}),[],"identity"),mb=hb((function(){return 0}),[],"zero");hb((function(){return 1}),[],"one"),hb((function(){return!0}),[],"true"),hb((function(){return!1}),[],"false"),hb((function(){return{}}),[],"emptyObject");const fb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>vb(t,r,n)))))},_b=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function yb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function bb(t,e,i,s,n){let r=0,a=0;return yb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function xb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;yb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:bb(t,e,i,n,h)}}function Sb(t){return"horizontal"===t}function Ab(t){return"vertical"===t}const kb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Mb extends Tu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,kb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>kb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const Qb=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},tx=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ex extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=rc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=rc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Qb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=tx(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=rc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=tx(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=Qb(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=rc.now()-i>this.config.press.time&&tx(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const nx=[0,0,0];let rx=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},vl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},yl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this._clearMatrix=new ae(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ae(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return am.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Bt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Zu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&($_(nx,[t,e,i],this.modelMatrix),t=nx[0],e=nx[1],i=nx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&($_(nx,[t,e,i],this.modelMatrix),t=nx[0],e=nx[1],i=nx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&($_(nx,[e,i,s],this.modelMatrix),e=nx[0],i=nx[1],s=nx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=jl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:bl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:bl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&($_(nx,[e,i,s],this.modelMatrix),e=nx[0],i=nx[1],s=nx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=Mm(this,l,t,i,s)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=km(this,l,this.dpr),r.strokeStyle=Mm(this,h,t,i,s),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=up(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=up(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>am.free(t))),this.stack.length=0}};rx.env="browser",rx=ix([La(),sx("design:paramtypes",[Object,Number])],rx);var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=class extends cy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=jl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new rx(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function hx(t,e){return new ba((i=>{i(th).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(eh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}lx.env="browser",lx=ax([La(),ox("design:paramtypes",[Object])],lx);const cx=hx(lx,rx);var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends yy{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Rh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fx=class{constructor(){this.type="group",this.numberType=uu}contains(t,e,i){return!1}};fx=mx([La()],fx);const vx=new ba(((t,e,i,s)=>{vx.__vloaded||(vx.__vloaded=!0,t(qb).to(fx).inSingletonScope(),t(Zb).toService(qb),Za(t,Zb))}));vx.__vloaded=!1;var _x=vx;const yx=new ba(((t,e,i,s)=>{i(gx)||t(gx).toSelf().inSingletonScope(),i(zv)?s(zv).toService(gx):t(zv).toService(gx)}));var bx,xx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ax=bx=class extends my{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${bx.idprefix}_${bx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=jl.global,this.viewBox=new Jt,this.modelMatrix=new ae(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:bx.GenerateCanvasId(),canvasControled:!0};this.canvas=new lx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new lx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Ax.env="browser",Ax.idprefix="visactor_window",Ax.prefix_count=0,Ax=bx=xx([La(),Sx("design:paramtypes",[])],Ax);const kx=new ba((t=>{t(Ax).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(Ax))).whenTargetNamed(Ax.env)}));var Mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends uy{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Jt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ya.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Mx([La(),Tx("design:paramtypes",[])],Px);const Bx=new ba((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(to).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(cx),t.load(kx),e&&function(t){t.load(_x),t.load(yx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ix=function(t,e){return function(i,s){e(i,s,t)}};let Dx=class extends yy{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new ay(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Dx=Lx([La(),Ix(0,Ba($a)),Ix(0,Oa(Tb)),Ix(1,Ba($a)),Ix(1,Oa(Vv)),Ox("design:paramtypes",[Object,Object])],Dx);const Fx=new ba((t=>{Fx.__vloaded||(Fx.__vloaded=!0,Za(t,Tb))}));Fx.__vloaded=!1;var jx=Fx,zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Vx=zx([La(),Nx(0,Ba(lv)),Hx("design:paramtypes",[Object])],Vx);let Gx=!1;const Wx=new ba(((t,e,i,s)=>{Gx||(Gx=!0,t(wb).to(Vx).inSingletonScope(),t(Tb).toService(wb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};Xx=Ux([La(),Kx(0,Ba(hv)),Yx("design:paramtypes",[Object])],Xx);let $x=!1;const qx=new ba(((t,e,i,s)=>{$x||($x=!0,t(Cb).to(Xx).inSingletonScope(),t(Tb).toService(Cb))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([La(),Qx(0,Ba(cv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new ba(((t,e,i,s)=>{eS||(eS=!0,t(Eb).to(tS).inSingletonScope(),t(Tb).toService(Eb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};aS=sS([La(),rS(0,Ba(bv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new ba(((t,e,i,s)=>{oS||(oS=!0,t(Fb).to(aS).inSingletonScope(),t(aS).toService(Fb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cS=class{constructor(){this.type="image",this.numberType=pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};cS=hS([La()],cS);let dS=!1;const uS=new ba(((t,e,i,s)=>{dS||(dS=!0,t(Pb).to(cS).inSingletonScope(),t(cS).toService(Pb))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=gu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};fS=pS([La(),mS(0,Ba(pv)),gS("design:paramtypes",[Object])],fS);let vS=!1;const _S=new ba(((t,e,i,s)=>{vS||(vS=!0,t(Bb).to(fS).inSingletonScope(),t(Tb).toService(Bb))}));var yS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xS=function(t,e){return function(i,s){e(i,s,t)}};let SS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};SS=yS([La(),xS(0,Ba(mv)),bS("design:paramtypes",[Object])],SS);let AS=!1;const kS=new ba(((t,e,i,s)=>{AS||(AS=!0,t(Db).to(SS).inSingletonScope(),t(Tb).toService(Db))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([La(),wS(0,Ba(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new ba(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(Tb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};const OS=new Jt;let IS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;OS.setValue(i.x1,i.y1,i.x2,i.y2),OS.expand(-r/2),h=!OS.containsPoint(e)}}return s.highPerformanceRestore(),h}};IS=BS([La(),LS(0,Ba(fv)),RS("design:paramtypes",[Object])],IS);let DS=!1;const FS=new ba(((t,e,i,s)=>{DS||(DS=!0,t(Lb).to(IS).inSingletonScope(),t(Tb).toService(Lb))}));let jS=!1;const zS=new ba(((t,e,i,s)=>{jS||(jS=!0,t(Pb).to(cS).inSingletonScope(),t(cS).toService(Pb))}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VS=function(t,e){return function(i,s){e(i,s,t)}};let GS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=yu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};GS=HS([La(),VS(0,Ba(vv)),NS("design:paramtypes",[Object])],GS);let WS=!1;const US=new ba(((t,e,i,s)=>{WS||(WS=!0,t(Ob).to(GS).inSingletonScope(),t(Tb).toService(Ob))}));var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KS=class{constructor(){this.type="text",this.numberType=bu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};KS=YS([La()],KS);let XS=!1;const $S=new ba(((t,e,i,s)=>{XS||(XS=!0,t(Ib).to(KS).inSingletonScope(),t(Tb).toService(Ib))})),qS=new ba(((t,e,i,s)=>{i(Dx)||t(Dx).toSelf().inSingletonScope(),i(zv)?s(zv).toService(Dx):t(zv).toService(Dx)}));var ZS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let QS=class extends rx{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};QS.env="node",QS=ZS([La(),JS("design:paramtypes",[Object,Number])],QS);var tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let iA=class extends cy{constructor(t){super(t)}init(){this._context=new QS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};iA.env="node",iA=tA([La(),eA("design:paramtypes",[Object])],iA);const sA=hx(iA,QS);var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends my{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ya.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new iA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new iA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};oA.env="node",oA=nA([La(),aA(0,Ba(eo)),rA("design:paramtypes",[Object])],oA);const lA=new ba((t=>{t(oA).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(oA))).whenTargetNamed(oA.env)}));var hA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cA=class extends uy{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return zc.call(t)}}getCancelAnimationFrame(){return t=>{zc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};cA=hA([La()],cA);const dA=new ba((t=>{dA.isNodeBound||(dA.isNodeBound=!0,t(cA).toSelf().inSingletonScope(),t(to).toService(cA))}));function uA(t){uA.__loaded||(uA.__loaded=!0,t.load(dA),t.load(sA),t.load(lA))}dA.isNodeBound=!1,uA.__loaded=!1;var pA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gA=class extends rx{draw(){}createPattern(t,e){return null}};gA.env="wx",gA=pA([La()],gA);var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends cy{constructor(t){super(t)}init(){this._context=new gA(this,this._dpr)}release(){}};vA.env="wx",vA=mA([La(),fA("design:paramtypes",[Object])],vA);const _A=hx(vA,gA);var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};class SA{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let AA=class extends my{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new SA}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ya.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new vA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new vA({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};AA.env="wx",AA=yA([La(),xA(0,Ba(eo)),bA("design:paramtypes",[Object])],AA);const kA=new ba((t=>{t(AA).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(AA))).whenTargetNamed(AA.env)}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wA=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let CA=class extends uy{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return wA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return zc.call(t)}}getCancelAnimationFrame(){return t=>{zc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CA=MA([La(),TA("design:paramtypes",[])],CA);const EA=new ba((t=>{EA._isWxBound||(EA._isWxBound=!0,t(CA).toSelf().inSingletonScope(),t(to).toService(CA))}));function PA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(_A),t.load(kA),e&&function(t){t.load(jx),t.load(qS),t.load(Wx),t.load(qx),t.load(iS),t.load(lS),t.load(uS),t.load(_S),t.load(kS),t.load(PS),t.load(FS),t.load(zS),t.load(US),t.load($S)}(t))}EA._isWxBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([La(),LA(0,Ba(lv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new ba(((t,e,i,s)=>{IA||(IA=!0,t(jb).to(OA).inSingletonScope(),t(Zb).toService(jb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Jt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([La(),zA(0,Ba(fv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new ba(((t,e,i,s)=>{VA||(VA=!0,t(Wb).to(NA).inSingletonScope(),t(Zb).toService(Wb))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends xm{};UA=WA([La()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=gu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Zh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=km(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&om.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([La(),XA(0,Ba(pv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new ba(((t,e,i,s)=>{qA||(qA=!0,t(Vb).to($A).inSingletonScope(),t(Zb).toService(Vb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([La(),tk(0,Ba(hv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new ba(((t,e,i,s)=>{ik||(ik=!0,t(zb).to(ek).inSingletonScope(),t(Zb).toService(zb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=yu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Zh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=km(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&om.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([La(),ak(0,Ba(vv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new ba(((t,e,i,s)=>{lk||(lk=!0,t(Ub).to(ok).inSingletonScope(),t(Zb).toService(Ub))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([La(),uk(0,Ba(cv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new ba(((t,e,i,s)=>{gk||(gk=!0,t(Hb).to(pk).inSingletonScope(),t(Zb).toService(Hb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Zh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=gp(a,u,n),v=pp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&om.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([La(),_k(0,Ba(_v)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new ba(((t,e,i,s)=>{bk||(bk=!0,t(Yb).to(yk).inSingletonScope(),t(Zb).toService(Yb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=km(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&om.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([La(),kk(0,Ba(gv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new ba(((t,e,i,s)=>{Tk||(Tk=!0,t(Gb).to(Mk).inSingletonScope(),t(Zb).toService(Gb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([La(),Pk(0,Ba(mv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new ba(((t,e,i,s)=>{Rk||(Rk=!0,t(Kb).to(Bk).inSingletonScope(),t(Zb).toService(Kb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([La(),Dk(0,Ba(bv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new ba(((t,e,i,s)=>{jk||(jk=!0,t($b).to(Fk).inSingletonScope(),t(Zb).toService($b))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=_u}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([La(),Vk(0,Ba(yv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new ba(((t,e,i,s)=>{Wk||(Wk=!0,t(Xb).to(Gk).inSingletonScope(),t(Zb).toService(Xb))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([La()],Kk);let Xk=!1;const $k=new ba(((t,e,i,s)=>{Xk||(Xk=!0,t(Nb).to(Kk).inSingletonScope(),t(Zb).toService(Nb))})),qk=J_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,fm.RegisterGraphicCreator("arc",Zg),Ql.load(Ay),Ql.load(qk?DA:Wx))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,fm.RegisterGraphicCreator("area",Xg),Ql.load(Ey),Ql.load(qk?sk:qx))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,fm.RegisterGraphicCreator("circle",dp),Ql.load(Ly),Ql.load(qk?mk:iS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,fm.RegisterGraphicCreator("glyph",Bg),Ql.load(Gy),Ql.load(qk?zk:lS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,fm.RegisterGraphicCreator("group",wu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,fm.RegisterGraphicCreator("image",Dg),Ql.load(qy),Ql.load(qk?$k:uS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,fm.RegisterGraphicCreator("line",Tg),Ql.load(wy),Ql.load(qk?ZA:_S))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,fm.RegisterGraphicCreator("path",Ug),Ql.load(Fy),Ql.load(qk?wk:PS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,fm.RegisterGraphicCreator("polygon",tm),Ql.load(zy),Ql.load(qk?Lk:kS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,fm.RegisterGraphicCreator("rect",Eg),Ql.load(My),Ql.load(qk?GA:FS))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,fm.RegisterGraphicCreator("richtext",Vg),Ql.load(Xy),Ql.load(qk?Uk:zS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,fm.RegisterGraphicCreator("shadowRoot",im))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,fm.RegisterGraphicCreator("symbol",Ag),Ql.load(By),Ql.load(qk?hk:US))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,fm.RegisterGraphicCreator("text",_p),Ql.load(Iy),Ql.load(qk?xk:$S))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:bt,throttle:xt};MM();let LM=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ft(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ft(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===L_.env?(L_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),L_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vt(o,s[0],s[1])}),"browser"===L_.env?(L_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),L_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ti(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ti(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ve(t).toHex(),o=new ve(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=ve.getColorBrightness(new ve(e));return ve.getColorBrightness(new ve(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=ye(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Je(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:ym,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=ym({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?fm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),fm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new pl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new pl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GAe&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce])),Se>Te&&AeCe&&MeSe&&weke&&EeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Ct/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Ct/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Ct/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Ct/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Ct/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Ct/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Ct,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Ct,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Ct,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([La()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([La()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([La()],uT);const pT=new ba(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(lp).toService(hT)),i(dT)||(t(dT).toSelf(),t(Xv).toService(dT)),i(uT)||(t(uT).toSelf(),t(Xv).toService(uT))}));class gT extends Mb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=$t.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=te(se(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ie(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=$t.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=ft(i,0,t.width),o=ft(s,0,t.width),l=ft(n,0,t.height),h=ft(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Nc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Mb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===xo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===xo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Oe(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=fm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new pl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==xo.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===xo.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,bo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=Qe(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,pt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,l+c)||pt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(ut(l/2,u))g=0,m=1,f=-p;else if(ut(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new pl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Mb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Mb{getStartAngle(){return ne(this._startAngle)}getEndAngle(){return ne(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=fm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=fm.line;Y(i)[0].cornerRadius&&(t=fm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=fm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=fm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function lw(t,e,i){return!gt(t,e,0,1e-6)&&!pt(t,i,0,1e-6)}function hw(t,e,i,s){const n=ym(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const pw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},gw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,mw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class fw extends Mb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=pw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=fm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=fm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=fm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=fm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=fm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=fm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=fm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=fm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Rt(s[0])>Rt(s[1])?o=Ct/2*(l.x>e.x?1:-1):h=Ct/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function vw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function _w(t,e){return Oe(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ze(t,i),r=ze(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=je(t),l=je(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Qt(t.angle);let m=i?t.angle+Et:Qt(90-t.angle);const f=i?e.angle:Qt(e.angle);let v=i?e.angle+Et:Qt(90-e.angle);m>Bt&&(m-=Bt),v>Bt&&(v-=Bt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(De(n,i)+De(n,s))/2>De(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const yw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&bw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function bw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function xw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Aw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Tw(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},ww(t,e.attribute.angle)),{angle:Mw(e.attribute.angle)}))}))}(t,e),vw(e)}function Mw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Tw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function ww(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Mw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Cw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Ew(){aM(),cM(),_M(),kM()}var Pw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Tw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return ww(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=Qt(e)})),kw(i,t),!Aw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(Sw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),vw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:yw[n]||yw.parity;if(s.length>=3&&xw(s,r)){do{s=a(s,r)}while(s.length>=3&&xw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&bw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=fm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ti(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Bw.defaultAttributes=aw,U(Bw,Cw);class Rw{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ie(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Lw,Ow=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=fm.circle(c);d.name=sw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},rw,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Ow(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Iw.defaultAttributes=aw,U(Iw,Rw);class Dw extends _c{constructor(){super(...arguments),this.mode=Ao.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=kt.lastIndex=Mt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=kt.exec(t))&&(s=Mt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:St(i,s)})),r=Mt.lastIndex;return r{jw[t]=!0}));const Gw=t=>-Math.log(-t),Ww=t=>-Math.exp(-t),Uw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Yw=t=>10===t?Uw:t===Math.E?Math.exp:e=>Math.pow(t,e),Kw=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Xw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$w=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function qw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Zw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Jw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Qw(t,e,i,s){return 1===i&&(i=0),Jw(t,i,s)*(e/(1-i))}function tC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function eC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class nC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=tC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ft(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const rC=Symbol("implicit");class aC extends nC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Lw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=rC}clone(){const t=(new aC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==rC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class lC extends aC{constructor(t){super(),this.type=Lw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=Qw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:oC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return oC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new lC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:hC}=be;function cC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ve.parseColorString(e)){const e=hC(ve.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof _e?hC(t,e):e instanceof ve?hC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class dC extends nC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Vw,this._piecewise=Zw,this._interpolate=cC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?eC:Zw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Vw),this.rescale(i)):this._clamp!==Vw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const uC=Math.sqrt(50),pC=Math.sqrt(10),gC=Math.sqrt(2),mC=[1,2,5,10],fC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=bC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?_C(0,-(e-1)/s,s):_C((e-1)/s,0,s)},vC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return fC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return fC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=_C(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=_C(t,e,l);return n&&r.reverse(),r})),bC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=mC[0];return i>=uC?s=mC[3]:i>=pC?s=mC[2]:i>=gC&&(s=mC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function xC(t,e,i){const s=(e-t)/Math.max(0,i);return bC(s)}function SC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=xC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function kC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const MC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),TC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),wC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=yC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?MC(t,e,n):MC(t,e,sC(n)),h=MC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),CC=mt(((t,e,i,s,n)=>SC(s(t),s(e),i).map((t=>sC(n(t))))));class EC extends dC{constructor(){super(...arguments),this.type=Lw.Linear}clone(){return(new EC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return vC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=yC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return SC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=kC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=AC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=AC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=AC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function PC(t){return e=>-t(-e)}function BC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class RC extends dC{constructor(){super(Kw(10),Yw(10)),this.type=Lw.Log,this._limit=BC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new RC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Kw(this._base),s=Yw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=PC(i),this._pows=PC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Gw,this.untransformer=Ww):(this._logs=i,this._pows=s,this._limit=BC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Vw}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return TC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class LC extends EC{constructor(){super(Xw(1),$w(1)),this.type=Lw.Symlog,this._const=1}clone(){return(new LC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Xw(t),this.untransformer=$w(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return TC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return wC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return CC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=kC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=iC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class OC{constructor(){this.type=Lw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new OC).domain(this._domain).range(this._range).unknown(this._unknown)}}const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Jt(t).expand(i/2),n=new Jt(e).expand(i/2);return s.intersects(n)};function FC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function jC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=Qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=zC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=zC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=zC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=zC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Jt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},NC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=ie({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Jt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},VC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&FC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},GC=(t,e,i,s)=>HC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),WC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},UC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!WC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?UC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},XC=(t,e)=>{if(zw(t.type))return((t,e)=>{if(!zw(t.type))return IC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return IC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=HC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&jC(n,i);)n=VC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return IC(h)})(t,e);if(Nw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=GC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=YC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=GC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=NC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)})(t,e)}return IC(t.domain())};function $C(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function qC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=$t.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function ZC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=$C(t,!!n),o=$C(r,!!n);const h=$t.distancePP(s,l),c=$t.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=qC(e,t,!1,!!n),o=qC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=$C(t,!!n),o=$C(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class JC extends Mb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=fm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=$C(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=qC(t,o,!1,!!a)}const u=fm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=$C(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=fm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Ct/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:JC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(QC,Cw);var tE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(eE,Rw);const iE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",sE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:iE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},nE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var rE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(rE||(rE={}));var aE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=rE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=rE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=rE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=rE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===L_.env&&(L_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===rE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===rE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=rE.endHandler):h+=l:this._activeTag===rE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===rE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===L_.env&&(L_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ft(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ft(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===rE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=aE(i,["formatMethod"]),{formatMethod:a}=s,o=aE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Zt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},nE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},nE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},nE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},nE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},nE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},nE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return xy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var hE,cE,dE,uE;function pE(){aM(),tT()}function gE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function mE(t,e){const{dx:i,dy:s}=gE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}lE.defaultAttributes=sE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(hE||(hE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(cE||(cE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(dE||(dE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(uE||(uE={}));class fE extends Mb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=pw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=gw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=mw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=fm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=fm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=fm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function vE(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function _E(t,e,i,s){t&&(vE(t.startSymbol,e,i,s),t.lines.forEach((t=>vE(t,e,i,s))),vE(t.line,e,i,s),vE(t.endSymbol,e,i,s))}function yE(t,e,i,s){t&&(vE(t.getTextShape(),e,i,s),vE(t.getBgRect(),e,i,s))}function bE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function xE(t,e,i,s){t&&(bE(t.startSymbol,e,i,s),t.lines.forEach((t=>bE(t,e,i,s))),bE(t.line,e,i,s),bE(t.endSymbol,e,i,s))}function SE(t,e,i,s){t&&(bE(t.getTextShape(),e,i,s),bE(t.getBgRect(),e,i,s))}function AE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;vE(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),vE(t.endSymbol,s+r+a,o,n),vE(e.getTextShape(),s+r+a+o,l,n),vE(e.getBgRect(),s+r+a+o,l,n)}function kE(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}function ME(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function TE(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}function wE(t,e,i,s,n,r){var a;_E(t,n,s,r),vE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?yE(i,n,s,r):vE(i,n,s,r)}function CE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;vE(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),vE(e,n+o+l,h,r),vE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(vE(i.getTextShape(),n+o+l+h+c,d,r),vE(i.getBgRect(),n+o+l+c,d,r)):vE(i,n+o+l+c,d,r)}function EE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?AE(t,e,s,r,a):"fadeIn"===i&&kE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?AE(t,e,s,n,a):"fadeIn"===i&&kE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){bE(t,s,i,n),SE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?wE(n,r,e,i,s,o):"callIn"===t&&CE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?wE(n,r,e,i,s,a):"callIn"===t&&CE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;xE(t,n,s,r),bE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?SE(i,n,s,r):bE(i,n,s,r)}(n,r,e,t,i,s)}}const LE={type:"clipIn",duration:500,easing:"linear",delay:0},OE={type:"fadeIn",duration:500,easing:"linear",delay:0},IE={type:"callIn",duration:500,easing:"linear",delay:0},DE={type:"fadeOut",duration:500,easing:"linear",delay:0};class FE extends fE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=LE,this.defaultExitAnimation=DE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;mE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const jE=.001,zE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:hE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},NE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:dE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},VE={interactive:!0,label:{position:cE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},GE={interactive:!0,label:{position:dE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},UE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},YE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function KE(){XE._animate=EE}pE(),QT();class XE extends FE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,jE)||FM(Math.abs(e),3*Math.PI/2,jE)?jM(i,e,t):DM(e)?HE.postiveXAxis[t]:HE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function $E(){qE._animate=PE}XE.defaultAttributes=zE,pE(),gM();class qE extends fE{markerAnimate(t){qE._animate&&this._animationConfig&&qE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=fm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}qE.defaultAttributes=VE,pE(),tw();class ZE extends FE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case dE.arcInnerStart:l=s;case dE.arcOuterStart:l=s;break;case dE.arcInnerEnd:l=n;case dE.arcOuterEnd:l=n;break;case dE.center:case dE.arcInnerMiddle:case dE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return WE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}ZE.defaultAttributes=NE,pE(),Jk();class JE extends fE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=DE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case dE.center:h=(i+s)/2,c=(n+r)/2;break;case dE.arcInnerStart:h=i,c=n;break;case dE.arcOuterStart:h=s,c=n;break;case dE.arcInnerEnd:h=i,c=r;break;case dE.arcOuterEnd:h=s,c=r;break;case dE.arcInnerMiddle:h=i,c=(n+r)/2;break;case dE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},WE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;mE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=fm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function QE(){tP._animate=RE}JE.defaultAttributes=GE,pE(),QT(),tw(),SM(),lM(),cM();class tP extends fE{markerAnimate(t){tP._animate&&this._animationConfig&&tP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=DE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,jE)||FM(Math.abs(s),3*Math.PI/2,jE)?jM(t,s,n):DM(s)?YE.postiveXAxis[n]:YE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=uE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=fm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=fm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=fm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,jE)||FM(d,0,jE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(hP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(hP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===hP.focus||"focus"===o){const s=a.hasState(oP.focus);a.toggleState(oP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover,oP.focus],t),this._setLegendItemState(e,oP.selected,t)})):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover,oP.focus],t),this._setLegendItemState(e,oP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(oP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(oP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(lP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[oP.selected,oP.selectedHover],t),this._setLegendItemState(a,oP.unSelected,t)):(this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t))}else this._setLegendItemState(a,oP.selected,t),this._removeLegendItemState(a,[oP.unSelected,oP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[oP.selected,oP.selectedHover],t),this._setLegendItemState(e,oP.unSelected,t))}))}this._dispatchLegendEvent(lP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,oP.selected),this._removeLegendItemState(e,[oP.unSelected,oP.unSelectedHover])):(this._removeLegendItemState(e,[oP.selected,oP.selectedHover]),this._setLegendItemState(e,oP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=nP,spaceRow:h=rP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ti(c);let w;!1===x.visible?(w=fm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,hP.item,t,w)):(w=fm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,hP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?oP.selected:oP.unSelected);const C=fm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=fm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,hP.itemShape,t,w,S.state),s.addState(e?oP.selected:oP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=fm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,hP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,hP.itemLabel,t,w,A.state),D.addState(e?oP.selected:oP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,hP.itemValue,t,w,k.state),r.addState(e?oP.selected:oP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute;return this._itemContext.isHorizontal?new sP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new sP(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=fm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=nP,spaceRow:a=rP}=s,o=this._itemsContainer,{space:l=aP,defaultCurrent:h=1}=n,c=pP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=fm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(oP.selected)?this._setLegendItemState(t,oP.selectedHover,e):this._setLegendItemState(t,oP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===hP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(lP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(oP.unSelectedHover)||t.hasState(oP.selectedHover))&&(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(oP.unSelectedHover)&&!t.hasState(oP.selectedHover)||(i=!0),t.removeState(oP.unSelectedHover),t.removeState(oP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===hP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(lP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==hP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(lP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(oP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},gP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(oP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var fP;function vP(t){return y(t)?t:[t,t]}function _P(t){return t?"ew-resize":"ns-resize"}mP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:nP,spaceRow:rP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:aP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(fP||(fP={})),dP();class yP extends Mb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=ft(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===L_.env?(L_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=ft(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===L_.env?(L_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===L_.env?(L_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),L_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?ft(t+p,h,c):ft(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?ft(t+p,0,c-h):ft(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===L_.env?(L_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),L_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:vP(d)[0],endValue:vP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=fm.group({x:0,y:0});m.name=fP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=fm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=fP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=fm.group({x:g?v:0,y:g?0:v});m.add(_);const y=fm.group({x:0,y:0});let b;if(y.name=fP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=fm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=fP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=fm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=fP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=vP(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(v.name=fP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=fP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":_P(p)},r));if(i.name=fP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=fP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=vt(h,i,s);c=t[0],d=t[1]}else c=i,d=ft(h,i,s);const p=this._isHorizontal;e||(c=i);const m=fm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=fP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":_P(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=fm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=fP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return fm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":_P(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),fm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=fm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=fm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===fP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===fP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===fP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===fP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}yP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},uP(),dP();class bP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function xP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}bP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},uP(),dP(),uM();class SP extends cP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=fm.group({x:0,y:0});this._innerView.add(x);const S=new yP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:xP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=fm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}SP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let AP=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ti(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};AP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const kP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let MP=class extends Mb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(kP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class TP extends Sg{constructor(t){super(t)}}var wP,CP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(wP||(wP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(CP||(CP={}));class EP extends Mb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},EP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},EP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},EP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new TP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new TP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new TP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(wP.OnPlay)},this.pause=()=>{this._dispatchEvent(wP.OnPause)},this.forward=()=>{this._dispatchEvent(wP.OnForward)},this.backward=()=>{this._dispatchEvent(wP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}EP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},EP.defaultAttributes={[CP.Start]:{},[CP.Pause]:{},[CP.Backward]:{},[CP.Forward]:{}};const PP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},BP=[200,10];var RP,LP;!function(t){t.Default="default",t.Reverse="reverse"}(RP||(RP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(LP||(LP={}));const OP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===RP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===RP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},DP=t=>"top"===t||"bottom"===t;class FP extends Mb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=It(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(DP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:BP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:BP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new yP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return DP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new EP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=DP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:BP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:It(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(DP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:It(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:DP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:DP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:It(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:DP(this._orient)?t+s:(this._size.width-r)/2,y:DP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function jP(){dP(),aM(),SM()}FP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},PP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},PP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},PP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},PP),{key:"backward",position:"start"})}},jP();class zP extends FP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:RP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(LP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(OP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===RP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(LP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(LP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(LP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),L_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,L_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(LP.change),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var HP,NP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};jP();class VP extends FP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(wP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(wP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(wP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(wP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(LP.change))},this.play=()=>NP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(LP.play),this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,L_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,L_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(LP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(LP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(LP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(HP||(HP={}));const GP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},WP=5;const UP={debounce:bt,throttle:xt};aM(),gM();let YP=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:UP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(HP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(HP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(HP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=GP.trigger,updateTrigger:e=GP.updateTrigger,endTrigger:i=GP.endTrigger,resetTrigger:s=GP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Ke(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(HP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(HP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=WP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(HP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=fm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},XP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},$P={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Jt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},qP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let ZP=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ti(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},XP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Hc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},XP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>qP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&_g[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return KP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return KP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};ZP.defaultAttributes=$P;const JP=ut;function QP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function eB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function iB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function sB(t,e){const i=iB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function nB(t,e){const i=rB(t),s=rB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function rB(t,e={x:0,y:0}){return $t.distancePP(t,e)}function aB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function oB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const lB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var cB,dB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(cB||(cB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dB||(dB={}));const uB="__VCHART",pB=500,gB=500,mB=`${uB}_LABEL_LIMIT`,fB=`${uB}_LABEL_ALIGN`,vB=`${uB}_LABEL_TEXT`,_B=`${uB}_LABEL_VISIBLE`,yB=`${uB}_LABEL_X`,bB=`${uB}_LABEL_Y`,xB=`${uB}_ARC_TRANSFORM_VALUE`,SB=`${uB}_ARC_RATIO`,AB=`${uB}_ARC_START_ANGLE`,kB=`${uB}_ARC_END_ANGLE`,MB=`${uB}_ARC_K`,TB=`${uB}_ARC_MIDDLE_ANGLE`,wB=`${uB}_ARC_QUADRANT`,CB=`${uB}_ARC_RADIAN`,EB=-Math.PI/2,PB=3*Math.PI/2,BB=-90,RB=.6;var LB,OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(LB||(LB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(OB||(OB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(IB||(IB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(DB||(DB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(FB||(FB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(jB||(jB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(zB||(zB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(HB||(HB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(NB||(NB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(VB||(VB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(GB||(GB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(WB||(WB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(UB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",UB.AFTER_EVALUATE_DATA="afterEvaluateData",UB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",UB.AFTER_EVALUATE_SCALE="afterEvaluateScale",UB.BEFORE_PARSE_VIEW="beforeParseView",UB.AFTER_PARSE_VIEW="afterParseView",UB.BEFORE_TRANSFORM="beforeTransform",UB.AFTER_TRANSFORM="afterTransform",UB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",UB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",UB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",UB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",UB.BEFORE_STAGE_RESIZE="beforeStageResize",UB.AFTER_STAGE_RESIZE="afterStageResize",UB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",UB.AFTER_VRENDER_DRAW="afterVRenderDraw",UB.BEFORE_MARK_JOIN="beforeMarkJoin",UB.AFTER_MARK_JOIN="afterMarkJoin",UB.BEFORE_MARK_UPDATE="beforeMarkUpdate",UB.AFTER_MARK_UPDATE="afterMarkUpdate",UB.BEFORE_MARK_STATE="beforeMarkState",UB.AFTER_MARK_STATE="afterMarkState",UB.BEFORE_MARK_ENCODE="beforeMarkEncode",UB.AFTER_MARK_ENCODE="afterMarkEncode",UB.BEFORE_DO_LAYOUT="beforeDoLayout",UB.AFTER_DO_LAYOUT="afterDoLayout",UB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",UB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",UB.BEFORE_DO_RENDER="beforeDoRender",UB.AFTER_DO_RENDER="afterDoRender",UB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",UB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",UB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",UB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",UB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",UB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",UB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",UB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",UB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",UB.BEFORE_ELEMENT_STATE="beforeElementState",UB.AFTER_ELEMENT_STATE="afterElementState",UB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",UB.AFTER_ELEMENT_ENCODE="afterElementEncode",UB.ANIMATION_START="animationStart",UB.ANIMATION_END="animationEnd",UB.ELEMENT_ANIMATION_START="elementAnimationStart",UB.ELEMENT_ANIMATION_END="elementAnimationEnd",UB.ALL_ANIMATION_START="allAnimationStart",UB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(YB||(YB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(KB||(KB={}));const XB="__vgrammar_scene_item__",$B=[IB.line,IB.area],qB=[IB.arc3d,IB.rect3d,IB.pyramid3d],ZB="key",JB=[{}],QB=["key"],tR=!0,eR=!0,iR=!1,sR=!0,nR="VGRAMMAR_IMMEDIATE_ANIMATION",rR=0,aR=1e3,oR=0,lR=0,hR=!1,cR=!1,dR="quintInOut",uR={stopWhenStateChange:!1,immediatelyApply:!0},pR="_mo_hide_";function gR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function mR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return gR(t.dependency,e);var i;return[]}function fR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function vR(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function _R(t,e){return yR(t)?t.output():e[t]}const yR=t=>t&&!u(t.grammarType),bR=t=>d(t)?t:e=>e[t];function xR(t){return!!(null==t?void 0:t.scale)}function SR(t){return!!(null==t?void 0:t.field)}function AR(t,e){if(!t)return[];let i=[];return t.scale&&(i=yR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(mR(t,e))}function kR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function MR(t,e,i,s,n){i&&(fR(i)?e.forEach((e=>{const n=vR(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case IB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case IB.group:case IB.rect:case IB.image:return["width","height","y1"].includes(e);case IB.path:case IB.shape:return["path","customPath"].includes(e);case IB.line:return"defined"===e;case IB.area:return["x1","y1","defined"].includes(e);case IB.rule:return["x1","y1"].includes(e);case IB.symbol:return"size"===e;case IB.polygon:return"points"===e;case IB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(xR(l)){const t=_R(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?pb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(SR(l)){const t=pb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=vR(l,s,e.datum,t)}))})))}function TR(t,e,i,s){if(!t)return null;if(fR(t))return vR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(xR(h)){const t=_R(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?pb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(SR(h)){const t=pb(h.field);n[r]=t(e)}else n[r]=vR(h,s,e,i)})),n}class wR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let CR=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};CR._plotMarks={},CR._marks={},CR._components={},CR._graphicComponents={},CR._transforms={},CR._grammars={},CR._glyphs={},CR._animations={},CR._interactions={},CR._graphics={},CR.registerGlyph=(t,e,i,s,n)=>(CR._glyphs[t]=new wR(e,i,s,n),CR._glyphs[t]),CR.registerAnimationType=(t,e)=>{CR._animations[t]=e},CR.getAnimationType=t=>CR._animations[t],CR.registerInteraction=(t,e)=>{CR._interactions[t]=e},CR.registerGraphic=(t,e)=>{CR._graphics[t]=e},CR.getGraphicType=t=>CR._graphics[t],CR.createGraphic=(t,e)=>{const i=CR._graphics[t];return i?i(e):null};const ER=t=>!!IB[t];function PR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=CR.getGraphicType(e)?CR.createGraphic(e,i):CR.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||rt.getInstance().error(`create ${e} graphic failed!`),n}const BR=t=>{t&&(t[XB]=null,t.release(),t.parent&&t.parent.removeChild(t))},RR=["fillOpacity"],LR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const OR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[IB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[IB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[IB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const IR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?OR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(RR.includes(r)?LR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{RR.includes(t)?LR(n,t,e):n[t]=e[t]}));return n},DR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),FR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],jR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(FR);function zR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?jR:FR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>DR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=HR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function HR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let NR=class{constructor(t){this.data=null,this.states=[],this.diffState=OB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));MR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?IR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[XB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?IR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===OB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(BR(this.graphicItem),this.graphicItem[XB]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=bR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(vR(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===OB.unChange&&(this.diffState=OB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,pR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[pR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||this.useStates(this.states),this.mark.markType===IB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[LB.update],a=e[LB.enter],o=e[LB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===OB.enter?(a&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.update?((n&&a||i)&&MR(this,t,a,s,l),r&&MR(this,t,r,s,l)):this.diffState===OB.exit&&o&&(i&&MR(this,t,a,s,l),MR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)vb(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[IB.line,IB.area,IB.largeRects,IB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||kR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[LB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=HR(h),e===IB.line||e===IB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>kR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===IB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=zR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=HR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?zR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=TR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=zR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===IB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===IB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(BR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class VR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const GR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class WR extends VR{constructor(t,e){super(t,e),this.type=WR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},WR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}WR.type="element-select",WR.defaultOptions={state:KB.selected,trigger:"click"};class UR extends VR{constructor(t,e){super(t,e),this.type=UR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=GR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function YR(t){if(t)return t.type===Lw.Band?t.bandwidth():t.type===Lw.Point?t.step():void 0}UR.type="element-highlight",UR.defaultOptions={highlightState:KB.highlight,blurState:KB.blur,trigger:"pointerover",triggerOff:"pointerout"};class KR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const XR=()=>{U(WR,KR),CR.registerInteraction(WR.type,WR)},$R=()=>{U(UR,KR),CR.registerInteraction(UR.type,UR)},qR=(t,e)=>yR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,ZR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=qR(n,e),i}),{}):t.map((t=>qR(t,e))):t;let JR=-1;class QR extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++JR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(mR(this.spec[e],this.view)),this.spec[e]=t,this.attach(mR(t,this.view)),this.commit(),this}}const tL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=mR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},eL=(t,e)=>{const i=CR.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(gR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>tL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return tL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},iL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=eL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},sL={csv:Ur,dsv:Wr,tsv:Yr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class nL extends QR{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!sL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return sL[e.type](t,i,new _a(new fa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?mR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=mR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=mR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=yR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=iL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const rL="window",aL="view",oL={trap:!1},lL="width",hL="height",cL="viewWidth",dL="viewHeight",uL="padding",pL="viewBox",gL="autoFit";function mL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function fL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,mL(t,e,n,s)}class vL{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}return this.nodes.push(t),mL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),mL(this.nodes,e,0,this.compare),fL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,fL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class _L{constructor(t){this.list=[],this.ids={},this.idFunc=t||gb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class yL{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new _L((t=>t.uid)),this._heap=new vL(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new _L((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const bL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===IB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class xL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Jd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{jl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new ey(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Jb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ex(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function SL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function AL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function kL(t,e,i,s,n){if(n===rL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{AL(t,SL(t),!1)}))}));const e=SL(t);AL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class ML extends QR{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?vR(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},EL=(t,e)=>e&&e.debounce?bt(t,e.debounce):e&&e.throttle?xt(t,e.throttle):t;class PL extends NR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return MR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[XB]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?IR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===OB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==OB.enter&&this.diffState!==OB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=IR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=OR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===IB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return $B.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)vb(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[XB]=null})),this.glyphGraphicItems=null),super.release()}}const BL=t=>t.markType===IB.glyph?new PL(t):new NR(t);function RL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(ZB,i?t.slice().sort(i):t.slice()),{keys:QB,data:s};const n=bR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class LL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?RL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const OL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=kR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const IL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class DL extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class FL extends _c{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Hd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:xo.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}bc.mode|=Ao.SET_ATTR_IMMEDIATELY;let jL=0;const zL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof _c||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class HL{constructor(t,e,i){this.id=jL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!CR.getAnimationType(e.type))return null;const r=CR.getAnimationType(e.type)(t,n,i);return OL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?IL(t,0,n[i].from,0,s):void 0,e.to[i]=l?IL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),OL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=zL(o);return u(o)||zL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new FL(r.from,r.to,a,t.easing):void 0:new DL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new Xc(a,e))}r>0&&t.wait(r)}}function NL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(VL(i,t[i]))})),e}function VL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:rR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:cR,loop:null!==(s=h.loop)&&void 0!==s?s:hR,controlOptions:z({},uR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:aR,delay:null!==(a=h.delay)&&void 0!==a?a:oR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:lR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:dR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:rR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:cR,loop:null!==(d=t.loop)&&void 0!==d?d:hR,controlOptions:z({},uR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:oR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:lR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:dR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function GL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class WL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class UL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=NL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=NL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==OB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=VL(nR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new WL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===OB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new HL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===OB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=vR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=GL(t.startTime,e,n),o=GL(t.totalTime,e,n),l=GL(t.oneByOne,e,n),h=GL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=GL(t.delay,e,n),l=GL(t.delayAfter,e,n),h=null!==(i=GL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:GL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===OB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===OB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===nR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===OB.exit&&0===o[OB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class YL extends QR{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new UL(this,{}),this.differ=new LL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===OB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===WB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:JB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===IB.group)return;const e=RL(null!=t?t:JB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(OB.update,t,e,i)}encodeState(t,e,i,s){if(t===OB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(fR(n))this.detach(AR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(AR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(AR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(AR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(AR(i,this.view))):fR(e)?(this.spec.encode[t]=e,this.attach(AR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(AR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=iL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=iL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return $B.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==OB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===YB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!fR(n)&&Object.keys(n).forEach((t=>{xR(n[t])&&(e[t]=_R(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];fR(s)||Object.keys(s).forEach((t=>{SR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB];if((null==s?void 0:s.mark)===this){const i=kL(this.view,t,s,0,aL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new UL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=_R(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==IB.group){if(!this.graphicItem){const t=PR(this,IB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||qB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==IB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=bR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>ZB),a=bR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>ZB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===OB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=OB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):BL(this),n.diffState===OB.exit&&(n.diffState=OB.enter,this.animate.getElementAnimators(n,OB.exit).forEach((t=>t.stop("start")))),n.diffState=OB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=OB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:JB;l||this.differ.setCurrentData(RL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=TR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{this.markType===IB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:PR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==IB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=bR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>ZB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=BL(this);e.diffState=OB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=BL(this);i.diffState=OB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==IB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=PR(this,IB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==OB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:OR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=OB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&BR(this.graphicItem),this.detachAll(),super.release()}}let KL=class extends YL{constructor(t,e){super(t,IB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===IB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return OR.rect}evaluateJoin(t){if(!this.elements.length){const t=BL(this);t.updateData(ZB,JB,(()=>""),this.view),this.elements=[t],this.elementMap.set(ZB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return MR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[LB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:PR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function XL(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function $L(t,e){return Math.min(t<0?t+e:t-1,e)}function qL(t,e,i){let s=$L(t,i),n=$L(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=$L(Math.max(0,n-1),i)):n=$L(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const ZL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>XL(t,i))),u=l.map((t=>XL(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=qL(e,i,r),{start:h,end:c}=qL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Zt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},JL={[DB.axis]:0,[DB.legend]:1,[DB.slider]:2,[DB.player]:3,[DB.datazoom]:4},QL=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=JL[t.componentType])&&void 0!==s?s:1/0},tO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=_b(r.maxChildWidth,n.width()),o=_b(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=CL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dQL(t)-QL(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==IB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=tO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(cL,o),i.updateSignal(dL,l),i.updateSignal(uL,h)}else tO(t,n,a,e);else"grid"===r.display&&ZL(t,n,a);eO(n,e,i)}}))};class iO extends YL{constructor(t,e,i){super(t,IB.glyph,i),this.glyphType=e,this.glyphMeta=CR.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!CR.getGraphicType(IB.glyph))return;const s=CR.createGraphic(IB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(CR.getGraphicType(n[t])){const e=CR.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const sO=Symbol.for("key");class nO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==IB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=RL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=RL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=bR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new LL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(RL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:sO})),r=RL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:sO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==sO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=vR(i.animation.delay,n,o,l),d=vR(i.animation.duration,n,o,l),u=vR(i.animation.oneByOne,n,o,l),p=vR(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Ed:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Pd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Md(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Ed:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Pd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>xd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Ad(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:xo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new kd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mc,null!==(l=i.easing)&&void 0!==l?l:Tc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:xo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Td({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Tc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Md(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class rO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class aO extends rO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===IB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===IB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===IB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===IB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class lO extends YL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=PR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?IB.richtext:IB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}lO.markType=IB.text;const hO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},cO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},dO=Object.assign({},hO);dO.axis=Object.assign({},dO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.circleAxis=Object.assign({},dO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),dO.grid=Object.assign({},dO.grid,{style:{stroke:"#404349"}}),dO.circleGrid=Object.assign({},dO.circleGrid,{style:{stroke:"#404349"}}),dO.rectLabel=Object.assign({},dO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.lineLabel=Object.assign({},dO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.symbolLabel=Object.assign({},dO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),dO.title=Object.assign({},dO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const uO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:cO,components:dO},pO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:cO,components:hO};let gO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};gO._themes=new Map,gO.registerTheme("default",pO),gO.registerTheme("dark",uO);class mO extends YL{constructor(t,e,i,s){super(t,IB.component,i),this._componentDatum={[ZB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:CR.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,ZB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[ZB]+=1}evaluateJoin(t){return this.spec.key=ZB,t?(t[ZB]=this._componentDatum[ZB],this._componentDatum=t):this._componentDatum={[ZB]:this._componentDatum[ZB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class fO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=bt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[XB],n=kL(0,t,s,0,aL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(yR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):ER(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ML(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new nL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=CR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=CR.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case IB.group:n=new KL(this,s);break;case IB.glyph:n=new iO(this,null==i?void 0:i.glyphType,s);break;case IB.component:n=CR.hasComponent(null==i?void 0:i.componentType)?CR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new mO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case IB.text:n=new lO(this,t,s);break;default:n=CR.hasMark(t)?CR.createMark(t,this,s):new YL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(IB.group,t)}glyph(t,e){return this.mark(IB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(IB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(IB.component,t,{componentType:DB.grid,mode:e})}legend(t){return this.mark(IB.component,t,{componentType:DB.legend})}slider(t){return this.mark(IB.component,t,{componentType:DB.slider})}label(t){return this.mark(IB.component,t,{componentType:DB.label})}datazoom(t){return this.mark(IB.component,t,{componentType:DB.datazoom})}player(t){return this.mark(IB.component,t,{componentType:DB.player})}title(t){return this.mark(IB.component,t,{componentType:DB.title})}scrollbar(t){return this.mark(IB.component,t,{componentType:DB.scrollbar})}customized(t,e){const i=CR.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&wL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(BR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++TL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(gO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(lL,t.width),this.updateSignal(hL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=CR.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:lL,value:null!==(s=t[lL])&&void 0!==s?s:0},{id:hL,value:null!==(n=t[hL])&&void 0!==n?n:0},{id:uL,value:CL(null!==(a=null!==(r=t[uL])&&void 0!==r?r:e[uL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:cL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[lL]-i.left-i.right},dependency:[lL,uL]}},{id:dL,update:{callback:(t,e)=>{const i=CL(e[uL]);return e[hL]-i.top-i.bottom},dependency:[hL,uL]}},{id:pL,update:{callback:(t,e)=>{const i=CL(e[uL]);return(t||new Zt).setValue(i.left,i.top,i.left+e[cL],i.top+e[dL])},dependency:[cL,dL,uL]}},{id:gL,value:null!==(o=t[gL])&&void 0!==o?o:e[gL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===IB.glyph?{glyphType:t.glyphType}:t.type===IB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=gO.getTheme(t))&&void 0!==e?e:gO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(lL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(hL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(cL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(uL);if(arguments.length){const i=CL(t);return this.updateSignal(e,i),i}return CL(e.output())}autoFit(t){const e=this.getSignalById(gL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(pL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=WB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===IB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||eO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{bL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),bL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=tR,morph:o=eR,morphAll:l=iR,animation:h={},enableExitAnimation:c=sR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:dR,delay:null!==(i=h.delay)&&void 0!==i?i:oR,duration:null!==(s=h.duration)&&void 0!==s?s:aR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:cR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=WB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=WB.reevaluate,this._dataflow.evaluate()),this._layoutState=WB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!wL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return bL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ei(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(lL,t)),e!==this.height()&&(s=!0,this.updateSignal(hL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):ER(t)?(i.markType=t,i.source=e):i.source=t===rL?rL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=gR(l,this),v=EL(((t,e)=>{const s=c===aL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===rL&&(t=kL(0,t,e,0,rL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===aL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,aL,d))return this.addEventListener(d,v,oL),()=>{this.removeEventListener(d,v)}}else if(c===rL)return L_.addEventListener(d,v),this._eventListeners.push({type:d,source:L_,handler:v}),()=>{L_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===L_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=CR.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new xL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new rO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aO((t=>t.id())),this._options.logger&&rt.setInstance(this._options.logger),this.logger=rt.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new yL,this.animate=new oO(this),this._morph=new nO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[aL,rL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:gO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&L_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=WB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==IB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=L_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&L_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),CR.unregisterRuntimeTransforms(),rt.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const vO=()=>{bM(),uM(),CR.registerGraphic(IB.path,Ug)},_O=()=>{bM(),fM(),CR.registerGraphic(IB.rect,Eg)},yO=()=>{bM(),cM(),CR.registerGraphic(IB.rule,Tg)},bO=()=>{bM(),SM(),CR.registerGraphic(IB.symbol,Ag)},xO=()=>{bM(),kM(),_M(),CR.registerGraphic(IB.text,_p)},SO=()=>{bM(),nM(),CR.registerGraphic(IB.glyph,Bg)},AO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},MO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Sb(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},TO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Sb(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},wO=AO(MO),CO=kO(MO);const EO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Sb(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},PO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Sb(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},BO=AO(EO),RO=kO(EO);const LO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},IO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?OO:LO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},DO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},jO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class zO extends mO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const HO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class NO extends zO{constructor(t,e,i){super(t,DB.axis,e),this.spec.componentType=DB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=TR(n,e,i,s);const h=vR(this.spec.inside,s,e,i),c=vR(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(HO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=vR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case jB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case jB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?jB.circleAxis:jB.lineAxis,this._axisComponentType}}NO.componentType=DB.axis;let VO=class extends mO{constructor(t,e){super(t,DB.label,e),this.spec.componentType=DB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=vR(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=vR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case IB.line:case IB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case IB.rect:case IB.rect3d:case IB.interval:g=p.rectLabel;break;case IB.symbol:case IB.circle:case IB.cell:g=p.symbolLabel;break;case IB.arc:case IB.arc3d:g=p.arcLabel;break;case IB.polygon:case IB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=TR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=TR(i,t,e,d);m.push(z({},f,s))}));else{const t=TR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};VO.componentType=DB.label;const GO=()=>{CR.registerGraphicComponent(DB.label,(t=>new JT(t))),CR.registerComponent(DB.label,VO)};class WO extends zO{constructor(t,e,i){super(t,DB.grid,e),this.spec.componentType=DB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=CR.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=TR(s,t,e,i);const d=vR(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case zB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case zB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=vR(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(HO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===zB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=vR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case zB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case zB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=zB.circleAxisGrid:this._gridComponentType=zB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case jB.circleAxis:this._gridComponentType=zB.circleAxisGrid;break;case jB.lineAxis:default:this._gridComponentType=zB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?zB.lineAxisGrid:zB.circleAxisGrid:zB.lineAxisGrid}else this._gridComponentType=zB.lineAxisGrid;return this._gridComponentType}}WO.componentType=DB.grid;const UO=(t,e,i)=>e.filter((e=>t.callback(e,i))),YO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function KO(t){return t.reduce(((t,e)=>t+e),0)}const XO={min:$,max:X,average:function(t){return 0===t.length?0:KO(t)/t.length},sum:KO};function $O(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function qO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function ZO(t,e,i,s){return qO(t,e,i,"min",s)}function JO(t,e,i,s){return qO(t,e,i,"max",s)}function QO(t,e,i,s){return qO(t,e,i,"average",s)}function tI(t,e,i,s){return qO(t,e,i,"sum",s)}const eI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=$O;if("min"===n?l=ZO:"max"===n?l=JO:"average"===n?l=QO:"sum"===n&&(l=tI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const iI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(pR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(pR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(pR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},sI=()=>{CR.registerTransform("filter",{transform:UO,markPhase:"beforeJoin"},!0)},nI=()=>{CR.registerTransform("map",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{CR.registerTransform("sampling",{transform:eI,markPhase:"afterEncode"},!0)},aI=()=>{CR.registerTransform("markoverlap",{transform:iI,markPhase:"afterEncode"},!0)},oI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},hI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},cI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},dI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const pI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},xI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},SI=(t,e,i)=>({from:{points:xI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e)}}),kI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),MI=(t,e,i)=>({from:{points:kI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),TI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:kI(t,e,i)}}),wI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),CI=(t,e,i)=>({from:{points:wI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),EI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:wI(t,e,i)}}),PI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},LI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},OI={symbol:["_mo_hide_","visible"]},II=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=OI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{vb(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},DI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=ut(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=ut(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},jI=()=>{CR.registerAnimationType("clipIn",oI)},zI=()=>{CR.registerAnimationType("clipOut",lI)},HI=()=>{CR.registerAnimationType("fadeIn",hI)},NI=()=>{CR.registerAnimationType("fadeOut",cI)},VI=()=>{CR.registerAnimationType("growCenterIn",dI)},GI=()=>{CR.registerAnimationType("growCenterOut",uI)},WI=()=>{CR.registerAnimationType("growHeightIn",mI)},UI=()=>{CR.registerAnimationType("growHeightOut",fI)},YI=()=>{CR.registerAnimationType("growWidthIn",pI)},KI=()=>{CR.registerAnimationType("growWidthOut",gI)},XI=()=>{CR.registerAnimationType("growPointsIn",SI)},$I=()=>{CR.registerAnimationType("growPointsOut",AI)},qI=()=>{CR.registerAnimationType("growPointsXIn",MI)},ZI=()=>{CR.registerAnimationType("growPointsXOut",TI)},JI=()=>{CR.registerAnimationType("growPointsYIn",CI)},QI=()=>{CR.registerAnimationType("growPointsYOut",EI)},tD=()=>{CR.registerAnimationType("growAngleIn",vI)},eD=()=>{CR.registerAnimationType("growAngleOut",_I)},iD=()=>{CR.registerAnimationType("growRadiusIn",yI)},sD=()=>{CR.registerAnimationType("growRadiusOut",bI)},nD=()=>{CR.registerAnimationType("moveIn",PI)},rD=()=>{CR.registerAnimationType("moveOut",BI)},aD=()=>{CR.registerAnimationType("scaleIn",RI)},oD=()=>{CR.registerAnimationType("scaleOut",LI)},lD=()=>{CR.registerAnimationType("rotateIn",DI)},hD=()=>{CR.registerAnimationType("rotateOut",FI)},cD=()=>{CR.registerAnimationType("update",II)};class dD extends YL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=fR(e)?null:Object.keys(e).reduce(((t,s)=>(xR(e[s])&&(t[s]=_R(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=TR(e,t,i,n);if(u(r.size)){const t=s.x?YR(s.x):void 0,e=s.y?YR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(OR.symbol)}release(){super.release(),this._encoders=null}}dD.markType=IB.cell;const uD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var pD,gD,mD;t.ChartEvent=void 0,(pD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",pD.rendered="rendered",pD.renderFinished="renderFinished",pD.animationFinished="animationFinished",pD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",pD.afterInitData="afterInitData",pD.afterInitEvent="afterInitEvent",pD.afterInitMark="afterInitMark",pD.rawDataUpdate="rawDataUpdate",pD.viewDataFilterOver="viewDataFilterOver",pD.viewDataUpdate="viewDataUpdate",pD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",pD.markDeltaYUpdate="markDeltaYUpdate",pD.viewDataLabelUpdate="viewDataLabelUpdate",pD.scaleDomainUpdate="scaleDomainUpdate",pD.scaleUpdate="scaleUpdate",pD.dataZoomChange="dataZoomChange",pD.drill="drill",pD.layoutStart="layoutStart",pD.layoutEnd="layoutEnd",pD.layoutRectUpdate="layoutRectUpdate",pD.playerPlay="playerPlay",pD.playerPause="playerPause",pD.playerEnd="playerEnd",pD.playerChange="playerChange",pD.playerForward="playerForward",pD.playerBackward="playerBackward",pD.scrollBarChange="scrollBarChange",pD.brushStart="brushStart",pD.brushChange="brushChange",pD.brushEnd="brushEnd",pD.brushClear="brushClear",pD.legendSelectedDataChange="legendSelectedDataChange",pD.legendFilter="legendFilter",pD.legendItemClick="legendItemClick",pD.legendItemHover="legendItemHover",pD.legendItemUnHover="legendItemUnHover",pD.tooltipShow="tooltipShow",pD.tooltipHide="tooltipHide",pD.tooltipRelease="tooltipRelease",pD.afterResize="afterResize",pD.afterRender="afterRender",pD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(gD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",gD.window="window",gD.canvas="canvas",t.Event_Bubble_Level=void 0,(mD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",mD.chart="chart",mD.model="model",mD.mark="mark";const fD=`${uB}_waterfall_default_seriesField`,vD=`${uB}_CORRELATION_X`,_D=`${uB}_CORRELATION_Y`,yD=`${uB}_CORRELATION_SIZE`,bD=`${uB}_MEASURE_CANVAS_ID`,xD=`${uB}_DEFAULT_DATA_INDEX`,SD=`${uB}_DEFAULT_DATA_KEY`,AD=`${uB}_DEFAULT_DATA_SERIES_FIELD`,kD=`${uB}_DEFAULT_SERIES_STYLE_NAME`;var MD;t.AttributeLevel=void 0,(MD=t.AttributeLevel||(t.AttributeLevel={}))[MD.Default=0]="Default",MD[MD.Theme=1]="Theme",MD[MD.Chart=2]="Chart",MD[MD.Base_Series=3]="Base_Series",MD[MD.Series=4]="Series",MD[MD.Mark=5]="Mark",MD[MD.User_Chart=6]="User_Chart",MD[MD.User_Series=7]="User_Series",MD[MD.User_Mark=8]="User_Mark",MD[MD.User_SeriesStyle=9]="User_SeriesStyle",MD[MD.Built_In=99]="Built_In";const TD=`${uB}_STACK_KEY`,wD=`${uB}_STACK_START`,CD=`${uB}_STACK_END`,ED=`${uB}_STACK_START_PERCENT`,PD=`${uB}_STACK_END_PERCENT`,BD=`${uB}_STACK_START_OffsetSilhouette`,RD=`${uB}_STACK_END_OffsetSilhouette`,LD=`${uB}_STACK_TOTAL`,OD=`${uB}_STACK_TOTAL_PERCENT`,ID=`${uB}_STACK_TOTAL_TOP`,DD=`${uB}_SEGMENT_START`,FD=`${uB}_SEGMENT_END`;var jD,zD;t.LayoutZIndex=void 0,(jD=t.LayoutZIndex||(t.LayoutZIndex={}))[jD.Axis_Grid=50]="Axis_Grid",jD[jD.CrossHair_Grid=100]="CrossHair_Grid",jD[jD.Region=450]="Region",jD[jD.Mark=300]="Mark",jD[jD.Node=400]="Node",jD[jD.Axis=100]="Axis",jD[jD.MarkLine=500]="MarkLine",jD[jD.MarkArea=100]="MarkArea",jD[jD.MarkPoint=500]="MarkPoint",jD[jD.DataZoom=500]="DataZoom",jD[jD.ScrollBar=500]="ScrollBar",jD[jD.Player=500]="Player",jD[jD.Legend=500]="Legend",jD[jD.CrossHair=500]="CrossHair",jD[jD.Indicator=500]="Indicator",jD[jD.Title=500]="Title",jD[jD.Label=500]="Label",jD[jD.Brush=500]="Brush",jD[jD.CustomMark=500]="CustomMark",jD[jD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(zD=t.LayoutLevel||(t.LayoutLevel={}))[zD.Indicator=10]="Indicator",zD[zD.Region=20]="Region",zD[zD.Axis=30]="Axis",zD[zD.DataZoom=40]="DataZoom",zD[zD.Player=40]="Player",zD[zD.ScrollBar=40]="ScrollBar",zD[zD.Legend=50]="Legend",zD[zD.Title=70]="Title",zD[zD.CustomMark=70]="CustomMark";const HD=["linear","radial","conical"],ND={x0:0,y0:0,x1:1,y1:1},VD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},GD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},WD={linear:ND,radial:VD,conical:GD},UD={label:{name:"label",type:"text"}},YD=`${uB}_rect_x`,KD=`${uB}_rect_x1`,XD=`${uB}_rect_y`,$D=`${uB}_rect_y1`,qD={data:!0},ZD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},JD=Object.assign(Object.assign({},UD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),QD=Object.assign(Object.assign({},UD),{bar3d:{name:"bar3d",type:"rect3d"}}),tF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},eF=Object.assign(Object.assign({},UD),tF),iF=Object.assign(Object.assign({},UD),{point:{name:"point",type:"symbol"}}),sF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),nF=Object.assign(Object.assign(Object.assign({},UD),tF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign({},UD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),aF=Object.assign(Object.assign({},UD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},UD),{rose:{name:"rose",type:"arc"}}),lF=Object.assign(Object.assign({},UD),{area:{name:"area",type:"path"}}),hF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"}}),cF=Object.assign(Object.assign({},hF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),dF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),uF=Object.assign(Object.assign({},UD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),pF=Object.assign(Object.assign({},UD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),gF=Object.assign(Object.assign({},UD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),mF=Object.assign(Object.assign({},UD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},UD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),vF=Object.assign(Object.assign({},JD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),_F=Object.assign(Object.assign({},UD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),yF=Object.assign(Object.assign({},UD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),bF=Object.assign(Object.assign({},UD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),xF=Object.assign(Object.assign({},hF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),SF=Object.assign(Object.assign({},UD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),AF=Object.assign(Object.assign({},UD),{sunburst:{name:"sunburst",type:"arc"}}),kF=Object.assign(Object.assign({},JD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},UD),{circlePacking:{name:"circlePacking",type:"arc"}}),wF=Object.assign(Object.assign({},UD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),CF=Object.assign(Object.assign({},UD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),EF=Object.assign({},sF),PF=Object.assign(Object.assign({},UD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),BF=Object.assign(Object.assign({},UD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var RF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(RF||(RF={}));const LF={[cB.bar]:JD,[cB.bar3d]:QD,[cB.line]:eF,[cB.scatter]:iF,[cB.area]:sF,[cB.radar]:nF,[cB.pie]:rF,[cB.pie3d]:aF,[cB.rose]:oF,[cB.geo]:UD,[cB.map]:lF,[cB.circularProgress]:cF,[cB.link]:dF,[cB.dot]:uF,[cB.wordCloud]:pF,[cB.wordCloud3d]:pF,[cB.funnel]:gF,[cB.funnel3d]:mF,[cB.linearProgress]:fF,[cB.waterfall]:vF,[cB.boxPlot]:_F,[cB.treemap]:yF,[cB.sankey]:bF,[cB.gauge]:xF,[cB.gaugePointer]:SF,[cB.sunburst]:AF,[cB.rangeColumn]:kF,[cB.rangeColumn3d]:MF,[cB.circlePacking]:TF,[cB.heatmap]:wF,[cB.correlation]:CF,[cB.rangeArea]:EF,[cB.liquid]:PF,[cB.venn]:BF};function OF(t){var e,i;const{type:s}=t;return s===cB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const IF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},DF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function FF(t,e){var i;if(!t)return[];const s=WF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?VF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>NF(i)?zF(t,i,e):i)).filter(p)}))):i.map((i=>NF(i)?zF(t,i,e):i)).filter(p):[]}return[]}function jF(t,e){var i,s;return VF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function zF(t,e,i){var s;const n=WF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=DF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ve(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=he(t,i,s),a=le(n,r,e.l),l=new ve(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const HF=(t,e,i)=>{if(e&&NF(t)){const s=zF(e,t,i);if(s)return s}return t};function NF(t){return t&&"palette"===t.type&&!!t.key}function VF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function GF(t){return y(t)?{dataScheme:t}:t}function WF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=OF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class UF extends aC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!VF(this._range))return void super.range(this._range);const t=jF(this._range,this._domain);super.range(t)}}const YF={linear:EC,band:lC,point:class extends lC{constructor(t){super(!1),this.type=Lw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:aC,threshold:OC,colorOrdinal:UF};function KF(t){const e=YF[t];return e?new e:null}function XF(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function $F(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZF(t){return!!_(t)&&(!!t.endsWith("%")&&ob(t.substring(0,t.length-1)))}function JF(t,e,i,s=0){var n,r;return S(t)?t:ZF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QF(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JF(t[s],e.size,i)}))})),o}function tj(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||ZF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ej(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ij=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},sj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],nj={default:{dataScheme:sj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},rj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",aj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:rj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:rj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:BB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},oj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},lj=Object.assign(Object.assign({},oj),{label:{space:0}}),hj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},cj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",dj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:cj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},uj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},pj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},gj={horizontal:Object.assign(Object.assign({},uj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj}),vertical:Object.assign(Object.assign({},uj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:pj})},mj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},fj={horizontal:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj}),vertical:Object.assign(Object.assign({},uj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:mj})},vj={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},_j={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function bj(t,e){return t&&e.key in t?t[e.key]:e.default}function xj(t){return t&&"token"===t.type&&!!t.key}const Sj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},Aj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:nj,token:Sj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:aj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:gj,sizeLegend:fj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:oj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:lj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:_j,markArea:vj,markPoint:yj,polarMarkLine:_j,polarMarkArea:vj,polarMarkPoint:yj,geoMarkPoint:yj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:dj,crosshair:hj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},kj={name:"dark",colorScheme:{default:{dataScheme:sj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Mj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Mj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Mj(t[i],e[i])))),Tj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),Tj(t[s],e.slice(1),i))};function wj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof _a||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=wj(n,e)}return s}function Cj(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Ej(t,e,r,i):Pj(t,r,s[r])}}}}function Ej(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Bj({},t[n][e.index],i):i):t[n]=s?Bj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Bj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Bj({},t[n],i):i)}))}function Lj(t,...e){return Bj(Oj(t),...e.map(Oj))}function Oj(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=GF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(LF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Ij(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Ij(t,e,i,s){if(!LF[e])return t;const n={};return Object.values(LF[e]).forEach((({type:e,name:r})=>{n[r]=Bj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Dj=["animationThreshold","colorScheme","name","padding"];function Fj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Dj.includes(r)?n[r]=a:f(a)?NF(a)?n[r]=HF(a,e,s):xj(a)?n[r]=bj(i,a):n[r]=Fj(a,e,i,s):n[r]=a})),n}const jj={[Aj.name]:Aj},zj=Aj.name,Hj=new Map(Object.keys(jj).map((t=>[t,jj[t]]))),Nj=new Map(Object.keys(jj).map((t=>[t,Fj(jj[t])]))),Vj=new Map(Object.keys(jj).map((t=>[t,t===zj]))),Gj=(t,e)=>{if(!t)return;const i=Kj(e);Hj.set(t,i),Nj.set(t,Fj(i)),Vj.set(t,!0)},Wj=(t=zj,e=!1)=>(Vj.has(t)&&!Vj.get(t)&&Gj(t,Hj.get(t)),e?Nj.get(t):Hj.get(t)),Uj=t=>Hj.delete(t)&&Nj.delete(t)&&Vj.delete(t),Yj=t=>!!_(t)&&Hj.has(t),Kj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:zj;return Lj({},Wj(i),t)};class Xj{static registerInstance(t){Xj.instances.set(t.id,t)}static unregisterInstance(t){Xj.instances.delete(t.id)}static getInstance(t){return Xj.instances.get(t)}static instanceExist(t){return Xj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Xj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Xj.instances=new Map;class $j{static registerTheme(t,e){Gj(t,e)}static getTheme(t,e=!1){return Wj(t,e)}static removeTheme(t){return Uj(t)}static themeExist(t){return Yj(t)}static getDefaultTheme(){return $j.themes.get(zj)}static setCurrentTheme(t){$j.themeExist(t)&&($j._currentThemeName=t,Xj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return $j.getTheme($j._currentThemeName,t)}static getCurrentThemeName(){return $j._currentThemeName}}function qj(t,e){return _(t)?$j.themeExist(t)?$j.getTheme(t,e):{}:g(t)?t:{}}function Zj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Zj(t[s],e)}return i}return y(t)?t.map((t=>Zj(t,e))):t}function Jj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}$j.themes=Hj,$j._currentThemeName=zj;function Qj(t,e){for(let i=0;it.key===e))}function ez(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function iz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},oz(t,a,n[o],l,e,r))})),s?sz(n):n}function sz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):sz(t[e].nodes);return t}function nz(t,e){if("values"in t&&t.values.length){const i=eB(t.values,e),s=tB(t.values,PD);t.values.forEach((t=>{t[LD]=i,t[OD]=s,delete t[ID]}));const n=t.values.reduce(((t,e)=>e[CD]>t[CD]?e:t));n[ID]=!0}else for(const i in t.nodes)nz(t.nodes[i],e)}function rz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][CD]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[wD]=s,s+=r[CD],r[CD]=s):(r[wD]=n,n+=r[CD],r[CD]=n),r[TD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[ED]=0===h?0:Math.min(1,l[wD]/h)*r,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r}}for(const s in t.nodes)az(t.nodes[s],e,i)}function oz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[CD]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),oz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const lz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=cz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function dz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>gz(t.style(e,i,s,n)):B(t.style)||(e.style=gz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>gz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=gz(t.state[e]))})),e.state=i}return e}function uz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e,s,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}function pz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),gz(i)}function gz(t){return(null==t?void 0:t.angle)&&(t.angle=Qt(t.angle)),t}class mz{static registerChart(t,e){mz._charts[t]=e}static registerSeries(t,e){mz._series[t]=e}static registerComponent(t,e,i){mz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){mz._marks[t]=e}static registerRegion(t,e){mz._regions[t]=e}static registerTransform(t,e){mz.transforms[t]=e}static registerLayout(t,e){mz._layout[t]=e}static registerAnimation(t,e){mz._animations[t]=e}static registerImplement(t,e){mz._implements[t]=e}static registerChartPlugin(t,e){mz._chartPlugin[t]=e}static registerComponentPlugin(t,e){mz._componentPlugin[t]=e}static createChart(t,e,i){if(!mz._charts[t])return null;return new(0,mz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!mz._charts[t])return null;const i=mz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!mz._regions[t])return null;return new(0,mz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!mz._regions[t])return null;return new(0,mz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!mz._series[t])return null;return new(0,mz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!mz._series[t])return null;return new(0,mz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!mz._marks[t])return null;const s=new(0,mz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(mz._components)}static getComponentInKey(t){return mz._components[t].cmp}static getLayout(){return Object.values(mz._layout)}static getLayoutInKey(t){return mz._layout[t]}static getSeries(){return Object.values(mz._series)}static getSeriesInType(t){return mz._series[t]}static getRegionInType(t){return mz._regions[t]}static getAnimationInKey(t){return mz._animations[t]}static getImplementInKey(t){return mz._implements[t]}static getSeriesMarkMap(t){return mz._series[t]?mz._series[t].mark:{}}static getChartPlugins(){return Object.values(mz._chartPlugin)}static getComponentPlugins(){return Object.values(mz._componentPlugin)}static getComponentPluginInType(t){return mz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}mz._charts={},mz._series={},mz._components={},mz._marks={},mz._regions={},mz._animations={},mz._implements={},mz._chartPlugin={},mz._componentPlugin={},mz.transforms={fields:Lr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},mz.dataParser={csv:Ur,dsv:Wr,tsv:Yr},mz._layout={};const fz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},vz=(t,e,i,s)=>{var n;const r=Nw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:_z(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,yz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},bz=(t,e)=>{if(!t)return null;if(!lB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=yz(t,(t=>"angle"===t.getOrient()),e),r=yz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Nw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=nB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=rB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=vz(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Nw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=nB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=rB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=vz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function xz(t){return"bottom"===t||"top"===t}function Sz(t){return"left"===t||"right"===t}function Az(t){return"z"===t}function kz(t,e){return qF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Mz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Tz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?xz(t)?"linear":"band":xz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const wz=t=>t.fieldX[0],Cz=t=>t.fieldY[0],Ez=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Pz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Bz=(t,e)=>t?e?wz:Ez:e?Cz:Pz,Rz=(t,e,i)=>{var s,n;if(!t)return null;if(!lB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=yz(t,(t=>xz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=yz(t,(t=>Sz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Nw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Lz(s,i,t,Bz(e,Nw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Lz(s,i,t,Bz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Lz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Oz(t,a,s)},Oz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=vz(e,t,"cartesian",null!=i?i:xz(t.getOrient())?wz:Cz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Iz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Jy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Jy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Rz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=bz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Nw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return xz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Oz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Dz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Dz||(Dz={}));const Fz={[Dz.dimensionHover]:class extends Iz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!fz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),sb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),sb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Dz.dimensionClick]:class extends Iz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let jz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(Fz[t]){const e=new Fz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(Fz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class zz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Hz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Nz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new zz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Hz[a]&&(a=Hz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=xt(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=bt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return uD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteraction(e)}}function Vz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Gz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Wz=new Map;let Uz;function Yz(){Uz||(Uz=new fa,Gz(Uz,"geojson",ca),Gz(Uz,"topojson",ua),Vz(Uz,"simplify",Br))}function Kz(t,e,i={type:"geojson",centroid:!0}){Wz.has(t)&&Zy(`map type of '${t}' already exists, will be overwritten.`),Yz();const s=new _a(Uz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Wz.set(t,s)}function Xz(t){Wz.has(t)?Wz.delete(t):Zy(`map type of '${t}' does not exists.`)}function $z(t,e=!1){let i=e;return t.latestData instanceof _a&&(i=!1),i?I(t.latestData):t.latestData.slice()}const qz=(t,e)=>0===t.length?[]:1===t.length?$z(t[0],null==e?void 0:e.deep):t.map((t=>$z(t,null==e?void 0:e.deep)));function Zz(t,e,i){Vz(e=e instanceof fa?e:t.dataSet,"copyDataView",qz);const s=new _a(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:tH.copyDataView}),s}function Jz(t,e,i=[],s={}){var n,r,a;if(t instanceof _a)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new _a(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Jy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Jy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Zy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function Qz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var tH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(tH||(tH={}));const eH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new rt(null!==(t=this._option.logLevel)&&void 0!==t?t:nt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new fO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:aH(this._option.mode),autoFit:!1,eventConfig:{gesture:sb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(L_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=L_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return ib(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function lH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Jy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function hH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Bj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function cH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ei(l,i.width,i.height);a=t,o=e}else if(h&&ib(e.mode)){let t;t=_(h)?L_.getElementById(h):h;const{width:e,height:s}=ei(t,i.width,i.height);a=e,o=s}else if(nb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function dH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme")}),t}function uH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(nH||(nH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(rH||(rH={}));class pH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},pH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}pH.defaultMarkInfo={};class gH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new pH,this._markReverse=new pH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(nH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(nH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(nH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(nH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[nH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[nH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Dz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const mH={};Object.values(nH).forEach((t=>{mH[t]=!0}));const fH={[nH.STATE_HOVER]:nH.STATE_HOVER_REVERSE,[nH.STATE_SELECTED]:nH.STATE_SELECTED_REVERSE,[nH.STATE_DIMENSION_HOVER]:nH.STATE_DIMENSION_HOVER_REVERSE};function vH(t){return fH[t]}class _H{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=vH(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=vH(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=vH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=vH(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class yH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class bH extends yH{constructor(){super(...arguments),this.id=ab(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xH extends bH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=sH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class SH extends yH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class AH extends SH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class kH extends AH{constructor(){super(...arguments),this.id=ab(),this.stateKeyToSignalName=t=>`${uB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===iH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===iH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?iH.none:iH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?iH.exit:"update"===e.diffState?iH.update:iH.appear}}}}class MH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Bj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TH extends yH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=MH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new pH,this._lastLayoutRect=null,this.id=ab(),this.userId=t.id,this._spec=t,this.effect={},this.event=new jz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${uB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=mz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class wH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=QF(tj(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=JF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=JF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=JF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class CH extends TH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new wH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EH extends MH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class PH extends CH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=EH,this.modelType="region",this.specKey="region",this.type=PH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new _H,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new gH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in rH)B(t.stateStyle[rH[e]])||this.interaction.registerMark(rH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function BH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function RH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function LH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function OH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),LH(c,!0,u,o),s&&RH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function IH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),LH(c,!1,u,a),s&&RH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function FH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"left"),n.length&&OH(n,e,i,!0,"left"),r.length&&IH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"top"),n.length&&DH(n,e,i,!0,"top"),r.length&&FH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&OH(s,e,i,!1,"right"),n.length&&OH(n,e,i,!0,"right"),r.length&&IH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=BH(t);s.length&&DH(s,e,i,!1,"bottom"),n.length&&DH(n,e,i,!0,"bottom"),r.length&&FH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:s,height:n}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Jy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}jH.type="base";const zH=["line","area","trail"];function HH(t){return zH.includes(t)}class NH extends AH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(HH)?s:!t.mark||HH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!mH[t])).map((t=>[t,10])),s=!t.mark||HH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(zw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class VH extends bH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class GH extends VH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${uB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class WH extends bH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=sH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new NH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new jz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new GH(t)}stateKeyToSignalName(t){return`${uB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=nH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=nH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===iH.appear&&this.runAnimationByState(iH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(iH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class UH extends WH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Qt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Bj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=KF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):HD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Hw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},WD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=ve.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)HD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=jF(FF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class YH extends UH{constructor(){super(...arguments),this.type=YH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Zy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Zy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}YH.type="group";const KH=()=>{bM(),aM(),CR.registerGraphic(IB.group,wu),mz.registerMark(YH.type,YH)},XH={type:"fadeIn"};function $H(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return XH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const qH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},ZH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},JH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},QH=()=>{mz.registerAnimation("scaleInOut",(()=>ZH))},tN=()=>{mz.registerAnimation("fadeInOut",(()=>JH))},eN=(t,e)=>({appear:$H(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Gc,duration:qH.update.duration,easing:qH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),iN=()=>{mz.registerAnimation("line",eN)},sN=()=>{fO.useRegisters([XI,$I,qI,ZI,JI,QI,jI,zI])},nN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Sj.fontFamily,fontSize:Sj.fontSize}))(e,i,s).measure(t)};class rN{static instance(){return rN.instance_||(rN.instance_=new rN),rN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class aN{constructor(){this.id=ab(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Zy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class oN extends aN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class lN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>mz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>mz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>mz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return mz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>mz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){mz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}static getFunction(t){return t?rN.instance().getFunction(t):null}static getFunctionList(){return rN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=mz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=mz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Wz.get(e);var e}static hideTooltip(t=[]){Xj.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ab(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=bt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=ib(p);v?Rx(Ql):"node"===p&&uA(Ql),v&&d&&(this._container=_(d)?L_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=$j.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new oH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Nz(this,this._compiler),this._event=new jz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Xj.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Bj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Zj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;lN.getFunctionList()&&lN.getFunctionList().length&&(t=Jj(t,lN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=mz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=mz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return cH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:pB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:gB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof fa?t:new fa,Gz(this._dataSet,"dataview",pa),Gz(this._dataSet,"array",s),Vz(this._dataSet,"stackSplit",eH),Vz(this._dataSet,"copyDataView",qz);for(const t in mz.transforms)Vz(this._dataSet,t,mz.transforms[t]);for(const t in mz.dataParser)Gz(this._dataSet,t,mz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)),null===(n=this._compiler)||void 0===n||n.releaseGrammar(!1===(null===(r=this._option)||void 0===r?void 0:r.animation)||!1===(null===(a=this._spec)||void 0===a?void 0:a.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme&&(this._setCurrentTheme(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily)),t.reCompile&&(null===(l=this._compiler)||void 0===l||l.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(h=this._compiler)||void 0===h||h.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?iH.appear:iH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Xj.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof _a?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Jz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)||(a.changeTheme=!0);const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=dH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Rj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Bj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=qj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Lj({},qj(this._currentThemeName,!0),qj(s,!0),qj(n,!0));this._currentTheme=t}else{const t=Lj({},qj(this._currentThemeName),qj(s),qj(n));this._currentTheme=Fj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!ib(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return qj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!$j.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield lH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!ib(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?L_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ej(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Zy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ej(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Zy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rN.instance().getFunction(t)}registerFunction(t,e){t&&e&&rN.instance().registerFunction(t,e)}unregisterFunction(t){t&&rN.instance().unregisterFunction(t)}getFunctionList(){return rN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=mz.getChartPlugins();t.length>0&&(this._chartPlugin=new oN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}lN.InstanceManager=Xj,lN.ThemeManager=$j,lN.globalConfig={uniqueTooltip:!0},lN.Utils=nN,lN.vglobal=L_;mz.registerRegion("region",PH),mz.registerLayout("base",jH),KH(),fO.useRegisters([sI,nI]),fO.useRegisters([aD,oD,HI,NI,nD,rD,lD,hD,cD]),$R(),XR(),Gj(kj.name,kj),rt.getInstance(nt.Error);const hN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(cB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=mz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=mz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},cN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=hN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Mj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Bj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Bj(m,f),hasChanged:!0};const i=Bj({},t,f);Tj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class dN{constructor(t){this.id=ab(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const uN=t=>{mz.registerChartPlugin(t.type,t)};class pN extends dN{constructor(){super(pN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[pN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[pN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=wj(this._option.globalInstance.getSpec(),["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=wj(this._baseChartSpec,["data",pN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=cN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=wj(i,["data",pN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}pN.pluginType="chart",pN.specKey="media",pN.type="MediaQueryPlugin";const gN=/\{([^}]+)\}/,mN=/\{([^}]+)\}/g,fN=/:/;class vN extends dN{constructor(){super(vN.type),this.type="formatterPlugin",this._timeModeFormat={utc:ci.getInstance().timeUTCFormat,local:ci.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=_i.getInstance().format,this._numericSpecifier=_i.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[vN.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),mz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=gN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(mN,((t,i)=>{if(!fN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(mi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}vN.pluginType="chart",vN.specKey="formatter",vN.type="formatterPlugin";function _N(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function yN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function bN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function xN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function SN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function AN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const kN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return IC(v)};class MN extends dN{constructor(){super(MN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!zw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&_N(c)&&_N(d)))return;const u=yN(t,c),p=yN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!xN(u,p))return}else if(0===y&&0===b){if(!xN(p,u))return}else if(_||A)if(_&&!A){if(!bN(u,p))return}else if(A&&!_){if(!bN(p,u))return}else{if(m===b)return;if(m>b){if(!SN(u,p))return}else if(!SN(p,u))return}else{if(0===m&&0===y){if(!AN(u,p))return}else if(0===b&&0===g&&!AN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Vz(e.getOption().dataSet,"tickAlign",kN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}MN.pluginType="component",MN.type="AxisSyncPlugin";const TN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,wN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},_m||(_m=fm.CreateGraphic("richtext",{})),_m.setAttributes(a),_m.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},CN="vchart-tooltip-container",EN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function PN(t,e){return R(e,`component.${t}`)}function BN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=mz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const RN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function LN(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function ON(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function IN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function DN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const FN=(t,e,i)=>{var s;const n=null!==(s="band"===e?PN("axisBand",i):["linear","log","symlog"].includes(e)?PN("axisLinear",i):{})&&void 0!==s?s:{},r=xz(t)?PN("axisX",i):Sz(t)?PN("axisY",i):PN("axisZ",i);return Bj({},PN("axis",i),n,r)},jN=(t,e,i)=>{var s;const n=null!==(s="band"===e?PN("axisBand",i):"linear"===e?PN("axisLinear",i):{})&&void 0!==s?s:{},r=PN("angle"===t?"axisAngle":"axisRadius",i);return Bj({},PN("axis",i),n,r)},zN=t=>"band"===t||"ordinal"===t||"point"===t;function HN(t,e){return{id:t,label:t,value:e,rawValue:t}}function NN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function VN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const GN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Nw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(zw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=VN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=LN(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Nw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(zw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=VN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=LN(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(UN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&WN(t,"top",r.label),e.visible&&WN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(UN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&WN(t,"left",a.label),e.visible&&WN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},WN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=BN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},UN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},YN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=XN(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},KN=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=XN(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},XN=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},$N=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},qN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},ZN=(t,e)=>{var i,s;return null!==(s=null===(i=qN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},JN=(t,e)=>{var i,s;return null!==(s=null===(i=qN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},QN=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=GN(3,e,i,s,n,r,a);return o?YN(r,o,d,h):l?KN(a,l,u,c):void 0},tV={fontFamily:Sj.fontFamily,spacing:10,wordBreak:"break-word"};function eV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:tV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const iV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},sV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,nV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),rV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function aV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=oV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>nV(i,s)(t)&&nV(n,r)(t)&&(u(a)||nV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return lN.globalConfig.uniqueTooltip&&lN.hideTooltip(u.id),d}return"none"}const oV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=sV(c,t);let _=sV(d,t);const y=rV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(nV(c,v));if(!y&&(_=sV(d,i),!rV(_)))return;const n=e.type===cB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Nw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(nV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=sV(d,o),!rV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(nV(c,n));if(!y&&(_=sV(d,r),!rV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(nV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=sV(d,i),!rV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},lV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const hV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class cV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class dV extends cV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:pV(e.title,{seriesId:this.series.id},!0),content:gV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=lV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const uV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},pV=(t,e,i)=>p(t)?d(t)?(...s)=>uV(t(...s),e,i):uV(t,e,i):void 0,gV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>uV(t,e,i))):uV(t,e,i))):void 0;return s},mV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=hV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=hV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},fV=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=vV(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&lV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},vV=mt((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),_V=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},yV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=BN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},xV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class SV{}SV.dom=`${uB}_TOOLTIP_HANDLER_DOM`,SV.canvas=`${uB}_TOOLTIP_HANDLER_CANVAS`;const AV=20,kV={key:"其他",value:"..."},MV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ci.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},TV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=xV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==bV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:MV(bV(c,t,i,v),p,g),valueStyle:bV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=AV}=t,x=t.othersLine?Object.assign(Object.assign({},kV),t.othersLine):kV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=wV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=wV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},wV=(t,e,i)=>{const s=MV(bV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=MV(bV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==bV(e.visible,t,i)&&(p(s)||p(n)),a=bV(e.isKeyAdaptive,t,i),o=bV(e.spaceRow,t,i),l=bV(e.shapeType,t,i),h=bV(e.shapeColor,t,i),c=bV(e.shapeFill,t,i),d=bV(e.shapeStroke,t,i),u=bV(e.shapeLineWidth,t,i),g=bV(e.shapeHollow,t,i),m=bV(e.keyStyle,t,i),f=bV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class CV extends dN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=xV(x.position,b,e),M=null!==(n=xV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:pB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:gB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(ib(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=TN(t,e),j=TN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=QN(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(ZN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=QN(e.dimensionInfo,lB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(JN(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=$N(t,c),N=$N(i,c),V=$N(e,c),G=$N(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=$N(t,c):Y(t),S(e)||d(e)?N=$N(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(ZN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(JN(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,ib(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===ZN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===ZN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===JN(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===JN(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(ZN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(JN(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,xt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},EN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:EN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:EN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ti(d.padding),x=tj(d.padding),S=eV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=eV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=eV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:iV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Bj({},A,eV(b,void 0,{})),{width:s,height:n,text:r}=wN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Bj({},k,eV(x,void 0,{})),{width:e,height:s,text:n}=wN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Bj({},S,eV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=wN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(ib(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=TN(t,s),u=TN(l,c)}return s*=d,n*=d,ib(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(Ie(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Ke([c,a,o],r.x,r.y)||Ke([c,l,h],r.x,r.y)||Ke([c,a,h],r.x,r.y)||Ke([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}CV.specKey="tooltip";const EV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",PV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let BV;const RV=(t=document.body)=>{if(u(BV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),BV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return BV};function LV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Bj({},e,t),s={};return s.width=EV(i),s}(C),R=OV(E),L=OV(P),{bottom:O,left:I,right:D,top:F}=tj(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:EV(T+2*M),minHeight:EV(g+2*M),paddingBottom:EV(O),paddingLeft:EV(I),paddingRight:EV(D),paddingTop:EV(F),borderColor:k,borderWidth:EV(M),borderRadius:EV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?EV(null==r?void 0:r.spaceRow):"0px"},OV(Bj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return IV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=IV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==eb?void 0:eb.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(IV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}IV.type="tooltipModel";const DV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},FV={boxSizing:"border-box"},jV={display:"inline-block",verticalAlign:"top"},zV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},HV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},VV={lineHeight:"normal",boxSizing:"border-box"};class GV extends IV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=PV(u),y=t=>new Sg({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class WV extends IV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const UV={overflowWrap:"normal",wordWrap:"normal"};class YV extends IV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=et(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=et(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Bj({},jV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Bj({},o?HV:zV,Object.assign(Object.assign(Object.assign({height:EV(l)},UV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Bj({},NV,Object.assign(Object.assign(Object.assign({height:EV(s)},UV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Bj({},VV,Object.assign(Object.assign({height:EV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class KV extends IV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new YV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Bj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+PV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+RV(this._option.getContainer())}px`,maxHeight:EV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class XV extends IV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new GV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new WV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Bj({},DV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const $V="99999999999999";class qV extends IV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:$V,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new XV(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new KV(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Bj({},FV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const ZV=t=>{mz.registerComponentPlugin(t.type,t)};class JV extends CV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(JV.type),this.type=SV.dom,this._tooltipContainer=null==eb?void 0:eb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(eb&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=LV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!ii(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}JV.type=SV.dom;class QV extends CV{constructor(){super(QV.type),this.type=SV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ZP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}QV.type=SV.canvas;const tG=()=>{ZV(QV)},eG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},iG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},sG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=Qj([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return nG(a,n,o)},nG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{ob(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{ob(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=iG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},rG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{ob(t[e])||(t[e]=0)}))})),t};class aG extends VH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const oG=`${uB}_HIERARCHY_DEPTH`,lG=`${uB}_HIERARCHY_ROOT`,hG=`${uB}_HIERARCHY_ROOT_INDEX`;function cG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function dG(t,e,i){t&&(i.needDefaultSeriesField&&(t[AD]=i.defaultSeriesField),t[xD]=e,t[SD]=i.getKey(t,e,i))}function uG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function pG(t,e,i,s=0,n,r){void 0===r&&(r=e),dG(t,e,i),t[oG]=s,t[lG]=n||t[i.categoryField],t[hG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>pG(e,s,i,t[oG]+1,t[lG],r)))}const gG=["appear","enter","update","exit","disappear","normal"];function mG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return bG(n)&&delete n.type,n.oneByOne&&(n=vG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:_G,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Bj({},o[e],a);return bG(n)&&delete n.type,n.oneByOne&&(n=vG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:_G,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function fG(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),xG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function vG(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function _G(t,e){var i,s;return null!==(i=null==t?void 0:t[xD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function yG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function bG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function xG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),xG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),xG(t[i],e)}function SG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class AG extends MH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Ij(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Bj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Bj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Bj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class kG extends TH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${uB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=AG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=SG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"invalidTravel",rG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Jz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Zz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Zz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new aG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=nG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Vz(this._dataSet,"dimensionStatistics",sG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new _a(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Qj(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Vz(this._dataSet,"dimensionStatistics",sG);const s=new _a(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=Qj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Qj(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new _a(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",eG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:cG.bind(this),call:dG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=mG({},fG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:sb(s)||nb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Bj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Bj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:nH.STATE_HOVER_REVERSE,highlightState:nH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:nH.STATE_SELECTED_REVERSE,state:nH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:AD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:kD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,kD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new dV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},qD),ZD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>ZD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof _a||Qz(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();SG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:AD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new UF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return FF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:AD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Bj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:SD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==CD&&t!==PD&&t!==wD&&t!==ED||(t=this.getStackValueField()),null!==(e=ez(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=LF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>ob(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:AD]}}function MG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();zw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function TG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}kG.mark=UD,kG.transformerConstructor=AG;class wG extends kG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);zw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${uB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(CD),this.setFieldX2(wD)):(this.setFieldY(CD),this.setFieldY2(wD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(PD),this.setFieldX2(ED)):(this.setFieldY(PD),this.setFieldY2(ED))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(RD),this.setFieldX2(BD)):(this.setFieldY(RD),this.setFieldY2(BD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(MG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const CG="monotone",EG="linear";class PG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(tF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:EG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===CG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(tF.point,{morph:yG(this._spec,tF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new _a(this._option.dataSet,{name:`${uB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[tF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Dz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Bj({},this._spec[tF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:nH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class BG extends UH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Hw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class RG extends BG{constructor(){super(...arguments),this.type=RG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===cB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}RG.type="line";const LG=()=>{mz.registerMark(RG.type,RG),bM(),cM(),CR.registerGraphic(IB.line,Tg),sN()};class OG extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class IG extends OG{constructor(){super(...arguments),this.type=IG.type}}IG.type="symbol";const DG=()=>{mz.registerMark(IG.type,IG),bO()};class FG extends AG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class jG extends aN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function zG(t,e,i,s){switch(t){case r.cartesianBandAxis:return FN(kz(i,["z"]),"band",e);case r.cartesianLinearAxis:return FN(kz(i,["z"]),"linear",e);case r.cartesianLogAxis:return FN(kz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return FN(kz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return FN(kz(i),void 0,e);case r.polarBandAxis:return jN(i.orient,"band",e);case r.polarLinearAxis:return jN(i.orient,"linear",e);case r.polarAxis:return jN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=PN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>xz(t.orient)));let d;d=p(c)?Bj({},zN(c.type)?a:o,l):l;const u=n.find((t=>Sz(t.orient)));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=PN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Bj({},zN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Bj({},Nw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return HG(i,PN(t,e));default:return PN(t,e)}}const HG=(t,e)=>{var i;const s=Bj({},e,e[Mz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class NG extends MH{getTheme(t,e){return zG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},tj(e)),{[s]:0}))}}class VG extends CH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new jG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=NG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof nc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new kH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}VG.transformerConstructor=NG;class GG extends UH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(IB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}GG.type="component";const WG=()=>{mz.registerMark(GG.type,GG)},UG=t=>t;class YG extends VG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?zB.circleAxisGrid:zB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=mG(null===(o=mz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new VH(this._option,t)]}collectData(t,e){const i=[];return aB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?zw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return aB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(aB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=dz(s=t.domainLine)).startSymbol=dz(s.startSymbol),s.endSymbol=dz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return gz(Bj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:gz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>gz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=gz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:gz(t.tick.style)),t.tick.state&&(i.tick.state=uz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return gz(Bj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:gz(t.subTick.style)),t.subTick.state&&(i.subTick.state=uz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=RN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Qt(p):null,textStyle:Bj({},d,gz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:gz(h.style)}),h.state&&(i.title.state.shape=uz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:gz(o.style)}),o.state&&(i.title.state.background=uz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=uz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=gz(t.background.style)),t.background.state&&(i.panel.state=uz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return gz(Bj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:gz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:gz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=BN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Gz(this._option.dataSet,"scale",UG),Vz(this._option.dataSet,"ticks",XC);return new _a(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}YG.specKey="axes";const KG=()=>{CR.registerGraphicComponent(jB.lineAxis,((t,e)=>new Bw(t,e))),CR.registerGraphicComponent(jB.circleAxis,(t=>new Iw(t))),CR.registerComponent(DB.axis,NO),CR.registerGraphicComponent(zB.lineAxisGrid,((t,e)=>new QC(t,e))),CR.registerGraphicComponent(zB.circleAxisGrid,((t,e)=>new eE(t,e))),CR.registerComponent(DB.grid,WO),WG(),mz.registerAnimation("axis",(()=>({appear:{custom:Fw},update:{custom:Dw},exit:{custom:Kc}})))},XG=[MN];class $G extends YG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{const e=this.getOrient();xz(e)?t.setXAxisHelper(this.axisHelper()):Sz(e)?t.setYAxisHelper(this.axisHelper()):Az(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Bj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Bj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=xz(this.getOrient()),n=t=>{var e;return(s?!xz(t.getOrient()):xz(t.getOrient()))&&zw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=kz(i,["z"]),Az(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!IN(e))return null;const{axisType:t,componentName:s}=Tz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Sz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!IN(t))return;const{axisType:s,componentName:n}=Tz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];xz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):Az(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(XG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){xz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!xz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!Az(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Sz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=xz(this.getOrient())?t.fieldX:Az(this.getOrient())?t.fieldZ:t.fieldY,zw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(xz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=xz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return aB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:xz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Az(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();aB(this._regions,(e=>{xz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Sz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Az(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=xz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=xz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Bj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return HN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=ON(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=qG?10:n>=ZG?5:n>=JG?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class tW extends $G{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}tW.type=r.cartesianLinearAxis,tW.specKey="axes",U(tW,QG);const eW=()=>{KG(),mz.registerComponent(tW.type,tW)};class iW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=HN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>HN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class sW extends $G{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Qw(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{KG(),mz.registerComponent(sW.type,sW)};class rW extends tW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{xz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Bj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new VH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ci.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>HN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>HN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}rW.type=r.cartesianTimeAxis,rW.specKey="axes";class aW extends tW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new RC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}aW.type=r.cartesianLogAxis,aW.specKey="axes",U(aW,QG);class oW extends tW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}oW.type=r.cartesianSymlogAxis,oW.specKey="axes",U(oW,QG);class lW extends wG{constructor(){super(...arguments),this.type=cB.line,this.transformerConstructor=FG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=TG(this);this._symbolMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fG("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}lW.type=cB.line,lW.mark=eF,lW.transformerConstructor=FG,U(lW,PG);class hW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{Qz(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof _a)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class cW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{lb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Qj(e,[{key:t,operations:zw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&Qj(e,[{key:i.field,operations:zw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?KF("colorOrdinal"):KF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(lb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),lb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!lb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=zw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=zw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;zw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=zw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));zw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class dW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=iz(t,!0);for(const e in a)for(const i in a[e].nodes)az(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)rz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&nz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class uW extends yH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ab(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pB,height:gB},this._viewRect={width:pB,height:gB},this._viewBox={x1:0,y1:0,x2:pB,y2:gB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=tj(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new jz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new hW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new dW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=mz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=mz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof UH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof UH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&Qz(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cH(this._spec,this._option,{width:pB,height:gB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=FF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new cW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){dH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=FF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{dH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,dH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):dH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];dH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=QF(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(nH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(nH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(nH.STATE_SELECTED)}clearHovered(){this.clearState(nH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Dz.dimensionHover||s===Dz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Nw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const pW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class gW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);Tj(t,r,l.spec),Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));Tj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=pW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=pW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(mz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=mz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=mz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class mW extends gW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Bj(i,uH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class fW extends mW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class vW extends uW{constructor(){super(...arguments),this.transformerConstructor=fW,this.type="line",this.seriesType=cB.line,this._canStack=!0}}vW.type="line",vW.seriesType=cB.line,vW.transformerConstructor=fW;class _W extends BG{constructor(){super(...arguments),this.type=_W.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}_W.type="area";const yW=()=>{mz.registerMark(_W.type,_W),bM(),tM(),CR.registerGraphic(IB.area,Xg),sN()};class bW extends dV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const xW=()=>{mz.registerAnimation("area",eN),iN(),QH()};class SW extends FG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Bj({},m.style,g.style),l.state=Bj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class AW extends wG{constructor(){super(...arguments),this.type=cB.area,this.transformerConstructor=SW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===CG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XF(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XF(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=TG(this);this._symbolMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new bW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}AW.type=cB.area,AW.mark=sF,AW.transformerConstructor=SW,U(AW,PG);class kW extends mW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),hH(t)}}class MW extends uW{constructor(){super(...arguments),this.transformerConstructor=kW,this.type="area",this.seriesType=cB.area,this._canStack=!0}}MW.type="area",MW.seriesType=cB.area,MW.transformerConstructor=kW;function TW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const wW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TW(t,e)}),CW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TW(t,e)}),EW={type:"fadeIn"},PW={type:"growCenterIn"};function BW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return EW;case"scaleIn":return PW;default:return wW(t)}}class RW extends UH{constructor(){super(...arguments),this.type=RW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}RW.type="rect";const LW=()=>{mz.registerMark(RW.type,RW),_O(),fO.useRegisters([WI,UI,YI,KI,VI,GI])};function OW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[YD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):XF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):XF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):XF(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},FW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:yG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Vz(this._option.dataSet,"addVChartProperty",eG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Vz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new _a(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:cG.bind(this),call:dG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new aG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=$D,s=XD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=KD,s=YD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=iz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)OW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=XF(this[n](t),o),d=XF(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[wD],n=t[CD],r=t[ED],h=t[PD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[wD]:i,[CD]:s}),a?{[ED]:o,[PD]:l}:void 0);t.push(Eg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>XF(this._dataToPosY(t),a),y1:t=>XF(this._dataToPosY1(t),a)}:{y:t=>XF(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>XF(this._dataToPosX(t),r),x1:t=>XF(this._dataToPosX1(t),r)}:{x:t=>XF(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=TG(this);this._barMark.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fG(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=ij(this._spec.barWidth,a)),l&&(c=Math.max(c,ij(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ij(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ij(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=zw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}FW.type=cB.bar,FW.mark=JD,FW.transformerConstructor=DW;const jW=()=>{rI(),LW(),mz.registerAnimation("bar",((t,e)=>({appear:BW(t,e),enter:wW(t,!1),exit:CW(t,!1),disappear:CW(t)}))),nW(),eW(),mz.registerSeries(FW.type,FW)};class zW extends mW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),hH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class HW extends uW{constructor(){super(...arguments),this.transformerConstructor=zW,this.type="bar",this.seriesType=cB.bar,this._canStack=!0}}HW.type="bar",HW.seriesType=cB.bar,HW.transformerConstructor=zW;class NW extends UH{constructor(){super(...arguments),this.type=NW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}NW.type="rect3d";class VW extends FW{constructor(){super(...arguments),this.type=cB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}VW.type=cB.bar3d,VW.mark=QD;class GW extends zW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class WW extends HW{constructor(){super(...arguments),this.transformerConstructor=GW,this.type="bar3d",this.seriesType=cB.bar3d}}WW.type="bar3d",WW.seriesType=cB.bar3d,WW.transformerConstructor=GW;const UW=[10,20],YW=Lw.Linear,KW="circle",XW=Lw.Ordinal,$W=["circle","square","triangle","diamond","star"],qW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class ZW extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class JW extends wG{constructor(){super(...arguments),this.type=cB.scatter,this.transformerConstructor=ZW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${uB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${uB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:YW,defaultRange:UW},"size")}getShapeAttribute(t,e){return u(e)?KW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:XW,defaultRange:$W},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(JW.mark.point,{morph:yG(this._spec,JW.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=TG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fG("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:KW},nH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},nH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},nH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}JW.type=cB.scatter,JW.mark=iF,JW.transformerConstructor=ZW;const QW=()=>{DG(),mz.registerAnimation("scatter",((t,e)=>Object.assign({appear:qW(0,e)},ZH))),nW(),eW(),mz.registerSeries(JW.type,JW)};class tU extends mW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class eU extends uW{constructor(){super(...arguments),this.transformerConstructor=tU,this.type="scatter",this.seriesType=cB.scatter,this._canStack=!0}}eU.type="scatter",eU.seriesType=cB.scatter,eU.transformerConstructor=tU;Rn();const iU={},sU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function nU(t,e){t&&_(t)||db("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(iU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Rn().projection(s),s.copy=s.copy||function(){const t=i();return sU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),iU[i]||null}const rU={albers:Zn,albersusa:function(){var t,e,i,s,n,r,a=Zn(),o=qn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=qn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(rU).forEach((t=>{nU(t,rU[t])}));const aU="Feature",oU="FeatureCollection";function lU(t){const e=Y(t);return 1===e.length?e[0]:{type:oU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===oU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===aU?t:{type:aU,geometry:t}))}(e))),[])}}const hU=sU.concat(["pointRadius","fit","extent","size"]);function cU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{hU.includes(s)&&(i=i.concat(mR(t[s],e)))})),i):i}let dU=class extends QR{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(mR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(mR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(mR(this.spec.size,this.view)),this.spec.size=t,this.attach(mR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(mR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(mR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(mR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(mR(t,this.view)),this.commit(),this}configure(t){return this.detach(cU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(cU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=nU((t||"mercator").toLowerCase());return e||db("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),sU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,vR(this.spec[t],e,nU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(vR(this.spec.pointRadius,e,nU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=lU(vR(this.spec.fit,e,nU));this.spec.extent?this.projection.fitExtent(vR(this.spec.extent,e,nU),t):this.spec.size&&this.projection.fitSize(vR(this.spec.size,e,nU),t)}return this.projection}output(){return this.projection}};const uU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class pU extends kG{constructor(){super(...arguments),this.type=cB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${uB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const gU=`${uB}_MAP_LOOK_UP_KEY`,mU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[xD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[gU]=e.nameMap[n]:t[gU]=n})),t.features);class fU extends dV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class vU extends UH{constructor(){super(...arguments),this.type=vU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}vU.type="path";const _U=()=>{mz.registerMark(vU.type,vU),vO()};class yU{constructor(t){this.projection=nU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class bU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class xU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function SU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:bU}:sb(e)||nb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:xU}:null}const AU={debounce:bt,throttle:xt};class kU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=sb(this._renderMode)||nb(this._renderMode),SU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return SU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!Ie({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,AU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,AU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||SU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||SU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:Ie({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,AU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,AU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){SU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||SU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;Ie({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||SU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||SU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=AU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=AU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function MU(t,e){return`${uB}_${e}_${t}`}class TU extends VG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:MU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Bj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new yU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===cB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),aB(this._regions,(t=>{var e;if(t.type===cB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new ae})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===cB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[gU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}TU.type=r.geoCoordinate,U(TU,kU);const wU=()=>{mz.registerComponent(TU.type,TU)};class CU extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class EU extends pU{constructor(){super(...arguments),this.type=cB.map,this.transformerConstructor=CU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Wz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Vz(this._dataSet,"copyDataView",qz),Vz(this._dataSet,"map",mU),Vz(this._dataSet,"lookup",uU);const i=Wz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new _a(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:tH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:gU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new aG(this._option,s)}initMark(){this._pathMark=this._createMark(EU.mark.area,{morph:yG(this._spec,EU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:AD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(mG(null===(t=mz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new fU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[xD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[xD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new ae}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new ae}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return xD}getActiveMarks(){return[this._pathMark]}}EU.type=cB.map,EU.mark=lF,EU.transformerConstructor=CU;const PU=()=>{CR.registerGrammar("projection",dU,"projections"),wU(),_U(),mz.registerSeries(EU.type,EU),mz.registerImplement("registerMap",Kz),mz.registerImplement("unregisterMap",Xz),tN()},BU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[ID]=!0:delete t[ID]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=LU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=Kt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RU(a,t,n,r,h,l,i,e),r.push(n)})),r};function RU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=LU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===fD)&&(t[fD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function LU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Zy("total.collectCountField error"):n=e[a].start;o<0?Zy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const OU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},IU={type:"fadeIn"},DU={type:"growCenterIn"};function FU(t,e){switch(e){case"fadeIn":return IU;case"scaleIn":return DU;default:return wW(t,!1)}}class jU extends UH{constructor(){super(...arguments),this.type=jU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jU.type="rule";const zU=()=>{mz.registerMark(jU.type,jU),yO()},HU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:NU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function NU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>NU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class VU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new _a(e instanceof fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Vz(e,"dimensionTree",HU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class GU extends DW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const WU={rect:$U,symbol:KU,arc:ZU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:JU,line:QU,area:QU,rect3d:$U,arc3d:ZU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function UU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=BN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function YU(t){return d(t)?e=>t(e.data):t}function KU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=YU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:XU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function XU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function $U(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=YU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:qU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function qU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function ZU(t){var e;const{labelSpec:i}=t,s=null!==(e=YU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function JU(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=UU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),_p(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function QU(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class tY extends FW{constructor(){super(...arguments),this.type=cB.waterfall,this.transformerConstructor=GU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new VU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=fD)}getSeriesKeys(){return this._seriesField===fD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Vz(this._dataSet,"waterfallFillTotal",OU),Vz(this._dataSet,"waterfall",BU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Zz(this.getViewData(),this._dataSet,{name:`${uB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new aG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:wD,endAs:CD,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=TG(this);this._barMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fG("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(tY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Kt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Kt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return JU(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?XF(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):XF(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}tY.type=cB.waterfall,tY.mark=vF,tY.transformerConstructor=GU;const eY=()=>{zU(),LW(),mz.registerAnimation("waterfall",((t,e)=>({appear:FU(t,e),enter:wW(t,!1),exit:CW(t,!1),disappear:CW(t,!1)}))),tN(),nW(),eW(),mz.registerSeries(tY.type,tY)},iY=`${uB}_BOX_PLOT_OUTLIER_VALUE`;var sY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(sY||(sY={}));const nY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[iY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class rY extends dV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===sY.OUTLIER)return this.series.getOutliersField();if(t===sY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case sY.MIN:return this.series.getMinField();case sY.MAX:return this.series.getMaxField();case sY.MEDIAN:return this.series.getMedianField();case sY.Q1:return this.series.getQ1Field();case sY.Q3:return this.series.getQ3Field();case sY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===sY.OUTLIER)return e[iY];if(t===sY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case sY.MIN:return e[this.series.getMinField()];case sY.MAX:return e[this.series.getMaxField()];case sY.MEDIAN:return e[this.series.getMedianField()];case sY.Q1:return e[this.series.getQ1Field()];case sY.Q3:return e[this.series.getQ3Field()];case sY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[iY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(sY.OUTLIER),value:this.getContentValue(sY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(sY.MAX),value:this.getContentValue(sY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(sY.Q3),value:this.getContentValue(sY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(sY.MEDIAN),value:this.getContentValue(sY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(sY.Q1),value:this.getContentValue(sY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(sY.MIN),value:this.getContentValue(sY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(sY.SERIES_FIELD),value:this.getContentValue(sY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class aY extends UH{constructor(){super(...arguments),this.type=aY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}aY.type="boxPlot";const oY=()=>{mz.registerMark(aY.type,aY),CR.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(TO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Sb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Sb(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),CR.registerAnimationType("boxplotScaleIn",wO),CR.registerAnimationType("boxplotScaleOut",CO),SO(),_O(),yO(),CR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(PO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),CR.registerAnimationType("barBoxplotScaleIn",BO),CR.registerAnimationType("barBoxplotScaleOut",RO),SO(),_O(),yO()};class lY extends wG{constructor(){super(...arguments),this.type=cB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(lY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(lY.mark.outlier,{progressive:t,key:xD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,nH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},nH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>XF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},nH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>XF(e(this.getDatumPositionValues(t,iY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>XF(e(this.getDatumPositionValues(t,iY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,nH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"foldOutlierData",nY),Vz(this._dataSet,"addVChartProperty",eG);const t=new _a(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${uB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:cG.bind(this),call:dG}},!1),this._outlierDataView=new aG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=TG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=mz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(mG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(mG(null===(a=mz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new rY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}lY.type=cB.boxPlot,lY.mark=_F;class hY extends UH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=hY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}hY.type="text";const cY=()=>{mz.registerMark(hY.type,hY),xO(),bM(),_M(),CR.registerGraphic(IB.richtext,Vg)};function dY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class uY extends dV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const pY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),gY={type:"fadeIn"},mY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function fY(t,e){return"fadeIn"===e?gY:pY(t)}class vY extends DW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class _Y extends FW{constructor(){super(...arguments),this.type=cB.rangeColumn,this._barMarkType="rect",this._barName=cB.bar,this.transformerConstructor=vY}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(_Y.mark.bar,{morph:yG(this._spec,_Y.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(_Y.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(_Y.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});dY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});dY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=TG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(mG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new uY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}_Y.type=cB.rangeColumn,_Y.mark=kF,_Y.transformerConstructor=vY;const yY=()=>{LW(),cY(),mz.registerAnimation("rangeColumn",((t,e)=>({appear:fY(t,e),enter:pY(t),exit:mY(t),disappear:mY(t)}))),tN(),nW(),eW(),mz.registerSeries(_Y.type,_Y)};class bY extends _Y{constructor(){super(...arguments),this.type=cB.rangeColumn3d,this._barMarkType="rect3d",this._barName=cB.bar3d}}bY.type=cB.rangeColumn3d,bY.mark=MF;class xY extends dV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class SY extends AW{constructor(){super(...arguments),this.type=cB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(SY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new xY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}SY.type=cB.rangeArea,SY.mark=EF;class AY extends kG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=RB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};zw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};zw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&MG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const kY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:s,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=ne(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[s]))),y=r-n;let b=n,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[xB],s=m?i/m:0;let n=s*y;n{g(e,n+i*t,t)}))}else{const t=x/S;b=n,i.forEach((e=>{const i=e[c]===a?a:e[xB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function MY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const TY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:MY(t,!0,iH.appear)}),wY={type:"fadeIn"},CY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:MY(t,!0,iH.enter)}),EY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:MY(t,!0,iH.exit)}),PY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:MY(t,!0,iH.exit)});function BY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wY;case"growRadius":return TY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return TY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class RY extends UH{constructor(t,e){super(t,e),this.type=LY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>ie({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[TB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class LY extends RY{constructor(){super(...arguments),this.type=LY.type}}LY.type="arc";const OY=()=>{bM(),Jk(),CR.registerGraphic(IB.arc,Zg),fO.useRegisters([iD,sD,tD,eD]),mz.registerMark(LY.type,LY)};class IY extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Bj({},this._theme,i,t);const n=(t,e)=>Bj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}class DY extends AY{constructor(){super(...arguments),this.transformerConstructor=IY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=EB,this._endAngle=PB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[TB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ie(this.computeCenter(t),(i+s)/2,e)}}getCenter(){var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?Qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Qt(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?Qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Vz(this._dataSet,"pie",kY),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?Qt(this._spec.minAngle):0,asStartAngle:AB,asEndAngle:kB,asRatio:SB,asMiddleAngle:TB,asRadian:CB,asQuadrant:wB,asK:MB}},!1);const e=new _a(this._dataSet,{name:`${uB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new aG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},DY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:yG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:SD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return hB(AB)(t)}endAngleScale(t){return hB(kB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$F(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$F(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:hB(_B).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:n,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===n&&t.centerX===s&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[TB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ie(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===iH.appear)return this._startAngle;if(i===iH.disappear)return this._endAngle;const n=[iH.disappear,iH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[xD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[xD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[TB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[TB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[TB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[TB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}DY.transformerConstructor=IY,DY.mark=rF;class FY extends DY{constructor(){super(...arguments),this.type=cB.pie}}FY.type=cB.pie;const jY=()=>{OY(),mz.registerAnimation("pie",((t,e)=>({appear:BY(t,e),enter:CY(t),exit:EY(t),disappear:PY(t)}))),mz.registerSeries(FY.type,FY)};class zY extends RY{constructor(){super(...arguments),this.type=zY.type,this._support3d=!0}}zY.type="arc3d";class HY extends IY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class NY extends DY{constructor(){super(...arguments),this.type=cB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=HY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[TB];return"inside"===i.position?te(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}NY.type=cB.pie3d,NY.mark=aF,NY.transformerConstructor=HY;const VY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},GY={type:"fadeIn"},WY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),UY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),YY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function KY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return GY;case"growAngle":return VY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return VY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class XY extends AY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(CD),this.setInnerRadiusField(wD)}setValueFieldToPercent(){this.setRadiusField(PD),this.setInnerRadiusField(ED)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class $Y extends AG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const qY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:BB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:RB,layoutRadius:e.layoutRadius}};class ZY extends YG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!DN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=qY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s;const n=[];return e.forEach(((e,r)=>{if(!DN(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=qY(e,t);e.center=c,e.startAngle=l,e.endAngle=h,e.outerRadius=d,e.type=a,e.layoutRadius=u;const p={spec:e,specPath:[this.specKey,r],specInfoPath:["component",this.specKey,r],type:o};i.push(p),"radius"===e.orient?n.push(p):s=r})),n.forEach((t=>{t.angleAxisIndex=s})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=EB,this._endAngle=PB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),aB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Qt(this._spec.startAngle),this._endAngle=Qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:LN(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){aB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return zw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:zw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this.computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ie(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>HN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,n=this.getLabelItems(s),r=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),a=Object.assign(Object.assign({},r),{title:{text:this._spec.title.text||this._dataFieldText},items:n,orient:"angle"});this._spec.grid.visible&&(a.grid=Object.assign({type:"line",smoothLink:!0,items:n[0]},r)),this._update(a)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=$t.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAngleAxis())||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(p(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutRadius(){const t=this.getRefLayoutRect();if(S(this._spec.layoutRadius))return this._spec.layoutRadius;if(d(this._spec.layoutRadius))return this._spec.layoutRadius(t,this.getCenter());const{width:e,height:i}=t;return"auto"===this._spec.layoutRadius&&e>0&&i>0?re(t,this.getCenter(),this._startAngle,this._endAngle):Math.min(e/2,i/2)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this.computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this.computeLayoutRadius()*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=RB,e=0;const i=this.getChart().getSpec();return aB(this.getRegions(),(s=>{const n=s;if(r=n.type,[cB.rose,cB.radar,cB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Bj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Bj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}ZY.type=r.polarAxis,ZY.specKey="axes";class JY extends ZY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new EC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}JY.type=r.polarLinearAxis,JY.specKey="axes",U(JY,QG);const QY=()=>{KG(),mz.registerComponent(JY.type,JY)};class tK extends ZY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new lC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}tK.type=r.polarBandAxis,tK.specKey="axes",U(tK,iW);const eK=()=>{KG(),mz.registerComponent(tK.type,tK)};class iK extends XY{constructor(){super(...arguments),this.type=cB.rose,this.transformerConstructor=$Y,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(iK.mark.rose,{morph:yG(this._spec,iK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XF(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}iK.type=cB.rose,iK.mark=oF,iK.transformerConstructor=$Y;const sK=()=>{mz.registerSeries(iK.type,iK),OY(),mz.registerAnimation("rose",((t,e)=>({appear:KY(t,e),enter:WY(t),exit:UY(t),disappear:YY(t)}))),eK(),QY()};class nK extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,JP(this._fromAngle,this._toAngle)&&JP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class rK extends Gc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=ne(s.angle),a=ne(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=ne(o.angle),c=ne(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new Xt(m,f,v,_);return y.defined=e.defined,y}}const aK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function oK(t,e,i){return"fadeIn"===e?aK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function lK(t,e,i){return"fadeIn"===e?aK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const hK=(t,e)=>({custom:Uc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class cK extends XY{constructor(){super(...arguments),this.type=cB.radar,this.transformerConstructor=FG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(cK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:EG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?Qt(this._spec.startAngle):EB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=mz.getAnimationInKey(e);t.setAnimationConfig(mG(null==i?void 0:i(n,r),fG(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}cK.type=cB.radar,cK.mark=nF,cK.transformerConstructor=FG,U(cK,PG);const dK=()=>{mz.registerSeries(cK.type,cK),aI(),yW(),LG(),DG(),mz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:oK(t,e,"in"),enter:oK(t,e,"in"),exit:oK(t,e,"out"),disappear:"clipIn"===e?void 0:oK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:rK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:lK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:lK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:nK,customParameters:t,duration:qH.update.duration,easing:qH.update.easing}]}))),mz.registerAnimation("radarGroup",((t,e)=>({appear:hK(t,"in"),disappear:hK(t,"out")}))),Jk(),eK(),QY()};class uK extends dV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>ci.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const pK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},gK={fill:"#bbb",fillOpacity:.2};class mK extends wG{constructor(){super(...arguments),this.type=cB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Vz(this._option.dataSet,"objFlat",pK),Vz(this._option.dataSet,"copyDataView",qz),Gz(this._option.dataSet,"dataview",pa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:tH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Bj(gK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(mK.mark.group),this._containerMark=this._createMark(mK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(mK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(mK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(mK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(mK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(mK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(mK.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new UF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:AD}}initTooltip(){this._tooltipHelper=new uK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}mK.type=cB.dot,mK.mark=uF;class fK extends dV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>ci.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const vK=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class _K extends wG{constructor(){super(...arguments),this.type=cB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Vz(this._option.dataSet,"linkDotInfo",vK),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:tH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(_K.mark.group),this._containerMark=this._createMark(_K.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(_K.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(_K.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:AD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new fK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}_K.type=cB.link,_K.mark=dF;class yK extends AY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?wD:DD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Qt(i.offsetAngle);let o;if(p(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Qt(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?Qt(n):EB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Qt(r):PB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[wD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XF(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(yK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+Qt(s),n=Qt(i)/2;return Zg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Eg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const SK=()=>{mz.registerAnimation("circularProgress",((t,e)=>({appear:xK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class AK extends AG{constructor(){super(...arguments),this._supportStack=!0}}class kK extends yK{constructor(){super(...arguments),this.type=cB.circularProgress,this.transformerConstructor=AK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(kK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(kK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?wD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}kK.type=cB.circularProgress,kK.mark=cF,kK.transformerConstructor=AK;function MK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const TK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:MK(t)}),wK={type:"fadeIn"};function CK(t,e){return!1===e?{}:"fadeIn"===e?wK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:MK(t)}))(t)}class EK extends dV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class PK extends wG{constructor(){super(...arguments),this.type=cB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(PK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return XF(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(PK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(PK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=XF(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Eg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=XF(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Eg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new EK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}PK.type=cB.linearProgress,PK.mark=fF;const BK=()=>{LW(),mz.registerAnimation("linearProgress",((t,e)=>({appear:CK(t,e),enter:{type:"grow"},disappear:TK(t)}))),tN(),mz.registerSeries(PK.type,PK)},RK=[0],LK=[20,40],OK=[200,500],IK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},DK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],FK=`${uB}_WORD_CLOUD_WEIGHT`,jK=`${uB}_WORD_CLOUD_TEXT`;class zK extends kG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=LK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:OK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:RK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?jK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:IK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:RK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!DK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(zK.mark.word,{key:SD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(mG(mz.getAnimationInKey("wordCloud")(n,s),fG("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new UF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:AD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new EC,o=this._fontWeightRange;if(r){const[e,i]=fb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:FK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:jK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:ib(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:SD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:FK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:SD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:FK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}zK.mark=pF;function HK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||qH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function VK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function GK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const WK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function UK(t){return d(t)?t:function(){return t}}class YK{constructor(t){var e,i,s;switch(this.options=z({},YK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,NK[s]?NK[s]():NK.circle()),this.getText=null!==(e=UK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=UK(this.options.fontWeight),this.getTextFontSize=UK(this.options.fontSize),this.getTextFontStyle=UK(this.options.fontStyle),this.getTextFontFamily=UK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>WK(10,50);break;case"random-light":this.getTextColor=()=>WK(50,90);break;default:this.getTextColor=UK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return Qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return Qt(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class XK extends YK{constructor(t){var e;super(z({},XK.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=XK.defaultOptions.minFontSize&&(this.options.minFontSize=XK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=KK[this.options.spiral])&&void 0!==e?e:KK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=UK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=GK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(L_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(JK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(ZK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}JK(p,this._size)&&(p=QK(p,this._size))}else if(JK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||qK(p,i))&&(!i||!$K(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function $K(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function qK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,JK=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function QK(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=GK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}eX.defaultOptions={enlarge:!1};const sX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},nX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?rX(t.fontFamily):"sans-serif",d=t.fontStyle?rX(t.fontStyle):"normal",u=t.fontWeight?rX(t.fontWeight):"normal",p=t.rotate?rX(t.rotate):0,g=rX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?rX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||sX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?rX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=oX(lX(t,l),C);w=i=>e(t(i))}let E=XK;"fast"===t.layoutType?E=eX:"grid"===t.layoutType&&(E=tX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},rX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],aX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),oX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=aX(t[0]),s=aX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(aX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},lX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function hX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{CR.registerTransform("wordcloud",{transform:nX,markPhase:"beforeJoin"},!0),cY(),mz.registerAnimation("wordCloud",((t,e)=>({appear:HK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),mz.registerSeries(cX.type,cX)};(class extends zK{constructor(){super(...arguments),this.type=cB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(zK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),fG("word",this._spec,this._markAttributeContext)))}}).type=cB.wordCloud3d;const uX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},pX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},gX=`${uB}_FUNNEL_TRANSFORM_RATIO`,mX=`${uB}_FUNNEL_REACH_RATIO`,fX=`${uB}_FUNNEL_HEIGHT_RATIO`,vX=`${uB}_FUNNEL_VALUE_RATIO`,_X=`${uB}_FUNNEL_LAST_VALUE_RATIO`,yX=`${uB}_FUNNEL_NEXT_VALUE_RATIO`,bX=`${uB}_FUNNEL_LAST_VALUE`,xX=`${uB}_FUNNEL_CURRENT_VALUE`,SX=`${uB}_FUNNEL_NEXT_VALUE`,AX=`${uB}_FUNNEL_TRANSFORM_LEVEL`,kX=20;class MX extends dV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[mX])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class TX extends UH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class wX extends TX{constructor(){super(...arguments),this.type=wX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}wX.type="polygon";const CX=()=>{mz.registerMark(wX.type,wX),bM(),gM(),CR.registerGraphic(IB.polygon,tm),fO.useRegisters([XI,$I])};class EX extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class PX extends kG{constructor(){super(...arguments),this.type=cB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=EX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Vz(this._dataSet,"funnel",uX),Vz(this._dataSet,"funnelTransform",pX);const t=new _a(this._dataSet,{name:`${uB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new aG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:xX,asTransformRatio:gX,asReachRatio:mX,asHeightRatio:fX,asValueRatio:vX,asNextValueRatio:yX,asLastValueRatio:_X,asLastValue:bX,asNextValue:SX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:AX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},PX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:yG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},PX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(PX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(PX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new MX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*hB(mX).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(mG(mz.getAnimationInKey("fadeInOut")(),fG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(mG(mz.getAnimationInKey("funnel")({},o),fG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(mG(null===(a=mz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fG("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[_X])/2:this._getSecondaryAxisLength(t[vX])/2,n=this._getSecondaryAxisLength(t[vX])/2):(s=this._getSecondaryAxisLength(t[vX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[yX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[AX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[SD]===t[SD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?kX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{CX(),cY(),zU(),mz.registerSeries(PX.type,PX),mz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},JH))),mz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Yc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),tN()};class RX extends TX{constructor(){super(...arguments),this.type=RX.type}}RX.type="pyramid3d";class LX extends EX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class OX extends PX{constructor(){super(...arguments),this.type=cB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=LX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},OX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},OX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(OX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(OX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}OX.type=cB.funnel3d,OX.mark=mF,OX.transformerConstructor=LX;const IX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},DX=t=>{const e=t.mark.elements.filter((t=>t.diffState===OB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},FX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},jX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=DX(i),a=FX(r,s,n);return IX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=DX(i),a=FX(r,s,n);return IX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),zX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},HX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=DX(i),a=zX(r);return IX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=DX(i),a=zX(r);return IX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),NX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},VX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):VX(t.children,e,i)))})),e};function GX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=YX(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,Tt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=Tt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},KX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=KX(t.children,e,t,n))})),s},XX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=XX(t.children,e,t,n)),n=e(t,s,i,n)})),n},$X={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:GX,slice:WX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?WX:GX)(t,e,i,s,n)}};class qX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},qX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?pb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?UX(this.options.aspectRatio):null!==(e=$X[this.options.splitType])&&void 0!==e?e:$X.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=YX(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}qX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const ZX=(t,e)=>{const i=new qX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return VX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},JX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class QX{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];GX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),JX);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},QX.defaultOpionts,t):Object.assign({},QX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?pb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+_b(this.options.center[0],t.width),s=t.y0+_b(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>_b(t,n))):_b(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>_b(t,n))):_b(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=_b(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=YX(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ie({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}QX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const t$=4294967296;function e$(t,e){let i,s;if(n$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function n$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function l$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function h$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function c$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function d$(t){return{_:t,next:null,prev:null}}function u$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];l$(n,s,r);let a,o,l,h,c,d,u,p=d$(s),g=d$(n),m=d$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=YX(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%t$)/t$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:f$.defaultOpionts.nodeSort;KX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)KX([o],p$(h)),XX([o],g$(this._getPadding,.5,a)),KX([o],m$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);KX([o],p$(f$.defaultOpionts.setRadius)),XX([o],g$(mb,1,a)),c&&XX([o],g$(this._getPadding,o.radius/t,a)),KX([o],m$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}f$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const v$=(t,e={})=>{if(!t)return[];const i=[];return VX(t,i,e),i},_$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new QX(i).layout(t,{width:s,height:n})};class y$ extends dV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var b$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(b$||(b$={}));const x$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===b$.DrillDown){return Y(lz(t,n,s,"children"))}if(i.type===b$.DrillUp){const e=hz(t,n,s,"children");if(e)return Y(e)}return t};class S${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=SU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Vz(t,"drillFilter",x$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:b$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:b$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:b$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:b$.DrillUp},model:this}),r}}class A$ extends AY{constructor(){super(...arguments),this.type=cB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:lG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._startAngle=Qt(this._spec.startAngle),this._endAngle=Qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"sunburstLayout",_$),Vz(this._dataSet,"flatten",v$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:oG,operations:["max","min","values"]},{key:lG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",eG),t.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(A$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(A$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new y$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}A$.type=cB.sunburst,A$.mark=AF,U(A$,S$);const k$=()=>{mz.registerSeries(A$.type,A$),OY(),cY(),tN(),mz.registerAnimation("sunburst",((t,e)=>({appear:NX(0,e),enter:jX(t),exit:HX(t),disappear:HX(t)})))},M$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new f$(i).layout(t,{width:s,height:n})};class T$ extends dV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const w$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class C$ extends wG{constructor(){super(...arguments),this.type=cB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:lG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:SD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Vz(this._dataSet,"circlePackingLayout",M$),Vz(this._dataSet,"flatten",v$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Vz(t.dataSet,"addVChartProperty",eG),t.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(C$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(C$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},nH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:oG,operations:["max","min","values"]},{key:lG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new T$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}C$.type=cB.circlePacking,C$.mark=TF,U(C$,S$);const E$=()=>{mz.registerSeries(C$.type,C$),OY(),cY(),QH(),mz.registerAnimation("circlePacking",((t,e)=>({appear:w$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},P$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=P$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function B$(t){return t.depth}function R$(t,e){return e-1-t.endDepth}const L$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),O$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},I$={left:B$,right:R$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:B$,end:R$},D$=_t(0,1);class F${constructor(t){this._ascendingSourceBreadth=(t,e)=>L$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>L$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},F$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?pb(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Ab(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Ab(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];P$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[O$(s[t.source]),O$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=ft(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*D$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(L$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(L$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new F$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},z$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&z$(t,e.children,i)}))},H$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},N$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new F$(e),r=[];return r.push(n.layout(s,i)),r},V$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},G$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class W$ extends dV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const U$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),Y$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:U$(t),K$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class X$ extends UH{constructor(){super(...arguments),this.type=X$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}X$.type="linkPath";const $$=()=>{CR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(IO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),CR.registerAnimationType("linkPathGrowIn",DO),CR.registerAnimationType("linkPathGrowOut",FO),CR.registerAnimationType("linkPathUpdate",jO),SO(),vO(),mz.registerMark(X$.type,X$)};class q$ extends wG{constructor(){super(...arguments),this.type=cB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Zt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(nH.STATE_SANKEY_EMPHASIS),e.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS)):(t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(nH.STATE_SANKEY_EMPHASIS),void s.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(nH.STATE_SANKEY_EMPHASIS),s.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[nH.STATE_SANKEY_EMPHASIS,nH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(nH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(nH.STATE_SANKEY_EMPHASIS),void t.addState(nH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(nH.STATE_SANKEY_EMPHASIS),t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Vz(this._dataSet,"sankeyLayout",N$),Vz(this._dataSet,"sankeyFormat",H$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:tH.sankeyLayout});const{dataSet:a}=this._option;Vz(a,"sankeyNodes",V$),Vz(a,"flatten",v$);const o=new _a(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:cG.bind(this),call:dG}},!1),this._nodesSeriesData=new aG(this._option,o),Vz(a,"sankeyLinks",G$);const l=new _a(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:cG.bind(this),call:dG}},!1),this._linksSeriesData=new aG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(q$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(q$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(q$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},nH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},nH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),fG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),fG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(mG(null===(n=mz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fG("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([nH.STATE_SANKEY_EMPHASIS_REVERSE,nH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(nH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new W$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new UF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return z$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}q$.type=cB.sankey,q$.mark=bF;const Z$=()=>{CR.registerTransform("sankey",{transform:j$,markPhase:"beforeJoin"},!0),LW(),$$(),cY(),mz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:Y$(t,e)},JH))),mz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:K$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),tN(),mz.registerSeries(q$.type,q$)},J$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=v$(n);return i=sG([{latestData:r}],e),i};class Q$ extends dV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const tq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class eq extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class iq extends wG{constructor(){super(...arguments),this.type=cB.treemap,this.transformerConstructor=eq,this._viewBox=new Zt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:lG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ae),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:SD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[lG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Vz(this._rawData.dataSet,"addVChartProperty",eG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uG.bind(this),call:pG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Vz(this._dataSet,"hierarchyDimensionStatistics",J$),Vz(this._dataSet,"flatten",v$);const i=new _a(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:oG,operations:["max","min","values"]},{key:lG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(iq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(iq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},nH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},nH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new Q$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}iq.type=cB.treemap,iq.mark=yF,iq.transformerConstructor=eq,U(iq,S$),U(iq,kU);const sq=()=>{LW(),cY(),mz.registerAnimation("treemap",((t,e)=>({appear:tq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),tN(),CR.registerTransform("treemap",{transform:ZX,markPhase:"beforeJoin"},!0),mz.registerSeries(iq.type,iq)},nq={type:"fadeIn"};function rq(t,e){return"fadeIn"===e?nq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class aq extends AG{constructor(){super(...arguments),this._supportStack=!1}}class oq extends yK{constructor(){super(...arguments),this.type=cB.gaugePointer,this.transformerConstructor=aq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(oq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},oq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(oq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=ft(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}oq.type=cB.gaugePointer,oq.mark=SF,oq.transformerConstructor=aq;const lq=()=>{mz.registerSeries(oq.type,oq),_U(),LW(),mz.registerAnimation("gaugePointer",((t,e)=>{const i=rq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),eK(),QY()};class hq extends AG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class cq extends yK{constructor(){super(...arguments),this.type=cB.gauge,this.transformerConstructor=hq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Vz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[FD]=t[this._angleField[0]],t[DD]=e>0?i[e-1][FD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(cq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(cq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return p(t[DD])?this.angleAxisHelper.dataToPosition([t[DD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[FD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}cq.type=cB.gauge,cq.mark=xF,cq.transformerConstructor=hq;class dq extends OG{constructor(){super(...arguments),this.type=dq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}dq.type="cell";const uq=()=>{mz.registerMark(dq.type,dq),bM(),SM(),CR.registerGraphic(IB.cell,Ag),CR.registerMark(IB.cell,dD)};function pq(t){return!1===t?{}:{type:"fadeIn"}}class gq extends dV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class mq extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class fq extends wG{constructor(){super(...arguments),this.type=cB.heatmap,this.transformerConstructor=mq}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(fq.mark.cell,{morph:yG(this._spec,fq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(fq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ti(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=TG(this);this._cellMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fG("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new gq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}fq.type=cB.heatmap,fq.mark=wF,fq.transformerConstructor=mq;const vq=()=>{cY(),uq(),mz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},JH),{appear:pq(e)}))),nW(),eW(),mz.registerSeries(fq.type,fq)},_q=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=Qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=Qt(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=_b(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=_b(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+_b(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+_b(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=pb(e.field),C=t.map(w),[E,P]=fb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:pb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?fb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=yq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),bq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},bq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[xD]:null==n?void 0:n[xD],[AD]:null==n?void 0:n[AD]}};class Sq extends UH{constructor(){super(...arguments),this.type=Sq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Sq.type="ripple";const Aq=()=>{mz.registerMark(Sq.type,Sq),CR.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),SO(),bO()},kq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class Mq extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Tq extends AY{constructor(){super(...arguments),this.type=cB.correlation,this.transformerConstructor=Mq,this._viewBox=new Zt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Vz(this._dataSet,"correlation",_q);const s=new fa;Gz(s,"dataview",pa),Vz(s,"correlationCenter",xq);const n=new _a(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new aG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(Tq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:xD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(Tq.mark.ripplePoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Tq.mark.centerPoint,{key:xD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[vD],y:t=>t[_D],size:t=>t[yD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},nH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},nH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fG("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Tq.type=cB.correlation,Tq.mark=CF,Tq.transformerConstructor=Mq;const wq=()=>{DG(),Aq(),mz.registerSeries(Tq.type,Tq),mz.registerAnimation("correlation",((t,e)=>Object.assign({appear:kq(0,e)},ZH)))};class Cq extends UH{constructor(){super(...arguments),this.type=Cq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Cq.type="liquid";const Eq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Pq extends dV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Bq extends kG{constructor(){super(...arguments),this.type=cB.liquid,this.transformerConstructor=FG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Ag({x:s,y:n,size:r,symbolType:Eq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=tj(this._spec.outlineMargin),this._paddingSpec=tj(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=It(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Bq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Bq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Bq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Bq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Pq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(mG(null===(i=mz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fG("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(mG(null===(s=mz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fG("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Bq.type=cB.liquid,Bq.mark=PF,Bq.transformerConstructor=FG;const Rq=t=>Y(t).join(",");class Lq extends dV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Rq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Rq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Oq extends AG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Iq extends kG{constructor(){super(...arguments),this.type=cB.venn,this.transformerConstructor=Oq,this._viewBox=new Zt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:SD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(Iq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Iq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},nH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},nH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},nH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Rq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},nH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Rq(t.sets)},nH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Lq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Rq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Rq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Rq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Rq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(mG(null===(e=mz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fG(t.name,this._spec,this._markAttributeContext)))}))}}Iq.type=cB.venn,Iq.mark=BF,Iq.transformerConstructor=Oq;class Dq extends gW{_isValidSeries(t){return t===cB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class Fq extends uW{constructor(){super(...arguments),this.transformerConstructor=Dq,this.type="map",this.seriesType=cB.map}}Fq.type="map",Fq.seriesType=cB.map,Fq.transformerConstructor=Dq;class jq extends gW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class zq extends jq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=ON(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Bj({},s,l)),n&&Object.assign(o,Bj({},n,o))}}class Hq extends jq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Nq extends jq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class Vq extends uW{constructor(){super(...arguments),this.transformerConstructor=Nq}}Vq.transformerConstructor=Nq;class Gq extends Vq{constructor(){super(...arguments),this.transformerConstructor=Nq,this.type="pie",this.seriesType=cB.pie}}Gq.type="pie",Gq.seriesType=cB.pie,Gq.transformerConstructor=Nq;class Wq extends Nq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Uq extends Vq{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="pie3d",this.seriesType=cB.pie3d}}Uq.type="pie3d",Uq.seriesType=cB.pie3d,Uq.transformerConstructor=Wq;class Yq extends Hq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:RB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:RB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Kq extends uW{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="rose",this.seriesType=cB.rose,this._canStack=!0}}Kq.type="rose",Kq.seriesType=cB.rose,Kq.transformerConstructor=Yq;class Xq extends Hq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Bj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Bj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class $q extends uW{constructor(){super(...arguments),this.transformerConstructor=Xq,this.type="radar",this.seriesType=cB.radar,this._canStack=!0}}$q.type="radar",$q.seriesType=cB.radar,$q.transformerConstructor=Xq;class qq extends gW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Bj(e,uH(this.type,t))})),this._transformAxisSpec(t)}}class Zq extends uW{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="common",this._canStack=!0}}Zq.type="common",Zq.transformerConstructor=qq;class Jq extends mW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class Qq extends uW{constructor(){super(...arguments),this.transformerConstructor=Jq,this._canStack=!0}}Qq.transformerConstructor=Jq;class tZ extends Jq{transformSpec(t){super.transformSpec(t),hH(t)}}class eZ extends Qq{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="histogram",this.seriesType=cB.bar}}eZ.type="histogram",eZ.seriesType=cB.bar,eZ.transformerConstructor=tZ;class iZ extends Qq{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="histogram3d",this.seriesType=cB.bar3d}}iZ.type="histogram3d",iZ.seriesType=cB.bar3d,iZ.transformerConstructor=tZ;class sZ extends zq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class nZ extends uW{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="circularProgress",this.seriesType=cB.circularProgress,this._canStack=!0}}nZ.type="circularProgress",nZ.seriesType=cB.circularProgress,nZ.transformerConstructor=sZ;class rZ extends zq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:cB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===cB.gauge||t.type===cB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===cB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class aZ extends uW{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="gauge",this.seriesType=cB.gaugePointer}}aZ.type="gauge",aZ.seriesType=cB.gaugePointer,aZ.transformerConstructor=rZ;class oZ extends gW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class lZ extends uW{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}lZ.transformerConstructor=oZ;class hZ extends oZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class cZ extends lZ{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="wordCloud",this.seriesType=cB.wordCloud}}cZ.type="wordCloud",cZ.seriesType=cB.wordCloud,cZ.transformerConstructor=hZ;class dZ extends oZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class uZ extends lZ{constructor(){super(...arguments),this.transformerConstructor=dZ,this.type="wordCloud3d",this.seriesType=cB.wordCloud3d}}uZ.type="wordCloud3d",uZ.seriesType=cB.wordCloud3d,uZ.transformerConstructor=dZ;class pZ extends gW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class gZ extends uW{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="funnel",this.seriesType=cB.funnel}}gZ.type="funnel",gZ.seriesType=cB.funnel,gZ.transformerConstructor=pZ;class mZ extends uW{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="funnel3d",this.seriesType=cB.funnel3d}}mZ.type="funnel3d",mZ.seriesType=cB.funnel3d,mZ.transformerConstructor=pZ;class fZ extends mW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=ON(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=ON(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class vZ extends uW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="linearProgress",this.seriesType=cB.linearProgress,this._canStack=!0}}vZ.type="linearProgress",vZ.seriesType=cB.linearProgress,vZ.transformerConstructor=fZ;class _Z extends mW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),hH(t)}}class yZ extends uW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="rangeColumn",this.seriesType=cB.rangeColumn}}yZ.type="rangeColumn",yZ.seriesType=cB.rangeColumn,yZ.transformerConstructor=_Z;class bZ extends mW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class xZ extends uW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="rangeColumn3d",this.seriesType=cB.rangeColumn3d}}xZ.type="rangeColumn3d",xZ.seriesType=cB.rangeColumn3d,xZ.transformerConstructor=bZ;class SZ extends gW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:BB,i=p(t.endAngle)?t.endAngle:e+te(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=cB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class AZ extends uW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="sunburst",this.seriesType=cB.sunburst}}AZ.type="sunburst",AZ.seriesType=cB.sunburst,AZ.transformerConstructor=SZ;class kZ extends gW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=cB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class MZ extends uW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="circlePacking",this.seriesType=cB.circlePacking}}MZ.type="circlePacking",MZ.seriesType=cB.circlePacking,MZ.transformerConstructor=kZ;class TZ extends gW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wZ extends uW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="treemap",this.seriesType=cB.treemap}}wZ.type="treemap",wZ.seriesType=cB.treemap,wZ.transformerConstructor=TZ;class CZ extends zW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),hH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class EZ extends HW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="waterfall",this.seriesType=cB.waterfall}}EZ.type="waterfall",EZ.seriesType=cB.waterfall,EZ.transformerConstructor=CZ;class PZ extends mW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),hH(t)}}class BZ extends uW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="boxPlot",this.seriesType=cB.boxPlot}}BZ.type="boxPlot",BZ.seriesType=cB.boxPlot,BZ.transformerConstructor=PZ;class RZ extends gW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class LZ extends uW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="sankey",this.seriesType=cB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}LZ.type="sankey",LZ.seriesType=cB.sankey,LZ.transformerConstructor=RZ;class OZ extends mW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),hH(t)}}class IZ extends uW{constructor(){super(...arguments),this.transformerConstructor=OZ,this.type="rangeArea",this.seriesType=cB.rangeArea}}IZ.type="rangeArea",IZ.seriesType=cB.rangeArea,IZ.transformerConstructor=OZ;class DZ extends mW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class FZ extends uW{constructor(){super(...arguments),this.transformerConstructor=DZ,this.type="heatmap",this.seriesType=cB.heatmap}}FZ.type="heatmap",FZ.seriesType=cB.heatmap,FZ.transformerConstructor=DZ;class jZ extends gW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=cB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class zZ extends uW{constructor(){super(...arguments),this.transformerConstructor=jZ,this.type="correlation",this.seriesType=cB.correlation}}zZ.type="correlation",zZ.seriesType=cB.correlation,zZ.transformerConstructor=jZ;function HZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=gz(t.style)),B(t.textStyle)||Bj(s.textStyle,gz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&gz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&gz(s.background.style),s}const NZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},VZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:AD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class GZ extends VG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=qF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new VH(this._option,e),this._initSelectedData(),aB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(aB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Bj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Bj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}GZ.specKey="legends";class WZ extends GZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Vz(this._option.dataSet,"discreteLegendFilter",VZ),Vz(this._option.dataSet,"discreteLegendDataMake",NZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return aB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!lb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=ez(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=HZ(s)),B(n.focusIconStyle)||gz(n.focusIconStyle),n.shape&&(n.shape=dz(n.shape)),n.label&&(n.label=dz(n.label)),n.value&&(n.value=dz(n.value)),n.background&&(n.background=dz(n.background)),ZF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),ZF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),ZF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||gz(r.railStyle),B(r.sliderStyle)||gz(r.sliderStyle)):(B(r.textStyle)||gz(r.textStyle),r.handler&&dz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Bj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return mP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(lP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(lP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(lP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=BN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=BN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}WZ.specKey="legends",WZ.type=r.discreteLegend;const UZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},YZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?cz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function KZ(t){return"color"===t||"size"===t}const XZ={color:bP,size:SP},$Z=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],qZ=[2,10];class ZZ extends GZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return KZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{KZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),aB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:tH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Vz(this._option.dataSet,"continuousLegendFilter",YZ),Vz(this._option.dataSet,"continuousLegendDataMake",UZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>oB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=ez(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!lb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=ez(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?$Z:qZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Bj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=HZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=gz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=gz(r.style)),B(a.style)||(w.trackStyle=gz(a.style)),w.startText=dz(o),w.endText=dz(l),w.handlerText=dz(h),B(c)||(w.sizeBackground=gz(c)),d.visible&&!B(d.style)&&(Bj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return XZ[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}ZZ.specKey="legends",ZZ.type=r.continuousLegend;class JZ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Rz(n,a,!0))&&void 0!==e?e:[],...null!==(i=bz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Nw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=lV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=lV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(vV(s).every((t=>{var e;return!lV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=lV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=mV(t,i,s),m=fV(t,i,s),f=Bj({},I(e[t]),m),v=g.title,_=yV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=pV(f.title,Object.assign(Object.assign({},v),_)):f.title=pV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=_V(y);f.content=gV(f.content,(e=>yV(e,f,u.shape,t)))}else f.content=gV(y,(t=>yV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=TV(a,t,e),l=!!p(o)&&!1!==xV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class QZ extends JZ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class tJ extends JZ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class eJ extends JZ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const iJ=t=>p(t)&&!y(t),sJ=t=>p(t)&&y(t);class nJ extends NG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Bj({},this._theme,s.style),s.offset=Bj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=lV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:nb(this._option.mode)||!ib(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=L_.getElementById(t.parentElement)):ib(this._option.mode)&&(t.parentElement=null==eb?void 0:eb.body)}}class rJ extends VG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=nJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=ib(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&iJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&sJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&lN.globalConfig.uniqueTooltip&&l&&lN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?SV.canvas:SV.dom,n=mz.getComponentPluginInType(t);n||Jy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new tJ(this),dimension:new QZ(this),group:new eJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(sb(i)||nb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=aV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(sJ(t)){if(iJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>fz(t,e[i])))))return!1}else{if(sJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&ii(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}rJ.type=r.tooltip,rJ.transformerConstructor=nJ,rJ.specKey="tooltip";var aJ,oJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(aJ||(aJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(oJ||(oJ={}));const lJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class hJ extends VG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:sb(e)||nb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{lJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){xz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Sz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=lB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=GN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=YN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=KN(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),NN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}cJ.specKey="crosshair",cJ.type=r.cartesianCrosshair;class dJ extends hJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Nw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:$t.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=lB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Bj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=LN(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=LN(s.getSpec())),c.angle=a.angle,c.axis=s,Bj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=BN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=BN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:ie(o,s,i),end:ie(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ne(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},ie(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=se(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=ie(t,r,p),f=ie(t,r,g),v=Be([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=ft($t.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ne(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},ie(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),NN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}dJ.specKey="crosshair",dJ.type=r.polarCrosshair;const uJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},pJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class gJ extends VG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else aB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),aB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=ft(this._start+g,0,1),v=ft(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Rt(s/n)>=.5:Rt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=kz(t),this._isHorizontal="horizontal"===Mz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(zw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};aB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=zw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else aB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Gz(s,"dataview",pa),Vz(s,"dataFilterComputeDomain",pJ);const n=new _a(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new VH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(zw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&zw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,zw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new lC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Vz(this._option.dataSet,"dataFilterWithNewDomain",uJ),aB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>zw(this._stateScale.type)},level:tH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Nw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Nw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(gJ,kU);class mJ extends NG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Bj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class fJ extends gJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=mJ,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new EC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!zw(t.type)||e[0]!==e[1])&&(!Nw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new lE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:gz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:gz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:gz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:gz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:gz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:gz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:gz(g.style)},selectedBackgroundStyle:gz(this._spec.selectedBackground.style),dragMaskStyle:gz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Bj(gz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Bj(gz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},gz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=BN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}fJ.type=r.dataZoom,fJ.transformerConstructor=mJ,fJ.specKey="dataZoom";class vJ extends gJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=JP(this._start,e)&&JP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=gz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=gz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}vJ.type=r.scrollBar,vJ.specKey="scrollBar";const _J=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class yJ extends VG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==yJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Vz(this._option.dataSet,"indicatorFilter",_J);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new VH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Bj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},pz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?ij(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ij(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},pz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new MP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}yJ.type=r.indicator,yJ.specKey="indicator";const bJ=["sum","average","min","max","variance","standardDeviation","median"];function xJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function SJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&xJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=ZF(t.x)?TJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function AJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&xJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=ZF(t.y)?TJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function kJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&xJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function MJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&xJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function TJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function wJ(t){return bJ.includes(t)}function CJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=SJ(t,m,n,d,h,a),i=AJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=SJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=AJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function EJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=kJ(t,l,n,r),i=MJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=kJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=MJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function PJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=ZF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=ZF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&xJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&xJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function BJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&xJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&xJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function RJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=TJ(e,r)),e+=s,ZF(i)&&(i=TJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return ZF(e)&&(e=TJ(e,s)),ZF(i)&&(i=TJ(i,n)),{x:e,y:i}}))}function LJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function OJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},gz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},DJ(gz(s.style),i)),p(s.padding)&&(t.padding=ti(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=DJ(gz(n),i)),t}return{visible:!1}}function IJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function DJ(t,e){return d(t)?t(e):t}function FJ(t,e){return d(t)?t(e):t}function jJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function zJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function HJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function NJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function VJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>WJ(i,t,e))):s.x=WJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>WJ(i,t,e))):s.y=WJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>WJ(i,t,e))):s.angle=WJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>WJ(i,t,e))):s.radius=WJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=WJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const GJ={min:(t,e)=>QP(t[0].latestData,e.field),max:(t,e)=>tB(t[0].latestData,e.field),sum:function(t,e){return eB(t[0].latestData,e.field)},average:function(t,e){return iB(t[0].latestData,e.field)},variance:function(t,e){return sB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(sB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function WJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return GJ[i](e,{field:s})}return t}class UJ extends VG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&wJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&wJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&wJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&wJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&wJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new fa;return e.registerParser("array",s),new _a(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=lB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=JF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=JF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function YJ(t,e){return function(t,e,i){const{predict:s}=xb(t,(t=>t[e]),(t=>t[i])),n=QP(t,e),r=tB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function KJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class XJ extends UJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=zJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:DJ(gz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:OJ(y,this._markerData),state:{line:IJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:IJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:IJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:IJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:IJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:gz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:gz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=LJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=zJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Vz(this._option.dataSet,"markerAggregation",VJ),Vz(this._option.dataSet,"markerRegression",YJ),Vz(this._option.dataSet,"markerFilter",KJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new _a(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}XJ.specKey="markLine";class $J extends XJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=zJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=CJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=PJ(i,r,d,e.coordinatesOffset):c&&(y=RJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(ZF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=zJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}$J.type=r.markLine,$J.coordinateType="cartesian";class qJ extends XJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=zJ(this._spec);return e||i?new ZE(t):new XE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=zJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=EJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>ie(m,t.radius,t.angle)))}}else u&&(p=BJ(i,r,a),g={points:p.map((t=>ie(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=zJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}qJ.type=r.polarMarkLine,qJ.coordinateType="polar";class ZJ extends VG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=qF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new AP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}ZJ.type=r.title,ZJ.specKey=r.title;class JJ extends UJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=HJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:DJ(gz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:OJ(u,this._markerData),state:{area:IJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:IJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:IJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=LJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=HJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Vz(this._option.dataSet,"markerAggregation",VJ),Vz(this._option.dataSet,"markerFilter",KJ);const c=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}JJ.specKey="markArea";class QJ extends JJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=HJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=CJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=CJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=PJ(i,r,d,e.coordinatesOffset):c&&(u=RJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=HJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}QJ.type=r.markArea,QJ.coordinateType="cartesian";class tQ extends JJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=HJ(this._spec);return i||e||s?new JE(t):new qE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=HJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=EJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=BJ(i,r,c),u={points:d.map((t=>ie(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=HJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}tQ.type=r.polarMarkArea,tQ.coordinateType="polar";const eQ=t=>gz(Object.assign({},t)),iQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},gz(t.style))}),sQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=eQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=eQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},gz(Object.assign({},y)));var y;const b=iQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=iQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=iQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=iQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},nQ=t=>"left"===t||"right"===t,rQ=t=>"top"===t||"bottom"===t;class aQ extends VG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},sQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},sQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new zP(t):this._playerComponent=new VP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=nQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=nQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(LP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(LP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=nQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=rQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):nQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):rQ(this._orient)?this._maxSize():t.height}_computeDx(t){return nQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return rQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}aQ.specKey="player",aQ.type=r.player;class oQ extends VG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}oQ.type=r.label;class lQ extends hY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}lQ.type="text",lQ.constructorType="label";const hQ=()=>{mz.registerMark(lQ.constructorType,lQ),xO()};class cQ extends NG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class dQ extends oQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=cQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),aB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Bj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=WU[t])&&void 0!==i?i:WU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:UU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}dQ.type=r.label,dQ.specKey="label",dQ.transformerConstructor=cQ;class uQ extends oQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[LD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Bj({textStyle:{pickable:!0===this._spec.interactive},position:pQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[ID]))},a))}})).encode((e=>UU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function pQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}uQ.type=r.totalLabel,uQ.specKey="totalLabel";class gQ extends UJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=NJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:FJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:FJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:DJ(B.style,this._markerData)},state:{line:IJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:IJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:IJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:IJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:IJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:IJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:IJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:IJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:IJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:IJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=gz(DJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=DJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=OJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=DJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:gz(z.style)}):{visible:!1};return new tP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=LJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:jJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:jJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=NJ(t);if(!(p(t.coordinate)||e||i||s))return;Vz(this._option.dataSet,"markerAggregation",VJ),Vz(this._option.dataSet,"markerFilter",KJ);const{options:n}=this._computeOptions(),r=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}gQ.specKey="markPoint";class mQ extends gQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=CJ(i,s,s,s,o)[0][0]:r?l=PJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=RJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=NJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}mQ.type=r.markPoint,mQ.coordinateType="cartesian";class fQ extends gQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=EJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ie({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}fQ.type=r.polarMarkPoint,fQ.coordinateType="polar";class vQ extends gQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}vQ.type=r.geoMarkPoint,vQ.coordinateType="geo";const _Q="inBrush",yQ="outOfBrush";class bQ extends VG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),_Q,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),yQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new YP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:gz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(HP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(HP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,yQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(HP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(HP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(HP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},gz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(_Q),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(_Q),i.addState(yQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(_Q),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(_Q),i.addState(yQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],qe(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],qe(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(_Q),i.removeState(yQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}bQ.type=r.brush,bQ.specKey="brush";class xQ extends VG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${uB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=mG({},fG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Zt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Zt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}xQ.type=r.customMark,xQ.specKey="customMark";function SQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function AQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function kQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:AQ(t.rect),anchorCandidates:PQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>SQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tSQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function MQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=We(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=CQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=hi(r,s,i);if(!CQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],TQ(wQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=TQ(wQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=EQ(t.rect,a,0),t}));return kQ(h)}function TQ(t){return t>180?t-360:t}function wQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function CQ(t,e){for(let i=0;i{const{x:r,y:a}=EQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class BQ extends VG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new _a(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:tH.copyDataView},!1),this._data=new VH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new tP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=tj(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=wu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Eg(gz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Ag(gz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=_p(gz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=_p(gz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=EQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:gz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):kQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}BQ.type=r.mapLabel,BQ.specKey="mapLabel";class RQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>LQ(t))),a=n.filter((t=>!LQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>LQ(t))),h=o.filter((t=>!LQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function LQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}RQ.type="grid";lN.useRegisters([()=>{rI(),aI(),LG(),DG(),iN(),QH(),nW(),eW(),mz.registerSeries(lW.type,lW),mz.registerChart(vW.type,vW)},()=>{rI(),aI(),LG(),yW(),DG(),xW(),nW(),eW(),mz.registerSeries(AW.type,AW),mz.registerChart(MW.type,MW)},()=>{jW(),mz.registerChart(HW.type,HW)},()=>{QW(),mz.registerChart(eU.type,eU)},()=>{jY(),mz.registerChart(Gq.type,Gq)},()=>{sK(),mz.registerChart(Kq.type,Kq)},()=>{dK(),mz.registerChart($q.type,$q)},()=>{jW(),mz.registerChart(eZ.type,eZ)},()=>{PU(),mz.registerChart(Fq.type,Fq)},()=>{lq(),mz.registerSeries(cq.type,cq),OY(),SK(),QY(),mz.registerChart(aZ.type,aZ)},()=>{dX(),mz.registerChart(cZ.type,cZ)},()=>{BX(),mz.registerChart(gZ.type,gZ)},()=>{eY(),mz.registerChart(EZ.type,EZ)},()=>{oY(),DG(),QH(),nW(),eW(),mz.registerSeries(lY.type,lY),mz.registerChart(BZ.type,BZ)},()=>{mz.registerSeries(kK.type,kK),OY(),SK(),tN(),eK(),QY(),mz.registerChart(nZ.type,nZ)},()=>{BK(),mz.registerChart(vZ.type,vZ)},()=>{yY(),mz.registerChart(yZ.type,yZ)},()=>{yW(),nW(),eW(),mz.registerSeries(SY.type,SY),mz.registerChart(IZ.type,IZ)},()=>{k$(),mz.registerChart(AZ.type,AZ)},()=>{E$(),mz.registerChart(MZ.type,MZ)},()=>{sq(),mz.registerChart(wZ.type,wZ)},()=>{Z$(),mz.registerChart(LZ.type,LZ)},()=>{vq(),mz.registerChart(FZ.type,FZ)},()=>{wq(),mz.registerChart(zZ.type,zZ)},()=>{mz.registerChart(Zq.type,Zq)},eW,nW,()=>{KG(),mz.registerComponent(rW.type,rW)},()=>{KG(),mz.registerComponent(aW.type,aW)},()=>{KG(),mz.registerComponent(oW.type,oW)},eK,QY,()=>{mz.registerComponent(WZ.type,WZ)},()=>{mz.registerComponent(ZZ.type,ZZ)},()=>{mz.registerComponent(rJ.type,rJ)},()=>{mz.registerComponent(cJ.type,cJ)},()=>{mz.registerComponent(dJ.type,dJ)},()=>{mz.registerComponent(fJ.type,fJ)},()=>{mz.registerComponent(vJ.type,vJ)},()=>{mz.registerComponent(yJ.type,yJ)},wU,()=>{mz.registerComponent($J.type,$J),KE()},()=>{mz.registerComponent(QJ.type,QJ),$E()},()=>{mz.registerComponent(mQ.type,mQ),QE()},()=>{mz.registerComponent(qJ.type,qJ),ZE._animate=EE,KE()},()=>{mz.registerComponent(tQ.type,tQ),JE._animate=BE,$E()},()=>{mz.registerComponent(fQ.type,fQ),QE()},()=>{mz.registerComponent(vQ.type,vQ),QE()},()=>{mz.registerComponent(ZJ.type,ZJ)},()=>{mz.registerComponent(aQ.type,aQ)},()=>{GO(),hQ(),WG(),mz.registerComponent(dQ.type,dQ,!0)},()=>{GO(),hQ(),WG(),mz.registerComponent(uQ.type,uQ,!0)},()=>{mz.registerComponent(bQ.type,bQ)},()=>{mz.registerComponent(xQ.type,xQ)},()=>{mz.registerComponent(BQ.type,BQ)},()=>{Ql.load(pT)},()=>{mz.registerLayout(RQ.type,RQ)},tG,$R,XR]),lN.useRegisters([()=>{PA(Ql)}]),t.ARC_END_ANGLE=kB,t.ARC_K=MB,t.ARC_MIDDLE_ANGLE=TB,t.ARC_QUADRANT=wB,t.ARC_RADIAN=CB,t.ARC_RATIO=SB,t.ARC_START_ANGLE=AB,t.ARC_TRANSFORM_VALUE=xB,t.AxisSyncPlugin=MN,t.BASE_EVENTS=uD,t.CORRELATION_SIZE=yD,t.CORRELATION_X=vD,t.CORRELATION_Y=_D,t.CanvasTooltipHandler=QV,t.DEFAULT_CHART_HEIGHT=gB,t.DEFAULT_CHART_WIDTH=pB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=GD,t.DEFAULT_DATA_INDEX=xD,t.DEFAULT_DATA_KEY=SD,t.DEFAULT_DATA_SERIES_FIELD=AD,t.DEFAULT_GRADIENT_CONFIG=WD,t.DEFAULT_LABEL_ALIGN=fB,t.DEFAULT_LABEL_LIMIT=mB,t.DEFAULT_LABEL_TEXT=vB,t.DEFAULT_LABEL_VISIBLE=_B,t.DEFAULT_LABEL_X=yB,t.DEFAULT_LABEL_Y=bB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=ND,t.DEFAULT_MEASURE_CANVAS_ID=bD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=VD,t.DEFAULT_SERIES_STYLE_NAME=kD,t.DomTooltipHandler=JV,t.Factory=mz,t.FormatterPlugin=vN,t.GradientType=HD,t.MediaQuery=pN,t.POLAR_DEFAULT_RADIUS=RB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=PB,t.POLAR_START_ANGLE=BB,t.POLAR_START_RADIAN=EB,t.PREFIX=uB,t.SEGMENT_FIELD_END=FD,t.SEGMENT_FIELD_START=DD,t.STACK_FIELD_END=CD,t.STACK_FIELD_END_OffsetSilhouette=RD,t.STACK_FIELD_END_PERCENT=PD,t.STACK_FIELD_KEY=TD,t.STACK_FIELD_START=wD,t.STACK_FIELD_START_OffsetSilhouette=BD,t.STACK_FIELD_START_PERCENT=ED,t.STACK_FIELD_TOTAL=LD,t.STACK_FIELD_TOTAL_PERCENT=OD,t.STACK_FIELD_TOTAL_TOP=ID,t.ThemeManager=$j,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=lN,t.WaterfallDefaultSeriesField=fD,t.builtinThemes=jj,t.computeActualDataScheme=jF,t.darkTheme=kj,t.dataScheme=sj,t.default=lN,t.defaultThemeName=zj,t.getActualColor=HF,t.getColorSchemeBySeries=WF,t.getDataScheme=FF,t.getMergedTheme=Kj,t.getTheme=Wj,t.hasThemeMerged=Vj,t.isColorKey=NF,t.isProgressiveDataColorScheme=VF,t.isTokenKey=xj,t.lightTheme=Aj,t.queryColorFromColorScheme=zF,t.queryToken=bj,t.registerCanvasTooltipHandler=tG,t.registerChartPlugin=uN,t.registerDomTooltipHandler=()=>{ZV(JV)},t.registerFormatPlugin=()=>{uN(vN)},t.registerMediaQuery=()=>{uN(pN)},t.registerTheme=Gj,t.removeTheme=Uj,t.themeExist=Yj,t.themes=Hj,t.token=Sj,t.transformColorSchemeToStandardStruct=GF,t.version="1.11.11",t.vglobal=L_,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function et(t){return Number(t)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&S(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):st(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Warn&&st(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Info&&st(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Debug&&st(this._method||"log","DEBUG",e),this}}function at(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;tt(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(tt)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ct,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:dt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ft=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}yt=!1;const kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mt=new RegExp(kt.source,"g");function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const wt=1e-12,Ct=Math.PI,Et=Ct/2,Pt=2*Ct,Bt=2*Math.PI,Rt=Math.abs,Lt=Math.atan2,Ot=Math.cos,It=Math.max,Dt=Math.min,Ft=Math.sin,jt=Math.sqrt,zt=Math.pow;function Ht(t){return t>1?0:t<-1?Ct:Math.acos(t)}function Nt(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function Kt(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class $t{static distancePP(t,e){return jt(zt(t.x-e.x,2)+zt(t.y-e.y,2))}static distanceNN(t,e,i,s){return jt(zt(t-i,2)+zt(e-s,2))}static distancePN(t,e,i){return jt(zt(e-t.x,2)+zt(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Zt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Zt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return qt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Jt extends Zt{}function Qt(t){return t*(Math.PI/180)}function te(t){return 180*t/Math.PI}const ee=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Pt;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function ie(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function se(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ne(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function re(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ne(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class ae{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new ae,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new ae;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ae(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=te(r.rotateDeg),r}}class oe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function le(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function he(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ce=/^#([0-9a-f]{3,8})$/,de={transparent:4294967040},ue={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ge(t){return S(t)?new _e(t>>16,t>>8&255,255&t,1):y(t)?new _e(t[0],t[1],t[2]):new _e(255,255,255)}function me(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function fe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ve{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ve(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ve(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ve?t:new ve(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(de[t]))return function(t){return S(t)?new _e(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new _e(t[0],t[1],t[2],t[3]):new _e(255,255,255,1)}(de[t]);if(p(ue[t]))return ge(ue[t]);const e=`${t}`.trim().toLowerCase(),i=ce.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new _e((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ge(t):8===e?new _e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new _e(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=le(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new _e(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ve.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new _e(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=he(this.color.r,this.color.g,this.color.b),r=le(u(t)?n.h:ft(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new _e(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ce.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new _e((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?ge(s):8===n?new _e(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=ue[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new ve(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=me(t.color.r),this.color.g=me(t.color.g),this.color.b=me(t.color.b),this}copyLinearToSRGB(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class _e{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${pe(this.r)+pe(this.g)+pe(this.b)+(1===this.opacity?"":pe(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=he(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ye(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new _e(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:he});function xe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Se,Ae,ke,Me,Te,we,Ce,Ee;function Pe(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Re(t,e,i){return null===t?e:null===e?t:(Se=t.x1,Ae=t.x2,ke=t.y1,Me=t.y2,Te=e.x1,we=e.x2,Ce=e.y1,Ee=e.y2,i&&(Se>Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce])),Se>=we||Ae<=Te||ke>=Ee||Me<=Ce?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Se,Te),y1:Math.max(ke,Ce),x2:Math.min(Ae,we),y2:Math.min(Me,Ee)})}var Le;function Oe(t,e,i){return!(t&&e&&(i?(Se=t.x1,Ae=t.x2,ke=t.y1,Me=t.y2,Te=e.x1,we=e.x2,Ce=e.y1,Ee=e.y2,Se>Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce]),Se>we||AeEe||Mee.x2||t.x2e.y2||t.y2Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),t.x>=Se&&t.x<=Ae&&t.y>=ke&&t.y<=Me):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function De(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Fe(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function je(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ze(t,e){const i=e?t.angle:Qt(t.angle),s=je(t);return[Fe({x:t.x1,y:t.y1},i,s),Fe({x:t.x2,y:t.y1},i,s),Fe({x:t.x2,y:t.y2},i,s),Fe({x:t.x1,y:t.y2},i,s)]}let He,Ne,Ve,Ge;function We(t){return He=1/0,Ne=1/0,Ve=-1/0,Ge=-1/0,t.forEach((t=>{He>t.x&&(He=t.x),Vet.y&&(Ne=t.y),Gee&&r>s||rn?o:0}function $e(t,e){return Math.abs(t-e)0&&Ye(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Ze=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Je{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Je.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Je.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Je.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Je.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Je.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Je.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Je.NUMBERS_CHAR_SET="0123456789",Je.FULL_SIZE_CHAR="字";const Qe=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ti(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ei(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function ii(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const si=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ni=6371008.8,ri={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ni,kilometers:6371.0088,kilometres:6371.0088,meters:ni,metres:ni,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ni/1852,radians:1,yards:6967335.223679999};function ai(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function oi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function li(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===Ie(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hi(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=Qt(t[0]),r=Qt(t[1]),a=Qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ri[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:te(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:te(l)}}class ci{static getInstance(){return ci.instance||(ci.instance=new ci),ci.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let ui;function pi(t,e){const i=di(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class gi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const mi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fi(t){let e;if(e=mi.exec(t))return new gi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const vi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class _i{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return _i.instance||(_i.instance=new _i),_i.instance}newFormat(t){const e=fi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):yi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=yi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?vi[8+ui/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=fi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=di(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=vi[8+n/3];return function(t){return s(r*t)+a}}}const yi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>pi(100*t,e),r:pi,s:function(t,e){const i=di(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(ui=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+di(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function bi(){return new xi}function xi(){this.reset()}xi.prototype={constructor:xi,reset:function(){this.s=this.t=0},add:function(t){Ai(Si,t,this.t),Ai(this,Si.s,this.s),this.s?this.t+=Si.t:this.s=Si.t},valueOf:function(){return this.s}};var Si=new xi;function Ai(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ki=1e-6,Mi=Math.PI,Ti=Mi/2,wi=Mi/4,Ci=2*Mi,Ei=180/Mi,Pi=Mi/180,Bi=Math.abs,Ri=Math.atan,Li=Math.atan2,Oi=Math.cos,Ii=Math.exp,Di=Math.log,Fi=Math.pow,ji=Math.sin,zi=Math.sign||function(t){return t>0?1:t<0?-1:0},Hi=Math.sqrt,Ni=Math.tan;function Vi(t){return t>1?0:t<-1?Mi:Math.acos(t)}function Gi(t){return t>1?Ti:t<-1?-Ti:Math.asin(t)}function Wi(){}function Ui(t,e){t&&Ki.hasOwnProperty(t.type)&&Ki[t.type](t,e)}var Yi={Feature:function(t,e){Ui(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sMi?t+Math.round(-t/Ci)*Ci:t,e]}function as(t,e,i){return(t%=Ci)?e||i?ns(ls(t),hs(e,i)):ls(t):e||i?hs(e,i):rs}function os(t){return function(e,i){return[(e+=t)>Mi?e-Ci:e<-Mi?e+Ci:e,i]}}function ls(t){var e=os(t);return e.invert=os(-t),e}function hs(t,e){var i=Oi(t),s=ji(t),n=Oi(e),r=ji(e);function a(t,e){var a=Oi(e),o=Oi(t)*a,l=ji(t)*a,h=ji(e),c=h*i+o*s;return[Li(l*n-c*r,o*i-h*s),Gi(c*n+l*r)]}return a.invert=function(t,e){var a=Oi(e),o=Oi(t)*a,l=ji(t)*a,h=ji(e),c=h*n-l*r;return[Li(l*n+h*r,o*i+c*s),Gi(c*i-o*s)]},a}function cs(t,e){(e=Ji(e))[0]-=t,ss(e);var i=Vi(-e[1]);return((-e[2]<0?-i:i)+Ci-ki)%Ci}function ds(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Wi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function us(t,e){return Bi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function ms(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function xs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Ss(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ds(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=xs(a);var t=function(t,e){var i=ys(e),s=e[1],n=ji(s),r=[ji(i),-Oi(i),0],a=0,o=0;_s.reset(),1===n?s=Ti+ki:-1===n&&(s=-Ti-ki);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Mi,w=m*x;if(_s.add(Li(w*k*ji(M),f*S+w*Oi(M))),a+=T?A+k*Ci:A,T^p>=i^y>=i){var C=ts(Ji(u),Ji(_));ss(C);var E=ts(r,C);ss(E);var P=(T^A>=0?-1:1)*Gi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ki||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(As))}return u}}function As(t){return t.length>1}function ks(t,e){return((t=t.x)[0]<0?t[1]-Ti-ki:Ti-t[1])-((e=e.x)[0]<0?e[1]-Ti-ki:Ti-e[1])}1===(fs=bs).length&&(vs=fs,fs=function(t,e){return bs(vs(t),e)});var Ms=Ss((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mi:-Mi,l=Bi(r-i);Bi(l-Mi)0?Ti:-Ti),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Mi&&(Bi(i-n)ki?Ri((ji(e)*(r=Oi(s))*ji(i)-ji(s)*(n=Oi(e))*ji(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ti,s.point(-Mi,n),s.point(0,n),s.point(Mi,n),s.point(Mi,0),s.point(Mi,-n),s.point(0,-n),s.point(-Mi,-n),s.point(-Mi,0),s.point(-Mi,n);else if(Bi(t[0]-e[0])>ki){var r=t[0]0,n=Bi(e)>ki;function r(t,i){return Oi(t)*Oi(i)>e}function a(t,i,s){var n=[1,0,0],r=ts(Ji(t),Ji(i)),a=Qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ts(n,r),u=is(n,h);es(u,is(r,c));var p=d,g=Qi(u,p),m=Qi(p,p),f=g*g-m*(Qi(u,u)-1);if(!(f<0)){var v=Hi(f),_=is(p,(-g-v)/m);if(es(_,u),_=Zi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Bi(_[0]-b)Mi^(b<=_[0]&&_[0]<=x)){var T=is(p,(-g+v)/m);return es(T,u),[_,Zi(T)]}}}function o(e,i){var n=s?t:Mi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ss(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Mi:-Mi),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||us(e,p)||us(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&us(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Oi(e),o=ji(e),l=s*i;null==n?(n=e+s*Ci,r=e-l/2):(n=cs(a,n),r=cs(a,r),(s>0?nr)&&(n+=s*Ci));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Bi(s[0]-t)0?0:3:Bi(s[0]-i)0?2:1:Bi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ds(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=xs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&gs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Cs,Math.min(ws,g)),m=Math.max(Cs,Math.min(ws,m))],b=[r=Math.max(Cs,Math.min(ws,r)),a=Math.max(Cs,Math.min(ws,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ps(t){return t}var Bs,Rs,Ls,Os,Is=bi(),Ds=bi(),Fs={point:Wi,lineStart:Wi,lineEnd:Wi,polygonStart:function(){Fs.lineStart=js,Fs.lineEnd=Ns},polygonEnd:function(){Fs.lineStart=Fs.lineEnd=Fs.point=Wi,Is.add(Bi(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function js(){Fs.point=zs}function zs(t,e){Fs.point=Hs,Bs=Ls=t,Rs=Os=e}function Hs(t,e){Ds.add(Os*t-Ls*e),Ls=t,Os=e}function Ns(){Hs(Bs,Rs)}var Vs=Fs,Gs=1/0,Ws=Gs,Us=-Gs,Ys=Us;var Ks,Xs,$s,qs,Zs={point:function(t,e){tUs&&(Us=t);eYs&&(Ys=e)},lineStart:Wi,lineEnd:Wi,polygonStart:Wi,polygonEnd:Wi,result:function(){var t=[[Gs,Ws],[Us,Ys]];return Us=Ys=-(Ws=Gs=1/0),t}},Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln={point:hn,lineStart:cn,lineEnd:pn,polygonStart:function(){ln.lineStart=gn,ln.lineEnd=mn},polygonEnd:function(){ln.point=hn,ln.lineStart=cn,ln.lineEnd=pn},result:function(){var t=on?[rn/on,an/on]:nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:[NaN,NaN];return Js=Qs=tn=en=sn=nn=rn=an=on=0,t}};function hn(t,e){Js+=t,Qs+=e,++tn}function cn(){ln.point=dn}function dn(t,e){ln.point=un,hn($s=t,qs=e)}function un(t,e){var i=t-$s,s=e-qs,n=Hi(i*i+s*s);en+=n*($s+t)/2,sn+=n*(qs+e)/2,nn+=n,hn($s=t,qs=e)}function pn(){ln.point=hn}function gn(){ln.point=fn}function mn(){vn(Ks,Xs)}function fn(t,e){ln.point=vn,hn(Ks=$s=t,Xs=qs=e)}function vn(t,e){var i=t-$s,s=e-qs,n=Hi(i*i+s*s);en+=n*($s+t)/2,sn+=n*(qs+e)/2,nn+=n,rn+=(n=qs*t-$s*e)*($s+t),an+=n*(qs+e),on+=3*n,hn($s=t,qs=e)}var _n=ln;function yn(t){this._context=t}yn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ci)}},result:Wi};var bn,xn,Sn,An,kn,Mn=bi(),Tn={point:Wi,lineStart:function(){Tn.point=wn},lineEnd:function(){bn&&Cn(xn,Sn),Tn.point=Wi},polygonStart:function(){bn=!0},polygonEnd:function(){bn=null},result:function(){var t=+Mn;return Mn.reset(),t}};function wn(t,e){Tn.point=Cn,xn=An=t,Sn=kn=e}function Cn(t,e){An-=t,kn-=e,Mn.add(Hi(An*An+kn*kn)),An=t,kn=e}var En=Tn;function Pn(){this._string=[]}function Bn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Rn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),qi(t,i(s))),s.result()}return r.area=function(t){return qi(t,i(Vs)),Vs.result()},r.measure=function(t){return qi(t,i(En)),En.result()},r.bounds=function(t){return qi(t,i(Zs)),Zs.result()},r.centroid=function(t){return qi(t,i(_n)),_n.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ps):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Pn):new yn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Ln(t){return function(e){var i=new On;for(var s in t)i[s]=t[s];return i.stream=e,i}}function On(){}function In(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),qi(i,t.stream(Zs)),e(Zs.result()),null!=s&&t.clipExtent(s),t}function Dn(t,e,i){return In(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Fn(t,e,i){return Dn(t,[[0,0],e],i)}function jn(t,e,i){return In(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function zn(t,e,i){return In(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Pn.prototype={_radius:4.5,_circle:Bn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Bn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},On.prototype={constructor:On,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Hn=16,Nn=Oi(30*Pi);function Vn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Hi(b*b+x*x+S*S),k=Gi(S/=A),M=Bi(Bi(S)-1)e||Bi((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Pi:0,E()):[f*Ei,v*Ei,_*Ei]},w.angle=function(t){return arguments.length?(y=t%360*Pi,E()):y*Ei},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Vn(o,T=t*t),P()):Hi(T)},w.fitExtent=function(t,e){return Dn(w,t,e)},w.fitSize=function(t,e){return Fn(w,t,e)},w.fitWidth=function(t,e){return jn(w,t,e)},w.fitHeight=function(t,e){return zn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function Xn(t){var e=0,i=Mi/3,s=Kn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Pi,i=t[1]*Pi):[e*Ei,i*Ei]},n}function $n(t,e){var i=ji(t),s=(i+ji(e))/2;if(Bi(s)2?t[2]*Pi:0),e.invert=function(e){return(e=t.invert(e[0]*Pi,e[1]*Pi))[0]*=Ei,e[1]*=Ei,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ir?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function nr(t){return Ni((Ti+t)/2)}function rr(t,e){var i=Oi(t),s=t===e?ji(t):Di(i/Oi(e))/Di(nr(e)/nr(t)),n=i*Fi(nr(t),s)/s;if(!s)return ir;function r(t,e){n>0?e<-Ti+ki&&(e=-Ti+ki):e>Ti-ki&&(e=Ti-ki);var i=n/Fi(nr(e),s);return[i*ji(s*t),n-i*Oi(s*t)]}return r.invert=function(t,e){var i=n-e,r=zi(s)*Hi(t*t+i*i),a=Li(t,Bi(i))*zi(i);return i*s<0&&(a-=Mi*zi(t)*zi(i)),[a/s,2*Ri(Fi(n/r,1/s))-Ti]},r}function ar(t,e){return[t,e]}function or(t,e){var i=Oi(t),s=t===e?ji(t):(i-Oi(e))/(e-t),n=i/s+t;if(Bi(s)ki&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},fr.invert=Qn(Gi),vr.invert=Qn((function(t){return 2*Ri(t)})),_r.invert=function(t,e){return[-e,2*Ri(Ii(t))-Ti]};var xr={exports:{}},Sr=function(t,e){this.p1=t,this.p2=e};Sr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Sr.prototype.run=function(){return this.p2[0]-this.p1[0]},Sr.prototype.slope=function(){return this.rise()/this.run()},Sr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Sr.prototype.isVertical=function(){return!isFinite(this.slope())},Sr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Sr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Sr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Sr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Sr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ar=Sr,kr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ar(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=kr(t.slice(0,s),e),o=kr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Mr=kr;!function(t){var e=Mr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=wr(Pr,e),{tolerance:s}=i;return Tr(t,s)};var Rr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Rr||(Rr={}));const Lr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+jr(e,6):jr(e,4))+"-"+jr(t.getUTCMonth()+1,2)+"-"+jr(t.getUTCDate(),2)+(r?"T"+jr(i,2)+":"+jr(s,2)+":"+jr(n,2)+"."+jr(r,3)+"Z":n?"T"+jr(i,2)+":"+jr(s,2)+":"+jr(n,2)+"Z":s||i?"T"+jr(i,2)+":"+jr(s,2)+"Z":"")}function Hr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ir;if(h)return h=!1,Or;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Rr.DSV;const i=wr(Gr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Hr(s).parse(t)},Ur=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Nr(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Vr(t)};function Kr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Xr(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Xr(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qr(t);default:throw new Error("unknown GeoJSON type")}}function Xr(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=$r(t.properties),e.geometry=qr(t.geometry),e}function $r(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=$r(s):e[i]=s})),e):e}function qr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return qr(t)})),e):(e.coordinates=Zr(t.coordinates),e)}function Zr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Zr(t)}))}function Jr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Qr(t){for(var e,i,s=Jr(t),n=0,r=1;r0}function ta(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Kr(t));var r=[];switch(t.type){case"GeometryCollection":return ea(t,(function(t){sa(t,s)})),t;case"FeatureCollection":return ta(t,(function(t){ta(sa(t,s),(function(t){r.push(t)}))})),oi(r)}return sa(t,s)}function sa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ea(t,(function(t){sa(t,e)})),t;case"LineString":return na(Jr(t),e),t;case"Polygon":return ra(Jr(t),e),t;case"MultiLineString":return Jr(t).forEach((function(t){na(t,e)})),t;case"MultiPolygon":return Jr(t).forEach((function(t){ra(t,e)})),t;case"Point":case"MultiPoint":return t}}function na(t,e){Qr(t)===e&&t.reverse()}function ra(t,e){Qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=aa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ca=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Rr.GEO;const i=wr(la,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ha(t))})):e.push(ha(t))})),e})(t);let o=t.features;return a&&(o=ia(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=oa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=oa.bounds(t);t.bbox=e}})),t.features=o,t},da={},ua=(t,e,i)=>{i.type=Rr.GEO;const s=wr(la,da,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return br(a,t)}))}:br(a,o));var a,o;return ca(r,s,i)},pa=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ga=0;function ma(){return ga>1e8&&(ga=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ga++}class fa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ma("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const va="_data-view-diff-rank";class _a{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ma("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[va]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[va]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[va]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Lr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ya{static GenAutoIncrementId(){return ya.auto_increment_id++}}ya.auto_increment_id=0;class ba{constructor(t){this.id=ya.GenAutoIncrementId(),this.registry=t}}const xa="named",Sa="inject",Aa="multi_inject",ka="inversify:tagged",Ma="inversify:paramtypes";class Ta{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===xa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var wa=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ca(e,0,s,t)}}function Pa(t){return e=>(i,s,n)=>Ea(new Ta(t,e))(i,s,n)}const Ba=Pa(Sa),Ra=Pa(Aa);function La(){return function(t){return wa.defineMetadata(Ma,null,t),t}}function Oa(t){return Ea(new Ta(xa,t))}const Ia="Singleton",Da="Transient",Fa="ConstantValue",ja="DynamicValue",za="Factory",Ha="Function",Na="Instance",Va="Invalid";class Ga{constructor(t,e){this.id=ya.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Va,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ga(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ia&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Wa{getConstructorMetadata(t){return{compilerGeneratedMetadata:wa.getMetadata(Ma,t),userGeneratedMetadata:wa.getMetadata(ka,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ua=(Ya=xa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ya&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const $a=Symbol("ContributionProvider");class qa{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Za(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ja{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Qa extends Ja{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const to=Symbol.for("EnvContribution"),eo=Symbol.for("VGlobal");var io=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},so=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},no=function(t,e){return function(i,s){e(i,s,t)}};let ro=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ya.GenAutoIncrementId(),this.hooks={onSetEnv:new Qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ro=io([La(),no(0,Ba($a)),no(0,Oa(to)),so("design:paramtypes",[Object])],ro);const ao=Pt-1e-8;class oo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ao)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Pt)<0&&(s+=Pt),(n%=Pt)<0&&(n+=Pt),nn;++o,a-=Et)g(a);else for(a=s-s%Et+Et,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ho=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,co={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},uo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let po,go,mo,fo,vo,_o;var yo,bo,xo,So,Ao,ko,Mo,To,wo;function Co(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Eo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=Qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Pt:C>0&&0===r&&(C-=Pt);const E=Math.ceil(Math.abs(C/(Et+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Vo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Go(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Wo(t,e,i){const s=null!=e?e:Rt(i[i.length-1].x-i[0].x)>Rt(i[i.length-1].y-i[0].y)?Mo.ROW:Mo.COLUMN;return"monotoneY"===t?new Vo(t,s):new No(t,s)}class Uo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Yo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return function(t,e){Go(t,e)}(new Uo(n,s),t),n}function Ko(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Xo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Ko(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Ko(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("basis",i,t);return function(t,e){Go(t,e)}(new Xo(n,s),t),n}function qo(t){return t<0?-1:1}function Zo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(qo(r)+qo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Jo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Qo(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class tl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Qo(this,this._t0,Jo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Qo(this,Jo(this,e=Zo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Qo(this,this._t0,e=Zo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class el extends tl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function il(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("monotoneX",i,t);return function(t,e){Go(t,e)}(new tl(n,s),t),n}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("monotoneY",i,t);return function(t,e){Go(t,e)}(new el(n,s),t),n}let nl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function rl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Rt(t[t.length-1].x-t[0].x)>Rt(t[t.length-1].y-t[0].y)?Mo.ROW:Mo.COLUMN);return function(t,e){Go(t,e)}(new nl(r,e,n),t),r}class al extends Uo{lineEnd(){this.context.closePath()}}function ol(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return function(t,e){Go(t,e)}(new al(n,s),t),n}function ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>wt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>wt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function hl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Go(new e(o,s,a),i),o}}const cl=hl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const dl=hl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ul(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return $o(t,i);case"monotoneX":return il(t,i);case"monotoneY":return sl(t,i);case"step":return rl(t,.5,i);case"stepBefore":return rl(t,0,i);case"stepAfter":return rl(t,1,i);case"catmullRom":return cl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ol(t,i)}}class pl extends lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new oo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([uo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([uo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([uo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([uo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([uo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([uo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([uo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([uo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([uo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[uo.M]=t=>`M${t[1]} ${t[2]}`,t[uo.L]=t=>`L${t[1]} ${t[2]}`,t[uo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[uo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[uo.A]=t=>{const e=[];Po(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[uo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Mo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.y-e.p1.y)}if(this.direction===Mo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const gl=["l",0,0,0,0,0,0,0];function ml(t,e,i){const s=gl[0]=t[0];if("a"===s||"A"===s)gl[1]=e*t[1],gl[2]=i*t[2],gl[3]=t[3],gl[4]=t[4],gl[5]=t[5],gl[6]=e*t[6],gl[7]=i*t[7];else if("h"===s||"H"===s)gl[1]=e*t[1];else if("v"===s||"V"===s)gl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),Bl=Object.assign(Object.assign({},Al),{points:[],cornerRadius:0,closePath:!0}),Rl=Object.assign(Object.assign({},Al),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},Al),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ll=Object.assign(Object.assign({},Al),{symbolType:"circle",size:10,keepDirIn3d:!0}),Ol=Object.assign(Object.assign(Object.assign({},Al),bl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Il=Object.assign(Object.assign(Object.assign({},Al),bl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Dl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Al),{fill:!0,cornerRadius:0}),Fl=Object.assign(Object.assign({},Dl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const jl=new class{},zl={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/;function Ul(t,e,i,s,n){if(!e||e<=0)return 0;const r=jl.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Yl(t,a)),a}function Yl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i--,i<=0)return e;return i}function Kl(t,e){const i=jl.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var Xl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $l=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Ol.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Yl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Yl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};$l=Xl([La()],$l);var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Zl=Symbol.for("TextMeasureContribution");let Jl=class extends $l{};Jl=ql([La()],Jl);const Ql=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Da,this.options=e,this.id=ya.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Wa}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,xa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ga(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Xa(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Sa],multiInject:s[Aa]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Fa:case Ha:e=t.cache;break;case Na:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ia&&(t.cache=e,t.activated=!0)}},th=Symbol.for("CanvasFactory"),eh=Symbol.for("Context2dFactory");function ih(t){return Ql.getNamed(th,jl.global.env)(t)}const sh=1e-4,nh=Math.sqrt(3),rh=1/3;function ah(t){return t>-bh&&tbh||t<-bh}const lh=[0,0],hh=[0,0],ch=[0,0];function dh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function uh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ph(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function gh(t){return(t%=Bt)<0&&(t+=Bt),t}function mh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function fh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Bt);let d=Math.atan2(l,o);return d<0&&(d+=Bt),d>=s&&d<=n||d+Bt>=s&&d+Bt<=n}function yh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(ah(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Sh=[-1,-1,-1],Ah=[-1,-1];function kh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function Mh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(ah(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,rh):Math.pow(i,rh),s=s<0?-Math.pow(-s,rh):Math.pow(s,rh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+nh*Math.sin(e)))/(3*a),h=(-o+i*(s-nh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Sh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&kh(),p=ph(e,s,r,o,Ah[0]),u>1&&(g=ph(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ah(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Sh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=uh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Sh[0]=-l,Sh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Bt-1e-4){s=0,n=Bt;const e=r?1:-1;return a>=Sh[0]+t&&a<=Sh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Bt,n+=Bt);let c=0;for(let e=0;e<2;e++){const i=Sh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Bt+t),(t>=s&&t<=n||t+Bt>=s&&t+Bt<=n)&&(t>Ct/2&&t<1.5*Ct&&(e=-e),c+=e)}}return c}function Ch(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Eh(t,e){let i=Ch(t[0]);i<0&&(i+=Bt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Bt?n=i+Bt:e&&i-n>=Bt?n=i-Bt:!e&&i>n?n=i+(Bt-Ch(i-n)):e&&i1&&(i||(h+=mh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Ph[0]=S,Ph[1]=A,Eh(Ph,Boolean(a[6])),S=Ph[0],A=Ph[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case uo.M:u=f,p=v,c=u,d=p;break;case uo.L:if(i){if(yh(c,d,f,v,e,s,n))return!0}else h+=mh(c,d,f,v,s,n)||0;c=f,d=v;break;case uo.C:if(i){if(vh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Mh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(fh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case uo.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=mh(c,d,o,l,s,n),i){if(_h(f,v,_,k,k+M,T,e,w,n))return!0}else h+=wh(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case uo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(yh(u,p,o,p,e,s,n)||yh(o,p,o,l,e,s,n)||yh(o,l,u,l,e,s,n)||yh(u,l,u,p,e,s,n))return!0}else h+=mh(o,p,o,l,s,n),h+=mh(u,l,u,p,s,n);break;case uo.Z:if(i){if(yh(c,d,u,p,e,s,n))return!0}else h+=mh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ih=Symbol.for("VWindow"),Dh=Symbol.for("WindowHandlerContribution");let Fh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new Qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Ql.getNamed(Dh,t.env).configure(this,t),this.actived=!0)},this._uid=ya.GenAutoIncrementId(),this.global=jl.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Fh=Lh([La(),Oh("design:paramtypes",[])],Fh);var jh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(i,s){e(i,s,t)}};let Nh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=jl.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Rh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:bl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Je(Object.assign({defaultFontParams:{fontFamily:bl.fontFamily,fontSize:bl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Ql.get(Ih),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Vh;Nh=jh([La(),Hh(0,Ba($a)),Hh(0,Oa(Zl)),zh("design:paramtypes",[Object])],Nh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Vh||(Vh={}));const Gh=new ae;let Wh=class{constructor(){this.matrix=new ae}init(t){return this.mode=Vh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Vh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Gh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}scale(t,e,i){return this.mode===Vh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Vh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}translate(t,e){return this.mode===Vh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Vh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Wh=jh([La(),zh("design:paramtypes",[])],Wh);const Uh={arc:kl,area:Ml,circle:Tl,line:El,path:Pl,symbol:Ll,text:Ol,rect:Rl,polygon:Bl,richtext:Il,richtextIcon:Fl,image:Dl,group:wl,glyph:Cl},Yh=Object.keys(Uh);function Kh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Xh={arc:Object.assign({},Uh.arc),area:Object.assign({},Uh.area),circle:Object.assign({},Uh.circle),line:Object.assign({},Uh.line),path:Object.assign({},Uh.path),symbol:Object.assign({},Uh.symbol),text:Object.assign({},Uh.text),rect:Object.assign({},Uh.rect),polygon:Object.assign({},Uh.polygon),richtext:Object.assign({},Uh.richtext),richtextIcon:Object.assign({},Uh.richtextIcon),image:Object.assign({},Uh.image),group:Object.assign({},Uh.group),glyph:Object.assign({},Uh.glyph)};class $h{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Yh.forEach((t=>{this._defaultTheme[t]=Object.create(Xh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Yh.forEach((s=>{const n=Object.create(Xh[s]);t&&t[s]&&Kh(n,t[s]),i[s]&&Kh(n,i[s]),e[s]&&Kh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Yh.forEach((t=>{Kh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const qh=new $h;function Zh(t,e){return t.glyphHost?Zh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):qh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Zh(t.attachedThemeGraphic)||qh.getTheme()}var Jh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Qh extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ya.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Jh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(ac(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ac(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=ac(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=ac(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=rc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ac(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(ac(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,ac(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):ac(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof sc))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=rc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new oc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ic,this.rootWheelEvent=new sc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class dc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return dc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class uc{static Avaliable(){return!0}avaliable(){return uc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class pc{static Avaliable(){return!!jl.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){jl.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var gc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(gc||(gc={}));class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Bt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Bt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Bt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=ya.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===So.END?this.removeAnimate(e):e.status===So.RUNNING||e.status===So.INITIAL?(this.animateCount++,e.advance(t)):e.status===So.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let bc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ya.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc;this.id=t,this.timeline=e,this.status=So.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=It(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&Ao.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:xo.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===So.RUNNING&&(this.status=So.PAUSED)}resume(){this.status===So.PAUSED&&(this.status=So.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===So.RUNNING&&(this.status=So.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=So.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};bc.mode=Ao.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=ko.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=ko.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=ko.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ko.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return rt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const Ac=200,kc="cubicOut",Mc=1e3,Tc="quadInOut";var wc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(wc||(wc={}));const Cc=[!1,!1,!1,!1],Ec=[0,0,0,0],Pc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Ec[0]=t[0],Ec[2]=t[0],Ec[1]=t[1],Ec[3]=t[1],Ec):t:t:0,Bc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Rc=[1,2,3,0,1,2,3,0];function Lc(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;Bc[0].x=i,Bc[1].y=i,Bc[2].x=-i,Bc[3].y=-i;const n=Math.ceil(t/Et)%4,r=Math.ceil(e/Et)%4;if(s.add(Ot(t)*i,Ft(t)*i),s.add(Ot(e)*i,Ft(e)*i),n!==r||e-t>Ct){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:jc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}jc.TimeOut=1e3/60;const zc=new jc,Hc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Nc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Vc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Vc||(Vc={}));class Gc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(l)?(this.clipRange=this.toPoints[l][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],k(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Oc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),i.points=this.points}}class Wc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:xo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:xo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Uc extends Wc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=jl.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Yc extends Wc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=jl.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Kc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Xc extends _c{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?mc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function $c(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function qc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{ut(e,s)&&ut(i,n)||t.push(e,i,s,n,s,n)};function id(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function sd(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function ad(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),hd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},cd=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Zt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return hd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return hd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);cd(n[0],s,i),cd(n[1],e-s,i)}};var dd;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(dd||(dd={}));class ud{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dd.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===dd.Color1){const e=ud.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ve.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ud.store1[t]=e,ud.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=ud.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ve.parseColorString(t);return n&&(ud.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ud.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===dd.Color1){if(ud.store1[t])return;ud.store1[t]=i,ud.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ud.store255[t])return;ud.store255[t]=i,ud.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function pd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function gd(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>md(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):md(t,e,i,s,n)}function md(t,e,i,s,n){if(!t||!e)return t&&pd(t)||e&&pd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ud.Get(t,dd.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ud.Get(e,dd.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:pd(a)})))});return o?gd(r,l,i,s,n):gd(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_d(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_d(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:_d(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),pd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}ud.store255={},ud.store1={};const fd=[0,0,0,0],vd=[0,0,0,0];function _d(t,e,i){return ud.Get(t,dd.Color255,fd),ud.Get(e,dd.Color255,vd),`rgba(${Math.round(fd[0]+(vd[0]-fd[0])*i)},${Math.round(fd[1]+(vd[1]-fd[1])*i)},${Math.round(fd[2]+(vd[2]-fd[2])*i)},${fd[3]+(vd[3]-fd[3])*i})`}const yd=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=gd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},bd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?id(t):[],n=id(e);i&&s&&(i.fromTransform&&sd(s,i.fromTransform.clone().getInverse()),sd(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Sd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Ad=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Sd.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?ud.Get(t[n],dd.Color255):t[n],to:"string"==typeof r?ud.Get(r,dd.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class kd extends _c{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;bd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&yd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Md=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=xd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Ad(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new kd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Tc)),c};class Td extends _c{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;bd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&yd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const wd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Dc.includes(t))(i)||(e[i]=t[i])})),e},Cd=(t,e,i)=>{const s=wd(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=jl.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Ed=(t,e,i)=>{const s=[],n=i?null:wd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:wd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=rd(t.attribute),n=ad(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(jl.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ad(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(jl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ad(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(jl.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return od(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return od(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(jl.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ld(i)}];const s=[];return cd(i,e,s),s})(t,e).forEach((t=>{s.push(jl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return cd(r,e,h),h})(t,e).forEach((t=>{s.push(jl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=id(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(jl.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(jl.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Cd(t,s,e),s};class Bd{static GetImage(t,e){var i;const s=Bd.cache.get(t);s?"fail"===s.loadState?jl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Bd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Bd.cache.get(t);s?"fail"===s.loadState?jl.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Bd.cache.set(t,s),s.dataPromise=jl.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Bd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Bd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=jl.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=jl.global.loadBlob(t):"json"===e&&(i.dataPromise=jl.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Bd.isLoading&&Bd.toLoadAueue.length){Bd.isLoading=!0;const t=Bd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Bd.cache.set(i,n),n.dataPromise=jl.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Bd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Bd.loading()})).catch((t=>{console.error(t),Bd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Bd.loading()}))}}),0)}static loadImage(t,e){const i=Rd(t,Bd.toLoadAueue);if(-1!==i)return Bd.toLoadAueue[i].marks.push(e),void Bd.loading();Bd.toLoadAueue.push({url:t,marks:[e]}),Bd.loading()}static improveImageLoading(t){const e=Rd(t,Bd.toLoadAueue);if(-1!==e){const t=Bd.toLoadAueue.splice(e,1);Bd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Rd(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Jt,this._updateTag=yo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;zd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),zd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else zd.x=n,zd.y=r;return zd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;jl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return jl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ae),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&yo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&yo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&yo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&yo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=yo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===bo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Id;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Id;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(jl.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:Ac,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:kc),c&&this.setAttributes(c,!1,{type:xo.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:xo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=yo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=yo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&yo.UPDATE_SHAPE_AND_BOUNDS)===yo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=yo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=yo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=yo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=yo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=yo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=yo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=yo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&yo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Od.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Od),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=fl.x,y:e=fl.y,scaleX:i=fl.scaleX,scaleY:s=fl.scaleY,angle:n=fl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ot(a),m=Ft(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),jl.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(fl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ld.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),jl.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:xo.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=gd(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=gd(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=gd(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Zh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:jl.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new pl).fromString(t):this.pathProxy=new pl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",jl.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new nc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Nd.mixin(lc);class Vd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Gd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Wd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Ud=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Yd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Wd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Gd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Wd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Vd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Vd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Kd(t,e){return Xd(t)}function Xd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let tu=0;function eu(){return tu++}var iu;function su(t){const e=[];let i=0,s="";for(let n=0;nnu.set(t,!0)));const ru=new Map;function au(t){if(nu.has(t))return!0;if(ru.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>ru.set(t,!0)));const ou=eu(),lu=eu(),hu=eu(),cu=eu(),du=eu(),uu=eu(),pu=eu(),gu=eu(),mu=eu(),fu=eu();eu();const vu=eu();eu();const _u=eu(),yu=eu(),bu=eu(),xu=Symbol.for("GraphicService"),Su=Symbol.for("GraphicCreator"),Au={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},ku=Object.keys(Au);var Mu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Mu||(Mu={}));let Tu=class t extends Nd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=uu,this._childUpdateTag=yo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new $h),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new $h)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===bo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&yo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;jl.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),jl.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=fl.x,y:e=fl.y,dx:i=fl.dx,dy:s=fl.dy,scaleX:n=fl.scaleX,scaleY:r=fl.scaleY,angle:a=fl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Zh(this).group;this._AABBBounds.clear();const i=jl.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Pc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=yo.CLEAR_BOUNDS,this._childUpdateTag&=yo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&yo.UPDATE_BOUNDS||(this._childUpdateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),jl.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),jl.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,jl.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{jl.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),jl.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&yo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=jl.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wu(t){return new Tu(t)}Tu.NOWORK_ANIMATE_ATTR=Hd;class Cu extends Tu{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new $h,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{jl.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{jl.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Eu=Symbol.for("TransformUtil"),Pu=Symbol.for("GraphicUtil"),Bu=Symbol.for("LayerService"),Ru=Symbol.for("StaticLayerHandlerContribution"),Lu=Symbol.for("DynamicLayerHandlerContribution"),Ou=Symbol.for("VirtualLayerHandlerContribution");var Iu,Du=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ju=Iu=class{static GenerateLayerId(){return`${Iu.idprefix}_${Iu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=jl.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Ql.get(Ru):"dynamic"===t?Ql.get(Lu):Ql.get(Ou),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Cu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Iu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ju.idprefix="visactor_layer",ju.prefix_count=0,ju=Iu=Du([La(),Fu("design:paramtypes",[])],ju);var zu=new ba((t=>{t(eo).to(ro).inSingletonScope(),t(Ih).to(Fh),t(Pu).to(Nh).inSingletonScope(),t(Eu).to(Wh).inSingletonScope(),t(Bu).to(ju).inSingletonScope()}));function Hu(t,e){return!(!t&&!e)}function Nu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Vu(t,e,i){return i&&t*e>0}function Gu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Wu(t,e){return t*e>0}function Uu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Yu(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Xu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Rt(l-o),c=l>o;let d=!1;if(n=Bt-wt)e.moveTo(i+n*Ot(o),s+n*Ft(o)),e.arc(i,s,n,o,l,!c),r>wt&&(e.moveTo(i+r*Ot(l),s+r*Ft(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),p=y(u),{outerDeltaAngle:g,innerDeltaAngle:m,outerStartAngle:f,outerEndAngle:v,innerEndAngle:_,innerStartAngle:b}=t.getParsePadAngle(o,l),x=p?u[0]:u,S=p?u[1]:u,A=p?u[2]:u,k=p?u[3]:u,M=Math.max(S,x),T=Math.max(A,k);let w=M,C=T;const E=n*Ot(f),P=n*Ft(f),B=r*Ot(_),R=r*Ft(_);let L,O,I,D;if((T>wt||M>wt)&&(L=n*Ot(v),O=n*Ft(v),I=r*Ot(b),D=r*Ft(b),hwt){const t=Dt(x,w),r=Dt(S,w),o=Ku(I,D,E,P,n,t,Number(c)),l=Ku(L,O,B,R,n,r,Number(c));w0&&e.arc(i+o.cx,s+o.cy,t,Lt(o.y01,o.x01),Lt(o.y11,o.x11),!c),e.arc(i,s,n,Lt(o.cy+o.y11,o.cx+o.x11),Lt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Lt(l.y11,l.x11),Lt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ot(Lt(l.y01,l.x01)),s+l.cy+r*Ft(Lt(l.y01,l.x01))):e.moveTo(i+L,s+n*Ft(v))}else!a||a[0]?(e.moveTo(i+E,s+P),e.arc(i,s,n,f,v,!c)):e.moveTo(i+n*Ot(v),s+n*Ft(v));if(!(r>wt)||m<.001)!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),d=!0;else if(C>wt){const t=Dt(k,C),n=Dt(A,C),o=Ku(B,R,L,O,r,-n,Number(c)),l=Ku(E,P,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),C0&&e.arc(i+o.cx,s+o.cy,n,Lt(o.y01,o.x01),Lt(o.y11,o.x11),!c),e.arc(i,s,r,Lt(o.cy+o.y11,o.cx+o.x11),Lt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Lt(l.y11,l.x11),Lt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ot(Lt(l.y01,l.x01)),s+l.cy+t*Ft(Lt(l.y01,l.x01))):e.moveTo(i+I,s+D)}else!a||a[1]?e.lineTo(i+B,s+R):e.moveTo(i+B,s+R),!a||a[2]?e.arc(i,s,r,_,b,c):e.moveTo(i+r*Ot(b),s+r*Ft(b))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class $u{static GetCanvas(){try{return $u.canvas||($u.canvas=jl.global.createCanvas({})),$u.canvas}catch(t){return null}}static GetCtx(){if(!$u.ctx){const t=$u.GetCanvas();$u.ctx=t.getContext("2d")}return $u.ctx}}class qu extends oe{static getInstance(){return qu._instance||(qu._instance=new qu),qu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=$u.GetCanvas(),s=$u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new qu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Zu{static GetSize(t){for(let e=0;e=t)return Zu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Zu.GenKey(t,e,i,s,n),l=Zu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Zu.GenKey(t,e,i,s,n);Zu.cache[l]?Zu.cache[l].push({width:a,height:o,pattern:r}):Zu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Zu.cache={},Zu.ImageSize=[20,40,80,160,320,640,1280,2560];const Ju=Symbol.for("ArcRenderContribution"),Qu=Symbol.for("AreaRenderContribution"),tp=Symbol.for("CircleRenderContribution"),ep=Symbol.for("GroupRenderContribution"),ip=Symbol.for("ImageRenderContribution"),sp=Symbol.for("PathRenderContribution"),np=Symbol.for("PolygonRenderContribution"),rp=Symbol.for("RectRenderContribution"),ap=Symbol.for("SymbolRenderContribution"),op=Symbol.for("TextRenderContribution"),lp=Symbol.for("InteractiveSubRenderContribution"),hp=["radius","startAngle","endAngle",...Id];class cp extends Nd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Zh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=jl.graphicService.updateCircleAABBBounds(i,Zh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Pc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,hp)}needUpdateTag(t){return super.needUpdateTag(t,hp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new pl;return o.arc(0,0,n,r,a),o}clone(){return new cp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cp.NOWORK_ANIMATE_ATTR}}function dp(t){return new cp(t)}function up(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function pp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function gp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}cp.NOWORK_ANIMATE_ATTR=Hd;class mp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=bu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Zh(this).text;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Zh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Hc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=jl.graphicUtil.textMeasure,k=new mp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===iu.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=pp(x,o),M=gp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Zh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Hc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=jl.graphicUtil.textMeasure,y=new mp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Zh(this).text,a=jl.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Hc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=It(e,o)}));const t=pp(x,o),e=this.cache.verticalList.length*b,i=gp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>su(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===iu.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=It(e,o)}));const k=pp(x,o),M=this.cache.verticalList.length*b,T=gp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function _p(t){return new vp(t)}vp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Hd),vp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},vp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class yp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function bp(t,e,i,s,n){return n?t.arc(i,s,e,0,Pt,!1,n):t.arc(i,s,e,0,Pt),!1}var xp=new class extends yp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return bp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return bp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Sp=new class extends yp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function Ap(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var kp=new class extends yp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Ap(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return Ap(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ap(t,e/2+n,i,s,r)}};function Mp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Tp=new class extends yp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Mp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Mp(t,e/2+n,i,s)}};class wp extends yp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var Cp=new wp;var Ep=new class extends wp{constructor(){super(...arguments),this.type="triangle"}};const Pp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Bp=Math.sin(Pt/10)*Pp,Rp=-Math.cos(Pt/10)*Pp;function Lp(t,e,i,s){const n=Bp*e,r=Rp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Pt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Op=new class extends yp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};const Ip=jt(3);function Dp(t,e,i,s){const n=e,r=n/Ip,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Fp=new class extends yp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Dp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Dp(t,e/2+n,i,s)}};function jp(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var zp=new class extends yp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return jp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return jp(t,e/2+n,i,s)}};function Hp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Np=new class extends yp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Hp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Hp(t,e/2+n,i,s)}};const Vp=-.5,Gp=jt(3)/2,Wp=1/jt(12);function Up(t,e,i,s){const n=e/2,r=e*Wp,a=n,o=e*Wp+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Vp*n-Gp*r+i,Gp*n+Vp*r+s),t.lineTo(Vp*a-Gp*o+i,Gp*a+Vp*o+s),t.lineTo(Vp*l-Gp*h+i,Gp*l+Vp*h+s),t.lineTo(Vp*n+Gp*r+i,Vp*r-Gp*n+s),t.lineTo(Vp*a+Gp*o+i,Vp*o-Gp*a+s),t.lineTo(Vp*l+Gp*h+i,Vp*h-Gp*l+s),t.closePath(),!1}var Yp=new class extends yp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Up(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Up(t,e/2+n,i,s)}};var Kp=new class extends yp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var Xp=new class extends yp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var $p=new class extends yp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const qp=jt(3);function Zp(t,e,i,s){const n=e*qp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Jp=new class extends wp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Zp(t,e/2/qp,i,s)}drawOffset(t,e,i,s,n){return Zp(t,e/2/qp+n,i,s)}};function Qp(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var tg=new class extends yp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Qp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Qp(t,e/4+n,i,s)}};function eg(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var ig=new class extends yp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return eg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return eg(t,e/4+n,i,s)}};function sg(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var ng=new class extends yp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return sg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return sg(t,e/4+n,i,s)}};function rg(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var ag=new class extends yp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return rg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return rg(t,e/4+n,i,s)}};function og(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var lg=new class extends yp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return og(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return og(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function hg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var cg=new class extends yp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return hg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return hg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function dg(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var ug=new class extends yp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return dg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return dg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function pg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function gg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var mg=new class extends yp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?gg(t,e,i,s):pg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?gg(t,e+2*n,i,s):pg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const fg=new Jt;class vg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;fg.x1=s.bounds.x1*t,fg.y1=s.bounds.y1*t,fg.x2=s.bounds.x2*t,fg.y2=s.bounds.y2*t,e.union(fg)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const _g={};[xp,Sp,kp,Tp,Jp,Ep,Op,Fp,zp,Np,Yp,Kp,Xp,Cp,$p,tg,ig,ng,ag,mg,lg,cg,ug].forEach((t=>{_g[t.type]=t}));const yg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},bg=new Jt,xg=["symbolType","size",...Id];let Sg=class t extends Nd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=yu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Zh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=_g[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=yg[i]||i,!0===((n=i).startsWith("{const e=(new pl).fromString(t.d),i={};ku.forEach((e=>{t[e]&&(i[Au[e]]=t[e])})),r.push({path:e,attribute:i}),bg.union(e.bounds)}));const a=bg.width(),o=bg.height(),l=1/It(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new vg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new pl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/It(a,o);return r.transform(0,0,l,l),this._parsedPath=new vg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Zh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=jl.graphicService.updateSymbolAABBBounds(i,Zh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Pc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new pl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new pl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ag(t){return new Sg(t)}Sg.userSymbolMap={},Sg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Hd);const kg=["segments","points","curveType","curveTension",...Id];let Mg=class t extends Nd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ic(i,s,e))}doUpdateAABBBounds(){const t=Zh(this).line;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateLineAABBBounds(e,Zh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,e=new pl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Hd);const wg=["width","x1","y1","height","cornerRadius",...Id];class Cg extends Nd{constructor(t){super(t),this.type="rect",this.numberType=vu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Zh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateRectAABBBounds(e,Zh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=rd(t),r=new pl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Cg.NOWORK_ANIMATE_ATTR}}function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Hd;class Pg extends Nd{constructor(t){super(t),this.type="glyph",this.numberType=du,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=jl.graphicService.updateGlyphAABBBounds(this.attribute,Zh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Pg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Bg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Hd;class Rg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Lg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Hc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ul(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Hl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ul(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Og=["width","height","image",...Id];class Ig extends Nd{constructor(t){super(t),this.type="image",this.numberType=pu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Zh(this).image;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateImageAABBBounds(e,Zh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dl[t]}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Hd);class Fg extends Ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Pc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Pc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Dl.width,height:e=Dl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class jg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Fg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Lg){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof Fg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Kl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof Fg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Fg)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof Fg?t.width:t.getWidthWithEllips(this.direction)})),i}}class zg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Fg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new jg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Fg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ul(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Lg(i,t.newLine,t.character),new Lg(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Hg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...Id];class Ng extends Nd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=_u}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Il.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Il.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Il.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Il.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Il.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Il.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Il.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Il.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Zh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateRichTextAABBBounds(e,Zh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Il[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,m=[],f=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Rg(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new zg(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;const o=e.AABBBounds.clone();o.translate(e._marginArray[3],e._marginArray[0]),o.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i+e._marginArray[3],n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Vg(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Hd);const Gg=["path","customPath",...Id];class Wg extends Nd{constructor(t){super(t),this.type="path",this.numberType=mu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Zh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pl?this.cache:t.path)}doUpdateAABBBounds(){const t=Zh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updatePathAABBBounds(e,Zh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new pl).fromString(t.path):t.customPath&&(this.cache=new pl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Zh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){return(new pl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Hd);const Yg=["segments","points","curveType","curveTension",...Id];class Kg extends Nd{constructor(t){super(t),this.type="area",this.numberType=hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Zh(this).area;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updateAreaAABBBounds(e,Zh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ic(i,s,e))}getDefaultAttribute(t){return Zh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){const t=new pl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Hd);const $g=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Id];class qg extends Nd{constructor(t){super(t),this.type="arc",this.numberType=ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Zh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=Zh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ee(e),i=e+r,s&&Rt(r)wt&&o>wt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Zh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=jt(a*a+o*o)}=this.attribute,h=Rt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>wt&&l>wt){const i=e>t?1:-1;let s=Nt(Number(l)/o*Ft(g)),n=Nt(Number(l)/a*Ft(g));return(m-=2*s)>wt?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>wt?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Zh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=jl.graphicService.updateArcAABBBounds(i,Zh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Pc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}getDefaultAttribute(t){return Zh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Rt(i-e),a=i>e;if(n=Bt-wt)o.moveTo(0+n*Ot(e),0+n*Ft(e)),o.arc(0,0,n,e,i,!a),s>wt&&(o.moveTo(0+s*Ot(i),0+s*Ft(i)),o.arc(0,0,s,i,e,a));else{const t=n*Ot(e),r=n*Ft(e),l=s*Ot(i),h=s*Ft(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Hd);const Jg=["points","cornerRadius",...Id];class Qg extends Nd{constructor(t){super(t),this.type="polygon",this.numberType=fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Zh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=jl.graphicService.updatePolygonAABBBounds(e,Zh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Pc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ic(i,s,e))}getDefaultAttribute(t){return Zh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){const t=this.attribute.points,e=new pl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tm(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Hd;class em extends Tu{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function im(t){return new em(t)}class sm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class nm extends sm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;Qd(i,s+(r+o)/2,!0,a)}return i}}class rm{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return rm.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};function dm(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function um(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function pm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function gm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),dm(t,t,[n+o,r+l,a+h]),dm(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),dm(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=om.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}dm(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),dm(i,i,[-s[0],-s[1],0]),pm(t,t,i)}}let mm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Qa(["graphic"]),onSetStage:new Qa(["graphic","stage"]),onRemove:new Qa(["graphic"]),onRelease:new Qa(["graphic"]),onAddIncremental:new Qa(["graphic","group","stage"]),onClearIncremental:new Qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new Qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Jt,this.tempAABBBounds2=new Jt,this._rectBoundsContribitions=[new sm],this._symbolBoundsContribitions=[new nm],this._imageBoundsContribitions=[new sm],this._circleBoundsContribitions=[new sm],this._arcBoundsContribitions=[new sm],this._pathBoundsContribitions=[new sm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new oo(t);return Ro(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=gp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=pp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){Qd(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),qt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r||a.add(t.x,t.y)}))})),a}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Bt-wt?i.set(-a,-a,a,a):Lc(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=wt?i.set(0,0,0,0):Math.abs(l-h)>Bt-wt?i.set(-n,-n,n,n):(Lc(h,l,n,i),Lc(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Qd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Qd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&qt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};mm=lm([La(),cm(0,Ba(Su)),hm("design:paramtypes",[Object])],mm);const fm=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let vm,_m;function ym(t){return vm||(vm=fm.CreateGraphic("text",{})),vm.initAttributes(t),vm.AABBBounds}const bm={x:0,y:0,z:0,lastModelMatrix:null};class xm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===wo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===wo.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Vu(o,l,n),p=Wu(o,c),g=Hu(n,r),m=Nu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;bm.x=n,bm.y=r,bm.z=a,bm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=om.allocate(),n=om.allocate();gm(n,t,e),pm(s,d||s,n),bm.x=0,bm.y=0,bm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),om.free(n)}if(g&&!d){const s=t.getOffsetXY(e);bm.x+=s.x,bm.y+=s.y,bm.z=a,i.setTransformForCurrent()}else if(p)bm.x=0,bm.y=0,bm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);bm.x+=s.x,bm.y+=s.y,this.transformWithoutTranslate(i,bm.x,bm.y,bm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),bm.x=0,bm.y=0,bm.z=0;return bm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Zh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=Vu(d,u,h),y=Wu(d,g),b=Hu(h),x=Nu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&om.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const Sm=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Am{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Am.IsGradientStr(t))try{const e=Sm(t)[0];if(e){if("linear"===e.type)return Am.ParseLinear(e);if("radial"===e.type)return Am.ParseRadial(e);if("conic"===e.type)return Am.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2,n=parseFloat(e.value)/180*Ct-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Bt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2;let n="angular"===e.type?parseFloat(e.value)/180*Ct:0;for(;n<0;)n+=Bt;for(;n>Bt;)n-=Bt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function km(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Mm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var Tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};class Em{constructor(){this.time=wo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Rh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Rh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Pm=new Em;let Bm=class{constructor(t){this.subRenderContribitions=t,this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Bm=Tm([La(),Cm(0,Ba($a)),Cm(0,Oa(lp)),wm("design:paramtypes",[Object])],Bm);class Rm{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Rh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Rh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Bt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Lm=new Rm;const Om=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=km(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Xu(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=km(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Xu(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Im=Lm,Dm=Pm;const Fm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=km(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=km(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},jm=Lm,zm=Pm;const Hm=new class extends Em{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Nm=Ct/2;function Vm(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Rt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Rt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Rt(t[0]),i=Rt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Rt(o[0]),o[1]=Rt(o[1]),o[2]=Rt(o[2]),o[3]=Rt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-Nm,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,Nm,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Nm,Ct,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Ct,Ct+Nm,!1)}return!a&&t.closePath(),t}var Gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Wm{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=km(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),Vm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=km(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),Vm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Um=class{constructor(){this.time=wo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Um=Gm([La()],Um);let Ym=class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Vm(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Ym=Gm([La()],Ym);const Km=new Wm,Xm=Lm,$m=Pm;const qm=new class extends Wm{constructor(){super(...arguments),this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Zm=new class extends Em{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Pc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?Vm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Jm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=km(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=km(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Qm=Lm,tf=Pm;var ef=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nf=function(t,e){return function(i,s){e(i,s,t)}};let rf=class extends xm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Rt(d-c),p=d>c;let g=!1;if(nwt||C>wt)&&(D=n*Ot(x),F=n*Ft(x),j=r*Ot(A),z=r*Ft(A),uwt){const t=Dt(k,P),r=Dt(M,P),a=Ku(j,z,R,L,n,t,Number(p)),o=Ku(D,F,O,I,n,r,Number(p));if(P0&&e.arc(i+o.cx,s+o.cy,r,Lt(o.y11,o.x11),Lt(o.y01,o.x01),!p)}}else e.moveTo(i+R,s+L);if(!(r>wt)||_<.001)e.lineTo(i+O,s+I),g=!0;else if(B>wt){const t=Dt(w,B),n=Dt(T,B),a=Ku(O,I,D,F,r,-n,Number(p)),o=Ku(R,L,j,z,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),B0&&e.arc(i+a.cx,s+a.cy,n,Lt(a.y01,a.x01),Lt(a.y11,a.x11),!p);const t=Lt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*Ot(A),s+r*Ft(A));return g}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Rt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Cc[s]=t,i&&(i=!(null!==(e=Cc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Cc[e]=!!t[e],i&&(i=!!Cc[e]);else Cc[0]=!1,Cc[1]=!1,Cc[2]=!1,Cc[3]=!1;return{isFullStroke:i,stroke:Cc}})(d);if((v||C)&&(e.beginPath(),Xu(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),Xu(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Rt(h-r)>=Bt-wt){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Bt;for(;i>Bt;)i-=Bt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),gd(o.color,l.color,h,!1)}(0,0,h,n);a||Vu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};rf=ef([La(),nf(0,Ba($a)),nf(0,Oa(Ju)),sf("design:paramtypes",[Object])],rf);var af=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},of=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lf=function(t,e){return function(i,s){e(i,s,t)}};let hf=class extends xm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Fm,zm,jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function cf(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Fo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function df(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),cf(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=Mo.ROW:"y"===s?m=Mo.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pf=class extends xm{constructor(){super(...arguments),this.numberType=gu}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;df(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),df(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ul(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function gf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function mf(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),cf(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),cf(t,l,1,s),o=!1):o=!0}t.closePath()}pf=uf([La()],pf);const ff=new class extends Rm{constructor(){super(...arguments),this.time=wo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Fc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Fc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Fc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Fc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},vf=Pm;var _f=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bf=function(t,e){return function(i,s){e(i,s,t)}};function xf(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return $o(t,i);case"monotoneX":return il(t,i);case"monotoneY":return sl(t,i);case"step":return rl(t,.5,i);case"stepBefore":return rl(t,0,i);case"stepAfter":return rl(t,1,i);case"catmullRom":return cl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return ol(t,i)}}let Sf=class extends xm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=hu,this.builtinContributions=[ff,vf],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Zh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:M,points:T,segments:w}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===k&&!w&&!T.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=xf(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=xf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=xf(e,C,{curveTension:b}),n=xf(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,y,r[c],[g,t.attribute],k,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,A,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,y,t.attribute,g,k,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=Mo.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Rt(E.x-P.x),L=Rt(E.y-P.y);B=null==E.x1?Mo.ROW:null==E.y1?Mo.COLUMN:Number.isFinite(R+L)?R>L?Mo.ROW:Mo.COLUMN:Mo.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),gf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),gf(t,e,i,s),e.length=0,i.length=0)}n=o})),gf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?Mo.ROW:Mo.COLUMN,Number.isFinite(u)||(h=Mo.COLUMN),Number.isFinite(p)||(h=Mo.ROW);const g=i*(h===Mo.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wf=function(t,e){return function(i,s){e(i,s,t)}};let Cf=class extends xm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=mu,this.builtinContributions=[kf,Af],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,g);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cf=Mf([La(),wf(0,Ba($a)),wf(0,Oa(sp)),Tf("design:paramtypes",[Object])],Cf);var Ef=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bf=function(t,e){return function(i,s){e(i,s,t)}};let Rf=class extends xm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=vu,this.builtinContributions=[Km,$m,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=Gu(g,m,k,M,c),w=Uu(g,v,k,M),C=Hu(c,d),E=Nu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),Vm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Rf=Ef([La(),Bf(0,Ba($a)),Bf(0,Oa(rp)),Pf("design:paramtypes",[Object])],Rf);var Lf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Of=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},If=function(t,e){return function(i,s){e(i,s,t)}};let Df=class extends xm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=yu,this.builtinContributions=[Jm,tf,Qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Zh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Df=Lf([La(),If(0,Ba($a)),If(0,Oa(ap)),Of("design:paramtypes",[Object])],Df);const Ff=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Jt)}allocate(t,e,i,s){if(!this.pools.length)return(new Jt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Jt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const jf=new class extends Em{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=Ff.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=ym(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Vm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&Ff.free(C),w()}};var zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nf=function(t,e){return function(i,s){e(i,s,t)}};let Vf=class extends xm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=bu,this.builtinContributions=[jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Zh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Hc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=am.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),am.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=It(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=pp(l,f),_=gp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=gp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function Gf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qf=function(t,e){return function(i,s){e(i,s,t)}};let Zf=class extends xm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Kf,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Gf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Gf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Wf(d,u),b=Wf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Uf(h,_,y,d,u),A=Uf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Wf(k,M),w=Uf(h,Wf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Zf=Xf([La(),qf(0,Ba($a)),qf(0,Oa(np)),$f("design:paramtypes",[Object])],Zf);var Jf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tv=function(t,e){return function(i,s){e(i,s,t)}};let ev=class{constructor(t){this.groupRenderContribitions=t,this.numberType=uu}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=Gu(u,f,p,g,h),k=Uu(u,v,p,g),M=Hu(h,c),T=Nu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Vm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Hm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===wo.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===wo.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Zh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=om.allocate(),i=om.allocate();gm(i,t,l),pm(e,h||e,i),n.modelMatrix=e,om.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&om.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};ev=Jf([La(),tv(0,Ba($a)),tv(0,Oa(ep)),Qf("design:paramtypes",[Object])],ev);var iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nv=function(t,e){return function(i,s){e(i,s,t)}};const rv=["","repeat-x","repeat-y","repeat"];let av=class extends xm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=pu,this.builtinContributions=[qm,Zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),Vm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,rv[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Bd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Zh(t).image;this._draw(t,a,!1,i)}};av=iv([La(),nv(0,Ba($a)),nv(0,Oa(ip)),sv("design:paramtypes",[Object])],av);const ov=Symbol.for("IncrementalDrawContribution"),lv=Symbol.for("ArcRender"),hv=Symbol.for("AreaRender"),cv=Symbol.for("CircleRender"),dv=Symbol.for("GraphicRender"),uv=Symbol.for("GroupRender"),pv=Symbol.for("LineRender"),gv=Symbol.for("PathRender"),mv=Symbol.for("PolygonRender"),fv=Symbol.for("RectRender"),vv=Symbol.for("SymbolRender"),_v=Symbol.for("TextRender"),yv=Symbol.for("RichTextRender"),bv=Symbol.for("GlyphRender"),xv=Symbol.for("ImageRender"),Sv=Symbol.for("DrawContribution");var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Mv=Symbol.for("DrawItemInterceptor"),Tv=new Jt,wv=new Jt;class Cv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Tv.copy(s.dirtyBounds),wv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,am.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Tv),s.backupDirtyBounds.copy(wv)),!0}}class Ev{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Pv=class{constructor(){this.order=1,this.interceptors=[new Cv,new Rv,new Bv,new Ev]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===lu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&om.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Lv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ov=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iv=function(t,e){return function(i,s){e(i,s,t)}};const Dv=Symbol.for("RenderService");let Fv=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Fv=Lv([La(),Iv(0,Ba(Sv)),Ov("design:paramtypes",[Object])],Fv);var jv=new ba((t=>{t(Dv).to(Fv)}));const zv=Symbol.for("PickerService"),Hv=Symbol.for("GlobalPickerService");var Nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Vv=Symbol.for("PickItemInterceptor");let Gv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Zh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=am.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Gv=Nv([La()],Gv);let Wv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Wv=Nv([La()],Wv);let Uv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===lu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Uv=Nv([La()],Uv);var Yv=new ba(((t,e,i)=>{i(zv)||(t(Hv).toSelf(),t(zv).toService(Hv)),t(Uv).toSelf().inSingletonScope(),t(Vv).toService(Uv),t(Gv).toSelf().inSingletonScope(),t(Vv).toService(Gv),t(Wv).toSelf().inSingletonScope(),t(Vv).toService(Wv),Za(t,Vv)})),Kv=new ba((t=>{t(xu).to(mm).inSingletonScope(),t(Su).toConstantValue(fm)}));const Xv=Symbol.for("AutoEnablePlugins"),$v=Symbol.for("PluginService");var qv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jv=function(t,e){return function(i,s){e(i,s,t)}};let Qv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Ql.isBound(Xv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Qv=qv([La(),Jv(0,Ba($a)),Jv(0,Oa(Xv)),Zv("design:paramtypes",[Object])],Qv);var t_=new ba((t=>{t($v).to(Qv),function(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).whenTargetNamed(e)}(t,Xv)})),e_=new ba((t=>{Za(t,to)})),i_=new ba((t=>{t(Zl).to(Jl).inSingletonScope(),Za(t,Zl)})),s_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let r_=class{constructor(){this.type="static",this.offscreen=!1,this.global=jl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=ih({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};r_=s_([La(),n_("design:paramtypes",[])],r_);var a_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let l_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=jl.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};l_=a_([La(),o_("design:paramtypes",[])],l_);var h_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},c_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let d_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=jl.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=ih({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};d_=h_([La(),c_("design:paramtypes",[])],d_);var u_=new ba((t=>{t(r_).toSelf(),t(d_).toSelf(),t(l_).toSelf(),t(Ru).toService(r_),t(Lu).toService(d_),t(Ou).toService(l_)}));var p_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function g_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return p_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function f_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}};let b_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Zt,this.backupDirtyBounds=new Zt,this.global=jl.global,this.layerService=jl.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Re(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Al.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Al.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,am.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=f_(e,i,Al.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Oe(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=Ff.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=am.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):g_(t,Al.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Ff.free(n),am.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Ql.get(ov);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class extends pf{constructor(){super(...arguments),this.numberType=gu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Zh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=Vu(u,p,c),_=Wu(u,g),y=Hu(c),b=Nu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};S_=x_([La()],S_);var A_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let k_=class extends Sf{constructor(){super(...arguments),this.numberType=hu}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Zh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Vu(u,d,c),m=Hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};k_=A_([La()],k_);var M_,T_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},w_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}},E_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(M_||(M_={}));let P_=class extends b_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=M_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return E_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Al.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Al.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return E_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return E_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>E_(this,void 0,void 0,(function*(){if(2!==t.count)yield m_(t,Al.zIndex,((i,s)=>{if(this.status===M_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return E_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return E_(this,void 0,void 0,(function*(){this.rendering&&(this.status=M_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=M_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return E_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>E_(this,void 0,void 0,(function*(){yield m_(t,Al.zIndex,(t=>E_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};P_=T_([La(),C_(0,Ra(dv)),C_(1,Ba(S_)),C_(2,Ba(k_)),C_(3,Ba($a)),C_(3,Oa(Mv)),w_("design:paramtypes",[Array,Object,Object,Object])],P_);var B_=new ba((t=>{t(Em).toSelf().inSingletonScope(),t(Rm).toSelf().inSingletonScope(),t(Sv).to(b_),t(ov).to(P_),t(uv).to(ev).inSingletonScope(),t(dv).toService(uv),Za(t,ep),t(Bm).toSelf().inSingletonScope(),Za(t,lp),Za(t,dv),t(Pv).toSelf().inSingletonScope(),t(Mv).toService(Pv),Za(t,Mv)}));function R_(){R_.__loaded||(R_.__loaded=!0,Ql.load(zu),Ql.load(Kv),Ql.load(jv),Ql.load(Yv),Ql.load(t_),function(t){t.load(e_),t.load(i_),t.load(u_)}(Ql),function(t){t.load(B_)}(Ql))}R_.__loaded=!1,R_();const L_=Ql.get(eo);jl.global=L_;const O_=Ql.get(Pu);jl.graphicUtil=O_;const I_=Ql.get(Eu);jl.transformUtil=I_;const D_=Ql.get(xu);jl.graphicService=D_;const F_=Ql.get(Bu);jl.layerService=F_;class j_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,jl.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),jl.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){jl.graphicService.hooks.onAttributeUpdate.taps=jl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onSetStage.taps=jl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class z_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class H_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,jl.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),jl.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){jl.graphicService.hooks.onAddIncremental.taps=jl.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onClearIncremental.taps=jl.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,jl.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class N_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onRemove.unTap(this.key),jl.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?jl.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:jl.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[si(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=si(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Zh(t).text)}getTransformOfText(t){const e=Zh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=Qe(h,c);o=t.x,l=t.y}const p=jl.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=e.viewBox,v=o+m.left-p.left+f.x1,y=l+m.top-p.top+f.y1;if(a.left=`${v}px`,a.top=`${y}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:y,left:v,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));jl.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===jl.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Al.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Al.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&jl.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===jl.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const V_=new Jt;class G_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),jl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(V_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(V_,t.parent&&t.parent.globalTransMatrix)))})),jl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),jl.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){jl.graphicService.hooks.beforeUpdateAABBBounds.taps=jl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.afterUpdateAABBBounds.taps=jl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onRemove.taps=jl.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const W_=new Jt;class U_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ya.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Jt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Zh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,jl.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),jl.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&W_.copy(s)})),jl.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(W_.equals(i)||this.tryLayout(t,!1))})),jl.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){jl.graphicService.hooks.onAttributeUpdate.taps=jl.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.beforeUpdateAABBBounds.taps=jl.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.afterUpdateAABBBounds.taps=jl.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),jl.graphicService.hooks.onSetStage.taps=jl.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const Y_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===gc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=gc.INITIAL,jl.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),jl.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:uc},{mode:"manual",cons:dc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==gc.INITIAL&&(this.status=gc.PAUSE,!0)}resume(){return this.status!==gc.INITIAL&&(this.status=gc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===gc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===gc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=gc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=gc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Y_.addTimeline(vc),Y_.setFPS(60);class K_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ud.Get(e,dd.Color1),this.ambient=i;const s=jt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Dt(It((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?ud.Get(e,dd.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function X_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function $_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class q_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=om.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=om.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})):s&&s(),i&&jl.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const ty="white";class ey extends Tu{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:ty}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new $h,this.hooks={beforeRender:new Qa(["stage"]),afterRender:new Qa(["stage"])},this.global=jl.global,!this.global.env&&J_()&&this.global.setEnv("browser"),this.window=Ql.get(Ih),this.renderService=Ql.get(Dv),this.pluginService=Ql.get($v),this.layerService=Ql.get(Bu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:ty,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Y_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new cc(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new K_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new q_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new z_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new j_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new H_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Zt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new G_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new U_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new N_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new Q_))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=Ql.get(zv));const i=this.pickerService.pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Ql.get(Ih),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ny=new ae(1,0,0,1,0,0),ry={x:0,y:0};let ay=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this.path=new pl,this._clearMatrix=new ae(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return am.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ry),function(t,e,i){return Bh(t,0,!1,e,i)}(this.path.commandList,ry.x,ry.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ry);const i=km(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Bh(t,e,!0,i,s)}(this.path.commandList,i,ry.x,ry.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ny,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>am.free(t))),this.stack.length=0}};ay=iy([La(),sy("design:paramtypes",[Object,Number])],ay);var oy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const hy={WIDTH:500,HEIGHT:500,DPR:1};let cy=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=hy.WIDTH,height:n=hy.HEIGHT,dpr:r=hy.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};cy.env="browser",cy=oy([La(),ly("design:paramtypes",[Object])],cy);var dy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uy=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Jt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};uy=dy([La()],uy);var py=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let my=class{constructor(){this._uid=ya.GenAutoIncrementId(),this.viewBox=new Jt,this.modelMatrix=new ae(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};my=py([La(),gy("design:paramtypes",[])],my);var fy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_y=function(t,e){return function(i,s){e(i,s,t)}};let yy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=jl.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Jt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ae(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=om.allocate();if(um(i,e),a){if(i){const t=om.allocate();r.modelMatrix=pm(t,a,i),om.free(i)}}else um(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Zh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Zh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&om.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),am.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function by(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&by(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&by(t,a,i,s,n))}function xy(t,e){const i=t.length-1,s=[t[0]];return by(t,0,i,e,s),s.push(t[i]),s}yy=fy([La(),_y(0,Ba($a)),_y(0,Oa(Vv)),vy("design:paramtypes",[Object])],yy);let Sy=!1;const Ay=new ba((t=>{Sy||(Sy=!0,t(rf).toSelf().inSingletonScope(),t(lv).to(rf).inSingletonScope(),t(dv).toService(lv),t(Ju).toService(Bm),Za(t,Ju))}));let ky=!1;const My=new ba((t=>{ky||(ky=!0,t(Rf).toSelf().inSingletonScope(),t(fv).to(Rf).inSingletonScope(),t(dv).toService(fv),t(Ym).toSelf(),t(Um).toSelf(),t(rp).toService(Ym),t(rp).toService(Um),t(rp).toService(Bm),Za(t,rp))}));let Ty=!1;const wy=new ba((t=>{Ty||(Ty=!0,t(pf).toSelf().inSingletonScope(),t(S_).toSelf().inSingletonScope(),t(pv).to(pf).inSingletonScope(),t(dv).toService(pv))}));let Cy=!1;const Ey=new ba((t=>{Cy||(Cy=!0,t(Sf).toSelf().inSingletonScope(),t(hv).to(Sf).inSingletonScope(),t(dv).toService(hv),t(Qu).toService(Bm),Za(t,Qu),t(k_).toSelf().inSingletonScope())}));let Py=!1;const By=new ba((t=>{Py||(Py=!0,t(Df).toSelf().inSingletonScope(),t(vv).to(Df).inSingletonScope(),t(dv).toService(vv),t(ap).toService(Bm),Za(t,ap))}));let Ry=!1;const Ly=new ba((t=>{Ry||(Ry=!0,t(hf).toSelf().inSingletonScope(),t(cv).to(hf).inSingletonScope(),t(dv).toService(cv),t(tp).toService(Bm),Za(t,tp))}));let Oy=!1;const Iy=new ba((t=>{Oy||(Oy=!0,t(_v).to(Vf).inSingletonScope(),t(dv).toService(_v),t(op).toService(Bm),Za(t,op))}));let Dy=!1;const Fy=new ba((t=>{Dy||(Dy=!0,t(Cf).toSelf().inSingletonScope(),t(gv).to(Cf).inSingletonScope(),t(dv).toService(gv),t(sp).toService(Bm),Za(t,sp))}));let jy=!1;const zy=new ba((t=>{jy||(jy=!0,t(mv).to(Zf).inSingletonScope(),t(dv).toService(mv),t(np).toService(Bm),Za(t,np))}));var Hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ny=class{constructor(){this.numberType=du}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Zh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Ny=Hy([La()],Ny);let Vy=!1;const Gy=new ba((t=>{Vy||(Vy=!0,t(bv).to(Ny).inSingletonScope(),t(dv).toService(bv))}));var Wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yy=class extends xm{constructor(){super(),this.numberType=_u,this.builtinContributions=[jf],this.init()}drawShape(t,e,i,s,n){const r=Zh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=Vu(o,l,!0),d=Vu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Zh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Vm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Zh(t).richtext;this._draw(t,s,!1,i)}};Yy=Wy([La(),Uy("design:paramtypes",[])],Yy);let Ky=!1;const Xy=new ba((t=>{Ky||(Ky=!0,t(yv).to(Yy).inSingletonScope(),t(dv).toService(yv))}));let $y=!1;const qy=new ba((t=>{$y||($y=!0,t(xv).to(av).inSingletonScope(),t(dv).toService(xv),t(ip).toService(Bm),Za(t,ip))}));const Zy=(t,e)=>(d(Qy.warnHandler)&&Qy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Jy=(t,e,i)=>{if(!d(Qy.errorHandler))throw new Error(t);Qy.errorHandler.call(null,t,e)},Qy={silent:!1,warnHandler:!1,errorHandler:!1},tb=J_(),eb=tb&&globalThis?globalThis.document:void 0;function ib(t){return("desktop-browser"===t||"mobile-browser"===t)&&tb}function sb(t){return nb(t)||"mobile-browser"===t}function nb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let rb=0;function ab(){return rb>=9999999&&(rb=0),rb++}function ob(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function lb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const hb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),cb=t=>e=>R(e,t),db=t=>{rt.getInstance().error(t)},ub=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||db("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&db("Access path missing closing bracket: "+t),a&&db("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return hb((i&&i.get||cb)(s),[n],e||n)},pb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>ub(t,e,i)));return t=>s.map((e=>e(t)))}return ub(t,e,i)};pb("id");const gb=hb((function(t){return t}),[],"identity"),mb=hb((function(){return 0}),[],"zero");hb((function(){return 1}),[],"one"),hb((function(){return!0}),[],"true"),hb((function(){return!1}),[],"false"),hb((function(){return{}}),[],"emptyObject");const fb=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>vb(t,r,n)))))},_b=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function yb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function bb(t,e,i,s,n){let r=0,a=0;return yb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function xb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;yb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:bb(t,e,i,n,h)}}function Sb(t){return"horizontal"===t}function Ab(t){return"vertical"===t}const kb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Mb extends Tu{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,kb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>kb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const Qb=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},tx=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class ex extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=rc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=rc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||Qb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=tx(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=rc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=tx(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=Qb(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=rc.now()-i>this.config.press.time&&tx(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const nx=[0,0,0];let rx=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},vl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},yl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this._clearMatrix=new ae(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ae(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return am.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(am.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Bt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Zu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&($_(nx,[t,e,i],this.modelMatrix),t=nx[0],e=nx[1],i=nx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&($_(nx,[t,e,i],this.modelMatrix),t=nx[0],e=nx[1],i=nx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&($_(nx,[e,i,s],this.modelMatrix),e=nx[0],i=nx[1],s=nx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jl.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=jl.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:bl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:bl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&($_(nx,[e,i,s],this.modelMatrix),e=nx[0],i=nx[1],s=nx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Mm(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit}=e;r.lineWidth=km(this,a,this.dpr),r.strokeStyle=Mm(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=up(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=up(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>am.free(t))),this.stack.length=0}};rx.env="browser",rx=ix([La(),sx("design:paramtypes",[Object,Number])],rx);var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=class extends cy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=jl.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new rx(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function hx(t,e){return new ba((i=>{i(th).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(eh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}lx.env="browser",lx=ax([La(),ox("design:paramtypes",[Object])],lx);const cx=hx(lx,rx);var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends yy{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Rh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fx=class{constructor(){this.type="group",this.numberType=uu}contains(t,e,i){return!1}};fx=mx([La()],fx);const vx=new ba(((t,e,i,s)=>{vx.__vloaded||(vx.__vloaded=!0,t(qb).to(fx).inSingletonScope(),t(Zb).toService(qb),Za(t,Zb))}));vx.__vloaded=!1;var _x=vx;const yx=new ba(((t,e,i,s)=>{i(gx)||t(gx).toSelf().inSingletonScope(),i(zv)?s(zv).toService(gx):t(zv).toService(gx)}));var bx,xx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ax=bx=class extends my{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${bx.idprefix}_${bx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=jl.global,this.viewBox=new Jt,this.modelMatrix=new ae(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:bx.GenerateCanvasId(),canvasControled:!0};this.canvas=new lx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new lx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Ax.env="browser",Ax.idprefix="visactor_window",Ax.prefix_count=0,Ax=bx=xx([La(),Sx("design:paramtypes",[])],Ax);const kx=new ba((t=>{t(Ax).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(Ax))).whenTargetNamed(Ax.env)}));var Mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Cx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Ex(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Px=class extends uy{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Cx(t)}return new Jt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ya.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Px=Mx([La(),Tx("design:paramtypes",[])],Px);const Bx=new ba((t=>{Bx.isBrowserBound||(Bx.isBrowserBound=!0,t(Px).toSelf().inSingletonScope(),t(to).toService(Px))}));function Rx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rx.__loaded||(Rx.__loaded=!0,t.load(Bx),t.load(cx),t.load(kx),e&&function(t){t.load(_x),t.load(yx)}(t))}Bx.isBrowserBound=!1,Rx.__loaded=!1;var Lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ix=function(t,e){return function(i,s){e(i,s,t)}};let Dx=class extends yy{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new ay(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Dx=Lx([La(),Ix(0,Ba($a)),Ix(0,Oa(Tb)),Ix(1,Ba($a)),Ix(1,Oa(Vv)),Ox("design:paramtypes",[Object,Object])],Dx);const Fx=new ba((t=>{Fx.__vloaded||(Fx.__vloaded=!0,Za(t,Tb))}));Fx.__vloaded=!1;var jx=Fx,zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Vx=zx([La(),Nx(0,Ba(lv)),Hx("design:paramtypes",[Object])],Vx);let Gx=!1;const Wx=new ba(((t,e,i,s)=>{Gx||(Gx=!0,t(wb).to(Vx).inSingletonScope(),t(Tb).toService(wb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};Xx=Ux([La(),Kx(0,Ba(hv)),Yx("design:paramtypes",[Object])],Xx);let $x=!1;const qx=new ba(((t,e,i,s)=>{$x||($x=!0,t(Cb).to(Xx).inSingletonScope(),t(Tb).toService(Cb))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,s){e(i,s,t)}};let tS=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tS=Zx([La(),Qx(0,Ba(cv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new ba(((t,e,i,s)=>{eS||(eS=!0,t(Eb).to(tS).inSingletonScope(),t(Tb).toService(Eb))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};aS=sS([La(),rS(0,Ba(bv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new ba(((t,e,i,s)=>{oS||(oS=!0,t(Fb).to(aS).inSingletonScope(),t(aS).toService(Fb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cS=class{constructor(){this.type="image",this.numberType=pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};cS=hS([La()],cS);let dS=!1;const uS=new ba(((t,e,i,s)=>{dS||(dS=!0,t(Pb).to(cS).inSingletonScope(),t(cS).toService(Pb))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=gu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};fS=pS([La(),mS(0,Ba(pv)),gS("design:paramtypes",[Object])],fS);let vS=!1;const _S=new ba(((t,e,i,s)=>{vS||(vS=!0,t(Bb).to(fS).inSingletonScope(),t(Tb).toService(Bb))}));var yS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xS=function(t,e){return function(i,s){e(i,s,t)}};let SS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};SS=yS([La(),xS(0,Ba(mv)),bS("design:paramtypes",[Object])],SS);let AS=!1;const kS=new ba(((t,e,i,s)=>{AS||(AS=!0,t(Db).to(SS).inSingletonScope(),t(Tb).toService(Db))}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};CS=MS([La(),wS(0,Ba(gv)),TS("design:paramtypes",[Object])],CS);let ES=!1;const PS=new ba(((t,e,i,s)=>{ES||(ES=!0,t(Rb).to(CS).inSingletonScope(),t(Tb).toService(Rb))}));var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LS=function(t,e){return function(i,s){e(i,s,t)}};const OS=new Jt;let IS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;OS.setValue(i.x1,i.y1,i.x2,i.y2),OS.expand(-r/2),h=!OS.containsPoint(e)}}return s.highPerformanceRestore(),h}};IS=BS([La(),LS(0,Ba(fv)),RS("design:paramtypes",[Object])],IS);let DS=!1;const FS=new ba(((t,e,i,s)=>{DS||(DS=!0,t(Lb).to(IS).inSingletonScope(),t(Tb).toService(Lb))}));let jS=!1;const zS=new ba(((t,e,i,s)=>{jS||(jS=!0,t(Pb).to(cS).inSingletonScope(),t(cS).toService(Pb))}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VS=function(t,e){return function(i,s){e(i,s,t)}};let GS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=yu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};GS=HS([La(),VS(0,Ba(vv)),NS("design:paramtypes",[Object])],GS);let WS=!1;const US=new ba(((t,e,i,s)=>{WS||(WS=!0,t(Ob).to(GS).inSingletonScope(),t(Tb).toService(Ob))}));var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KS=class{constructor(){this.type="text",this.numberType=bu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};KS=YS([La()],KS);let XS=!1;const $S=new ba(((t,e,i,s)=>{XS||(XS=!0,t(Ib).to(KS).inSingletonScope(),t(Tb).toService(Ib))})),qS=new ba(((t,e,i,s)=>{i(Dx)||t(Dx).toSelf().inSingletonScope(),i(zv)?s(zv).toService(Dx):t(zv).toService(Dx)}));var ZS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let QS=class extends rx{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};QS.env="node",QS=ZS([La(),JS("design:paramtypes",[Object,Number])],QS);var tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let iA=class extends cy{constructor(t){super(t)}init(){this._context=new QS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};iA.env="node",iA=tA([La(),eA("design:paramtypes",[Object])],iA);const sA=hx(iA,QS);var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends my{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ya.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new iA(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new iA({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};oA.env="node",oA=nA([La(),aA(0,Ba(eo)),rA("design:paramtypes",[Object])],oA);const lA=new ba((t=>{t(oA).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(oA))).whenTargetNamed(oA.env)}));var hA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cA=class extends uy{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return zc.call(t)}}getCancelAnimationFrame(){return t=>{zc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};cA=hA([La()],cA);const dA=new ba((t=>{dA.isNodeBound||(dA.isNodeBound=!0,t(cA).toSelf().inSingletonScope(),t(to).toService(cA))}));function uA(t){uA.__loaded||(uA.__loaded=!0,t.load(dA),t.load(sA),t.load(lA))}dA.isNodeBound=!1,uA.__loaded=!1;var pA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gA=class extends rx{draw(){}createPattern(t,e){return null}};gA.env="wx",gA=pA([La()],gA);var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vA=class extends cy{constructor(t){super(t)}init(){this._context=new gA(this,this._dpr)}release(){}};vA.env="wx",vA=mA([La(),fA("design:paramtypes",[Object])],vA);const _A=hx(vA,gA);var yA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xA=function(t,e){return function(i,s){e(i,s,t)}};class SA{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let AA=class extends my{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new SA}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ya.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new vA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new vA({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};AA.env="wx",AA=yA([La(),xA(0,Ba(eo)),bA("design:paramtypes",[Object])],AA);const kA=new ba((t=>{t(AA).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(AA))).whenTargetNamed(AA.env)}));var MA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wA=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let CA=class extends uy{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return wA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return zc.call(t)}}getCancelAnimationFrame(){return t=>{zc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CA=MA([La(),TA("design:paramtypes",[])],CA);const EA=new ba((t=>{EA._isWxBound||(EA._isWxBound=!0,t(CA).toSelf().inSingletonScope(),t(to).toService(CA))}));function PA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PA.__loaded||(PA.__loaded=!0,t.load(EA),t.load(_A),t.load(kA),e&&function(t){t.load(jx),t.load(qS),t.load(Wx),t.load(qx),t.load(iS),t.load(lS),t.load(uS),t.load(_S),t.load(kS),t.load(PS),t.load(FS),t.load(zS),t.load(US),t.load($S)}(t))}EA._isWxBound=!1,PA.__loaded=!1;var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};OA=BA([La(),LA(0,Ba(lv)),RA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new ba(((t,e,i,s)=>{IA||(IA=!0,t(jb).to(OA).inSingletonScope(),t(Zb).toService(jb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};const HA=new Jt;let NA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=vu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;HA.setValue(i.x1,i.y1,i.x2,i.y2),HA.expand(-r/2),h=!HA.containsPoint(e)}}return s.highPerformanceRestore(),h}};NA=FA([La(),zA(0,Ba(fv)),jA("design:paramtypes",[Object])],NA);let VA=!1;const GA=new ba(((t,e,i,s)=>{VA||(VA=!0,t(Wb).to(NA).inSingletonScope(),t(Zb).toService(Wb))}));var WA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UA=class extends xm{};UA=WA([La()],UA);var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let $A=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=gu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Zh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=km(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&om.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};$A=YA([La(),XA(0,Ba(pv)),KA("design:paramtypes",[Object])],$A);let qA=!1;const ZA=new ba(((t,e,i,s)=>{qA||(qA=!0,t(Vb).to($A).inSingletonScope(),t(Zb).toService(Vb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ek=JA([La(),tk(0,Ba(hv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new ba(((t,e,i,s)=>{ik||(ik=!0,t(zb).to(ek).inSingletonScope(),t(Zb).toService(zb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=yu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Zh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=km(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&om.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};ok=nk([La(),ak(0,Ba(vv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new ba(((t,e,i,s)=>{lk||(lk=!0,t(Ub).to(ok).inSingletonScope(),t(Zb).toService(Ub))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};pk=ck([La(),uk(0,Ba(cv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const mk=new ba(((t,e,i,s)=>{gk||(gk=!0,t(Hb).to(pk).inSingletonScope(),t(Zb).toService(Hb))}));var fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Zh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=gp(a,u,n),v=pp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&om.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};yk=fk([La(),_k(0,Ba(_v)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new ba(((t,e,i,s)=>{bk||(bk=!0,t(Yb).to(yk).inSingletonScope(),t(Zb).toService(Yb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends UA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=km(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&om.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};Mk=Sk([La(),kk(0,Ba(gv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new ba(((t,e,i,s)=>{Tk||(Tk=!0,t(Gb).to(Mk).inSingletonScope(),t(Zb).toService(Gb))}));var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Bk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=fu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Zh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=km(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};Bk=Ck([La(),Pk(0,Ba(mv)),Ek("design:paramtypes",[Object])],Bk);let Rk=!1;const Lk=new ba(((t,e,i,s)=>{Rk||(Rk=!0,t(Kb).to(Bk).inSingletonScope(),t(Zb).toService(Kb))}));var Ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Fk=Ok([La(),Dk(0,Ba(bv)),Ik("design:paramtypes",[Object])],Fk);let jk=!1;const zk=new ba(((t,e,i,s)=>{jk||(jk=!0,t($b).to(Fk).inSingletonScope(),t(Zb).toService($b))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vk=function(t,e){return function(i,s){e(i,s,t)}};let Gk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=_u}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Gk=Hk([La(),Vk(0,Ba(yv)),Nk("design:paramtypes",[Object])],Gk);let Wk=!1;const Uk=new ba(((t,e,i,s)=>{Wk||(Wk=!0,t(Xb).to(Gk).inSingletonScope(),t(Zb).toService(Xb))}));var Yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Kk=class{constructor(){this.type="image",this.numberType=pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kk=Yk([La()],Kk);let Xk=!1;const $k=new ba(((t,e,i,s)=>{Xk||(Xk=!0,t(Nb).to(Kk).inSingletonScope(),t(Zb).toService(Nb))})),qk=J_();function Zk(){Zk.__loaded||(Zk.__loaded=!0,fm.RegisterGraphicCreator("arc",Zg),Ql.load(Ay),Ql.load(qk?DA:Wx))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,fm.RegisterGraphicCreator("area",Xg),Ql.load(Ey),Ql.load(qk?sk:qx))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,fm.RegisterGraphicCreator("circle",dp),Ql.load(Ly),Ql.load(qk?mk:iS))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,fm.RegisterGraphicCreator("glyph",Bg),Ql.load(Gy),Ql.load(qk?zk:lS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,fm.RegisterGraphicCreator("group",wu))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,fm.RegisterGraphicCreator("image",Dg),Ql.load(qy),Ql.load(qk?$k:uS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,fm.RegisterGraphicCreator("line",Tg),Ql.load(wy),Ql.load(qk?ZA:_S))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,fm.RegisterGraphicCreator("path",Ug),Ql.load(Fy),Ql.load(qk?wk:PS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,fm.RegisterGraphicCreator("polygon",tm),Ql.load(zy),Ql.load(qk?Lk:kS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,fm.RegisterGraphicCreator("rect",Eg),Ql.load(My),Ql.load(qk?GA:FS))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,fm.RegisterGraphicCreator("richtext",Vg),Ql.load(Xy),Ql.load(qk?Uk:zS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,fm.RegisterGraphicCreator("shadowRoot",im))}yM.__loaded=!1;const bM=yM;function xM(){xM.__loaded||(xM.__loaded=!0,fm.RegisterGraphicCreator("symbol",Ag),Ql.load(By),Ql.load(qk?hk:US))}xM.__loaded=!1;const SM=xM;function AM(){AM.__loaded||(AM.__loaded=!0,fm.RegisterGraphicCreator("text",_p),Ql.load(Iy),Ql.load(qk?xk:$S))}AM.__loaded=!1;const kM=AM;function MM(){aM(),fM()}const TM=-.5*Math.PI,wM=1.5*Math.PI,CM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var EM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(EM||(EM={}));const PM={[EM.selectedReverse]:{},[EM.selected]:{},[EM.hover]:{},[EM.hoverReverse]:{}},BM={container:"",width:30,height:30,style:{}},RM={debounce:bt,throttle:xt};MM();let LM=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ft(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ft(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===L_.env?(L_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),L_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:RM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vt(o,s[0],s[1])}),"browser"===L_.env?(L_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),L_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",RM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ti(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ti(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function OM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&OM(t,e)}))}LM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const IM=t=>!u(t)&&!1!==t.visible;function DM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function FM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const zM=["#ffffff","#000000"];function HM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ve(t).toHex(),o=new ve(e).toHex();return NM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...zM);for(const n of a)if(t!==n&&NM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function NM(t,e,i,s,n){if("lightness"===n){const i=ve.getColorBrightness(new ve(e));return ve.getColorBrightness(new ve(t))<.5?i>=.5:i<.5}return s?VM(t,e)>s:"largeText"===i?VM(t,e)>3:VM(t,e)>4.5}function VM(t,e){const i=GM(t),s=GM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function GM(t){const e=ye(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function WM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function UM(t,e){return[t[0]*e,t[1]*e]}function YM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const KM=(t,e,i,s)=>new Je(Object.assign({defaultFontParams:Object.assign({fontFamily:CM,fontSize:14},s),getTextBounds:i?void 0:ym,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function XM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=ym({text:t,fontFamily:e.fontFamily||i.fontFamily||CM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function $M(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function qM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function ZM(t){const e=$M(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?fm.richtext(qM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),fm.text(t))}function JM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const QM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function tT(){aM(),fM(),SM(),_M(),kM()}var eT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},qM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:T,y:0});P=x.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=a,i=eT(a,["visible"]);if(m&&c(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!s,x:P.AABBBounds.x1,y:P.AABBBounds.y1,width:P.AABBBounds.width(),height:P.AABBBounds.height()}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),i.customShape){const e=i.customShape;t.pathProxy=t=>e(P.attribute,t,new pl)}this._bgRect=t}}else{const o=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:T,y:0});u(o.lineHeight)&&(o.lineHeight=n.fontSize),P=x.createOrUpdateChild("tag-text",o,"text"),B(null==f?void 0:f.text)||(P.states=f.text);const d=XM(o.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),v=d.width,C=d.height;k+=v;const E=null!==(i=r.size)&&void 0!==i?i:10,R=S(E)?E:Math.max(E[0],E[1]);M+=Math.max(C,r.visible?R:0);const{textAlign:L,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&kh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,N=eT(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},N),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),N.customShape){const e=N.customShape;t.pathProxy=t=>e(P.attribute,t,new pl)}this._bgRect=t}}this._textShape=P}}iT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const sT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},nT={poptip:z({},sT)};var rT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GAe&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce])),Se>Te&&AeCe&&MeSe&&weke&&EeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Ct/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Ct/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Ct/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Ct/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Ct/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Ct/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Ct,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Ct,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Ct,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}oT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var lT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,oT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new oT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,nT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};hT=lT([La()],hT);var cT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};dT=cT([La()],dT);let uT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};uT=cT([La()],uT);const pT=new ba(((t,e,i,s)=>{i(hT)||(t(hT).toSelf().inSingletonScope(),t(lp).toService(hT)),i(dT)||(t(dT).toSelf(),t(Xv).toService(dT)),i(uT)||(t(uT).toSelf(),t(Xv).toService(uT))}));class gT extends Mb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}aM(),cM();class mT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}mT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},aM(),fM();class fT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}fT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},aM(),Jk();class vT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=$t.distancePP(t,e);this.setAttribute("radius",i)}}vT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},aM(),Jk();class _T extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_T.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=TM,endAngle:s=wM}=this.attribute,n=s-i,r=te(se(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}_T.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},aM(),uM();class yT extends gT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ie(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=$t.distancePP(t,e);this.setAttribute("radius",i)}}yT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const bT=new Uint32Array(33),xT=new Uint32Array(33);xT[0]=0,bT[0]=~xT[0];for(let t=1;t<=32;++t)xT[t]=xT[t-1]<<1|1,bT[t]=~xT[t];function ST(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&bT[31&l]&xT[1+(31&h)])return!0}else{if(i[c]&bT[31&l])return!0;if(i[d]&xT[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,bT[31&n]&xT[1+(31&r)]);else for(s(a,bT[31&n]),s(o,xT[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,xT[31&i]|bT[1+(31&s)]);else for(n(r,xT[31&i]),n(a,bT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function AT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=ft(i,0,t.width),o=ft(s,0,t.width),l=ft(n,0,t.height),h=ft(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function kT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=AT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function MT(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return MT(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return MT(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return MT(t,e,n,s,h,c)}return!1}const wT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],CT=["top","inside-top","inside"];function ET(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const PT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function BT(t,e){var i,s;return null!==(s=null===(i=PT[e])||void 0===i?void 0:i.call(PT,t))&&void 0!==s?s:{from:{},to:{}}}const RT=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function LT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Nc({text:t.attribute.text},{text:e.attribute.text},i,s))}const OT={mode:"same-time",duration:300,easing:"linear"};function IT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function DT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function FT(t){return 3===t||4===t}function jT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const zT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},HT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function NT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function VT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}aM(),kM(),_M(),cM();class GT extends Mb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(EM.hover,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(OM(this,(t=>{B(t.states)||(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void OM(this,(t=>{B(t.states)||(t.removeState(EM.selectedReverse),t.removeState(EM.selected))}));B(e.states)||(e.addState(EM.selected,!0),OM(this,(t=>{t===e||B(t.states)||t.addState(EM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===xo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===xo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Oe(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[VT(g,m,c,d,a,o),VT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const s=fm.line({points:i});if(null==s?void 0:s.customShape){const e=s.customShape;s.pathProxy=i=>e(t.attribute,i,new pl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return ZM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))})):t.AABBBounds&&v.setRange(AT(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=t.attribute.id,d=this._isCollectionBase?c:h,u=(null==n?void 0:n.get(d))?"update":"enter";let p;if(o&&(p=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([p?{text:t,labelLine:p}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u){if(r.push(t),s.set(d,p?{text:t,labelLine:p}:{text:t}),h){const{from:i,to:s}=BT(t.attribute,"fadeIn");this.add(t),p&&(a.push(p),this.add(p)),this._syncStateWithRelatedGraphic(h),this._animationConfig.enter.duration>0&&h.once("animate-bind",(n=>{t.setAttributes(i),p&&p.setAttributes(i);const o=this._afterRelatedGraphicAttributeUpdate(t,r,p,a,e,h,s,this._animationConfig.enter);h.on("afterAttributeUpdate",o)}))}}else if("update"===u){const e=n.get(d);n.delete(d),s.set(d,e);const i=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&<(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=RT(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&<(t,e,n,r)}))})(i,t,this._animationConfig.update),e.labelLine&&p&&e.labelLine.animate().to(p.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(BT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=s}_renderWithOutAnimation(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,{visible:r}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{var e;const a=this.getRelatedGraphic(t.attribute),o=(null==n?void 0:n.get(a))?"update":"enter",l=this._isCollectionBase?t.attribute.id:a;let h;if(r&&(h=this._createLabelLine(t,a)),i&&this.updateStatesOfLabels([h?{text:t,labelLine:h}:{text:t}],null!==(e=a.currentStates)&&void 0!==e?e:[]),"enter"===o)s.set(l,h?{text:t,labelLine:h}:{text:t}),this.add(t),h&&this.add(h),this._syncStateWithRelatedGraphic(a);else if("update"===o){const e=n.get(l);n.delete(l),s.set(l,e),e.text.setAttributes(t.attribute),e.labelLine&&h&&e.labelLine.setAttributes(h.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=s}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==xo.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===xo.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,bo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}WT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class UT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=Qe(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}UT.tag="rect-label",UT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let YT=class t extends GT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class XT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let n=1/0;if(!1!==s.ellipsis){const t=this._createLabelText(s),e=this.getGraphicBounds(t);n=e.x2-e.x1}const r=e.map((t=>t.attribute)),a=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),r,i,n);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=DT(l.endAngle-d/2),p=IT(h.x,h.y,l.outerRadius,o),g=IT(h.x,h.y,a+e.line.line1MinLength,o),m=new KT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=IT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):FT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=IT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,pt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=FT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=FT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,l+c)||pt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=FT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?FT(t.quadrant)?"left":"right":FT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(FT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(ut(l/2,u))g=0,m=1,f=-p;else if(ut(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;ee(t.attribute,i,new pl)}this._setStatesOfLabelLine(p)}return p}computeRadius(t,e,i,s){return this.computeLayoutRadius(e||0,i||0)*t*(u(s)?1:s)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}XT.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,boundsPadding:[-1,0,-1,0]},position:"outside",line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0}};class $T extends GT{constructor(t){super(z({},$T.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return NT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}$T.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class qT extends GT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},qT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return zT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}qT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const ZT={rect:UT,symbol:WT,arc:XT,line:YT,area:$T,"line-data":qT};class JT extends Mb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=ST(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function QT(){aM(),cM(),gM(),SM()}function tw(){aM(),cM(),Jk(),SM()}JT.defaultAttributes={pickable:!1},QT();class ew extends Mb{getStartAngle(){return ne(this._startAngle)}getEndAngle(){return ne(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=fm.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=fm.line;Y(i)[0].cornerRadius&&(t=fm.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=fm.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}ew.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},tw();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=fm.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var sw,nw;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(sw||(sw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nw||(nw={}));const rw={[nw.selectedReverse]:{},[nw.selected]:{},[nw.hover]:{},[nw.hoverReverse]:{}},aw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},ow=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function lw(t,e,i){return!gt(t,e,0,1e-6)&&!pt(t,i,0,1e-6)}function hw(t,e,i,s){const n=ym(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=ow(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=lw(o,-l,-h)?((o+l)/c-.5)*r:lw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=lw(o,-l,-h)?.5*-a:lw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-ow(o-l)/c)*a,{x:p,y:g-m}}function cw(t){const e={};return OM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return UM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}const mw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(EM.hover,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.hoverReverse,!0)})),s):i},fw=(t,e,i)=>i?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.hoverReverse),t.removeState(EM.hover))})),null):i,vw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(EM.selected)?(OM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(EM.selectedReverse),t.removeState(EM.selected))})),null):s.name&&!B(s.states)?(s.addState(EM.selected,!0),OM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(EM.selectedReverse,!0)})),s):i};class _w extends Mb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=mw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=fm.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=fm.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=fm.group({x:0,y:0,zIndex:1});if(a.name=sw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=fm.group({x:0,y:0,pickable:!1});t.name=sw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=fm.group({x:0,y:0,pickable:!1});i.name=sw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=fm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=sw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=PM;else{const t=this.data[s],e=z({},PM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=fm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=sw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=PM;else{const i=z({},PM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=fm.group({x:0,y:0,pickable:!1});return r.name=`${sw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=ZM(this._getLabelAttribute(t,e,n,i));if(a.name=sw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=PM;else{const s=z({},PM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new iT(Object.assign({},e));i.name=sw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Rt(s[0])>Rt(s[1])?o=Ct/2*(l.x>e.x?1:-1):h=Ct/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},aw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function yw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function bw(t,e){return Oe(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ze(t,i),r=ze(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=je(t),l=je(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Qt(t.angle);let m=i?t.angle+Et:Qt(90-t.angle);const f=i?e.angle:Qt(e.angle);let v=i?e.angle+Et:Qt(90-e.angle);m>Bt&&(m-=Bt),v>Bt&&(v-=Bt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(De(n,i)+De(n,s))/2>De(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Sw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Sw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function Aw(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function Mw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Cw(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ew(t,e.attribute.angle)),{angle:ww(e.attribute.angle)}))}))}(t,e),yw(e)}function ww(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Cw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function Ew(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=ww(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Pw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return UM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Bw(){aM(),cM(),_M(),kM()}var Rw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=YM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},rw,c.text),shape:z({},rw,c.shape),panel:z({},rw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Cw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Ew(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=Qt(e)})),Tw(i,t),!Mw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(kw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),yw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:xw[n]||xw.parity;if(s.length>=3&&Aw(s,r)){do{s=a(s,r)}while(s.length>=3&&Aw(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&Sw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=fm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=sw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=XM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ti(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Lw.defaultAttributes=aw,U(Lw,Pw);class Ow{isInValidValue(t){const{startAngle:e=TM,endAngle:i=wM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=TM,endAngle:i=wM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ie(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Iw,Dw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=fm.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=fm.circle(t)}h.name=sw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},rw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Dw(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},rw,d.text),shape:z({},rw,d.shape),panel:z({},rw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return hw(t,e,i,s)}}Fw.defaultAttributes=aw,U(Fw,Ow);class jw extends _c{constructor(){super(...arguments),this.mode=Ao.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},OM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=kt.lastIndex=Mt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=kt.exec(t))&&(s=Mt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:St(i,s)})),r=Mt.lastIndex;return r{Hw[t]=!0}));const Uw=t=>-Math.log(-t),Yw=t=>-Math.exp(-t),Kw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Xw=t=>10===t?Kw:t===Math.E?Math.exp:e=>Math.pow(t,e),$w=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Zw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Jw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Qw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eC(t,e,i,s){return 1===i&&(i=0),tC(t,i,s)*(e/(1-i))}function iC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sC(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class aC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=iC(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ft(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const oC=Symbol("implicit");class lC extends aC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Iw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=oC}clone(){const t=(new lC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==oC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class cC extends lC{constructor(t){super(),this.type=Iw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=eC(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:hC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return hC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new cC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:dC}=be;function uC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ve.parseColorString(e)){const e=dC(ve.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof _e?dC(t,e):e instanceof ve?dC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class pC extends aC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ww,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ww;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Ww,this._piecewise=Qw,this._interpolate=uC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?sC:Qw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:Ww),this.rescale(i)):this._clamp!==Ww}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const gC=Math.sqrt(50),mC=Math.sqrt(10),fC=Math.sqrt(2),vC=[1,2,5,10],_C=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=SC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?bC(0,-(e-1)/s,s):bC((e-1)/s,0,s)},yC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return _C(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _C(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=bC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=bC(t,e,l);return n&&r.reverse(),r})),SC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vC[0];return i>=gC?s=vC[3]:i>=mC?s=vC[2]:i>=fC&&(s=vC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AC(t,e,i){const s=(e-t)/Math.max(0,i);return SC(s)}function kC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=AC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function TC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const wC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),EC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wC(t,e,n):wC(t,e,rC(n)),h=wC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),PC=mt(((t,e,i,s,n)=>kC(s(t),s(e),i).map((t=>rC(n(t))))));class BC extends pC{constructor(){super(...arguments),this.type=Iw.Linear}clone(){return(new BC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return yC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=xC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return kC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=TC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=MC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=MC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=MC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function RC(t){return e=>-t(-e)}function LC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class OC extends pC{constructor(){super($w(10),Xw(10)),this.type=Iw.Log,this._limit=LC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new OC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=$w(this._base),s=Xw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RC(i),this._pows=RC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Uw,this.untransformer=Yw):(this._logs=i,this._pows=s,this._limit=LC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Ww}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class IC extends BC{constructor(){super(qw(1),Zw(1)),this.type=Iw.Symlog,this._const=1}clone(){return(new IC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=qw(t),this.untransformer=Zw(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return CC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return PC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=TC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=nC(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class DC{constructor(){this.type=Iw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new DC).domain(this._domain).range(this._range).unknown(this._unknown)}}const FC=t=>t.map(((t,e)=>({index:e,value:t}))),jC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Jt(t).expand(i/2),n=new Jt(e).expand(i/2);return s.intersects(n)};function zC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function HC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=Qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=KM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=NC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=NC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=NC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=NC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Jt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},GC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=ie({x:0,y:0},i,t),l=dw(o,uw(s,o,e,n));return hw(l,uw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Jt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},WC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},UC=(t,e,i,s)=>VC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),YC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},KC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!YC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?KC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&jC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qC=(t,e)=>{if(Nw(t.type))return((t,e)=>{if(!Nw(t.type))return FC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return FC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=VC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&HC(n,i);)n=WC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return FC(h)})(t,e);if(Gw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?FC([s[s.length-1]]):FC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=UC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=XC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=UC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return FC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=GC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=$C(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return FC(c)})(t,e)}return FC(t.domain())};function ZC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=$t.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function JC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=$t.distancePP(s,l),c=$t.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=ZC(e,t,!1,!!n),o=ZC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class QC extends Mb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=fm.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${sw.grid}-sub`:`${sw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=ZC(t,o,!1,!!a)}const u=fm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=gw(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=fm.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Ct/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:QC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(tE,Pw);var eE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(iE,Ow);const sE="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",nE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:sE,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},rE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var aE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(aE||(aE={}));var oE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=aE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=aE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=aE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=aE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===L_.env&&(L_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===aE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===aE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=aE.endHandler):h+=l:this._activeTag===aE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===aE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===L_.env&&(L_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ft(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ft(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===aE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=oE(i,["formatMethod"]),{formatMethod:a}=s,o=oE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Zt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},rE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},rE.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},rE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},rE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},rE.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},rE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return xy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new iT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var cE,dE,uE,pE;function gE(){aM(),tT()}function mE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function fE(t,e){const{dx:i,dy:s}=mE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}hE.defaultAttributes=nE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(cE||(cE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(dE||(dE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(uE||(uE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(pE||(pE={}));class vE extends Mb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=mw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=fw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=vw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=fm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=fm.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=fm.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function _E(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function yE(t,e,i,s){t&&(_E(t.startSymbol,e,i,s),t.lines.forEach((t=>_E(t,e,i,s))),_E(t.line,e,i,s),_E(t.endSymbol,e,i,s))}function bE(t,e,i,s){t&&(_E(t.getTextShape(),e,i,s),_E(t.getBgRect(),e,i,s))}function xE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function SE(t,e,i,s){t&&(xE(t.startSymbol,e,i,s),t.lines.forEach((t=>xE(t,e,i,s))),xE(t.line,e,i,s),xE(t.endSymbol,e,i,s))}function AE(t,e,i,s){t&&(xE(t.getTextShape(),e,i,s),xE(t.getBgRect(),e,i,s))}function kE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;_E(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),_E(t.endSymbol,s+r+a,o,n),_E(e.getTextShape(),s+r+a+o,l,n),_E(e.getBgRect(),s+r+a+o,l,n)}function ME(t,e,i,s,n){yE(t,s,i,n),bE(e,s,i,n)}function TE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function wE(t,e,i,s,n){_E(t,s,i,n),bE(e,s,i,n)}function CE(t,e,i,s,n,r){var a;yE(t,n,s,r),_E(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?bE(i,n,s,r):_E(i,n,s,r)}function EE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;_E(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),_E(e,n+o+l,h,r),_E(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(_E(i.getTextShape(),n+o+l+h+c,d,r),_E(i.getBgRect(),n+o+l+c,d,r)):_E(i,n+o+l+c,d,r)}function PE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?kE(t,e,s,r,a):"fadeIn"===i&&ME(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?kE(t,e,s,n,a):"fadeIn"===i&&ME(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function BE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&TE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function RE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&wE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&wE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){xE(t,s,i,n),AE(e,s,i,n)}(t,e,i,s,n)}}function LE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?CE(n,r,e,i,s,o):"callIn"===t&&EE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?CE(n,r,e,i,s,a):"callIn"===t&&EE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;SE(t,n,s,r),xE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AE(i,n,s,r):xE(i,n,s,r)}(n,r,e,t,i,s)}}const OE={type:"clipIn",duration:500,easing:"linear",delay:0},IE={type:"fadeIn",duration:500,easing:"linear",delay:0},DE={type:"callIn",duration:500,easing:"linear",delay:0},FE={type:"fadeOut",duration:500,easing:"linear",delay:0};class jE extends vE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=OE,this.defaultExitAnimation=FE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;fE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new iT(Object.assign(Object.assign({},e),{state:{panel:z({},PM,null==i?void 0:i.labelBackground),text:z({},PM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},PM,null==e?void 0:e.labelBackground),text:z({},PM,null==e?void 0:e.label)}})),this.setLabelPos())}}const zE=.001,HE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:cE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},NE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},VE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:uE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},GE={interactive:!0,label:{position:dE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},WE={interactive:!0,label:{position:uE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},UE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},YE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},KE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function XE(){$E._animate=PE}gE(),QT();class $E extends jE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$E.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(DM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return FM(Math.abs(e),Math.PI/2,zE)||FM(Math.abs(e),3*Math.PI/2,zE)?jM(i,e,t):DM(e)?NE.postiveXAxis[t]:NE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},PM,null==a?void 0:a.line),startSymbol:z({},PM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},PM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function qE(){ZE._animate=BE}$E.defaultAttributes=HE,gE(),gM();class ZE extends vE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},YE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=fm.polygon(Object.assign({points:e},s));r.states=z({},PM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==n?void 0:n.labelBackground),text:z({},PM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},PM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},PM,null==s?void 0:s.labelBackground),text:z({},PM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}ZE.defaultAttributes=GE,gE(),tw();class JE extends jE{markerAnimate(t){JE._animate&&this._animationConfig&&JE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case uE.arcInnerStart:l=s;case uE.arcOuterStart:l=s;break;case uE.arcInnerEnd:l=n;case uE.arcOuterEnd:l=n;break;case uE.center:case uE.arcInnerMiddle:case uE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return UE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new iw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},PM,null==o?void 0:o.line),startSymbol:z({},PM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},PM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}JE.defaultAttributes=VE,gE(),Jk();class QE extends vE{markerAnimate(t){QE._animate&&this._animationConfig&&QE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=IE,this.defaultExitAnimation=FE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case uE.center:h=(i+s)/2,c=(n+r)/2;break;case uE.arcInnerStart:h=i,c=n;break;case uE.arcOuterStart:h=s,c=n;break;case uE.arcInnerEnd:h=i,c=r;break;case uE.arcOuterEnd:h=s,c=r;break;case uE.arcInnerMiddle:h=i,c=(n+r)/2;break;case uE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},UE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;fE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=fm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},PM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new iT(Object.assign(Object.assign({},o),{state:{panel:z({},PM,null==l?void 0:l.labelBackground),text:z({},PM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},PM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},PM,null==o?void 0:o.labelBackground),text:z({},PM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function tP(){eP._animate=LE}QE.defaultAttributes=WE,gE(),QT(),tw(),SM(),lM(),cM();class eP extends vE{markerAnimate(t){eP._animate&&this._animationConfig&&eP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=DE,this.defaultExitAnimation=FE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return FM(Math.abs(s),Math.PI/2,zE)||FM(Math.abs(s),3*Math.PI/2,zE)?jM(t,s,n):DM(s)?KE.postiveXAxis[n]:KE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=pE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},PM,null==m?void 0:m.textBackground),text:z({},PM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},PM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},PM,null==m?void 0:m.image));const y=DM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=fm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},PM,null==s?void 0:s.symbol)):"text"===n?h=new iT(Object.assign(Object.assign({},i),{state:{panel:z({},PM,null==s?void 0:s.textBackground),text:z({},PM,null==s?void 0:s.text)}})):"richText"===n?(h=fm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},PM,null==s?void 0:s.richText)):"image"===n?(h=fm.image(Object.assign(Object.assign({},i),o)),h.states=z({},PM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},PM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=FM(c,0,zE)||FM(d,0,zE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=QM(s-p,t-u),o=QM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(cP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(cP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===cP.focus||"focus"===o){const s=a.hasState(lP.focus);a.toggleState(lP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover,lP.focus],t),this._setLegendItemState(e,lP.selected,t)})):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover,lP.focus],t),this._setLegendItemState(e,lP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(lP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(lP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(hP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[lP.selected,lP.selectedHover],t),this._setLegendItemState(a,lP.unSelected,t)):(this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t))}else this._setLegendItemState(a,lP.selected,t),this._removeLegendItemState(a,[lP.unSelected,lP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[lP.selected,lP.selectedHover],t),this._setLegendItemState(e,lP.unSelected,t))}))}this._dispatchLegendEvent(hP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,lP.selected),this._removeLegendItemState(e,[lP.unSelected,lP.unSelectedHover])):(this._removeLegendItemState(e,[lP.selected,lP.selectedHover]),this._setLegendItemState(e,lP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=rP,spaceRow:h=aP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):n<=f?(A+=1,_=!0,S=0,t>0&&(x+=k+l)):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ti(c);let w;!1===x.visible?(w=fm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,cP.item,t,w)):(w=fm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,cP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?lP.selected:lP.unSelected);const C=fm.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=fm.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,cP.itemShape,t,w,S.state),s.addState(e?lP.selected:lP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=fm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,cP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=ZM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,cP.itemLabel,t,w,A.state),D.addState(e?lP.selected:lP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=ZM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,cP.itemValue,t,w,k.state),r.addState(e?lP.selected:lP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new nP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new nP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new LM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new LM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=fm.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=rP,spaceRow:a=aP}=s,o=this._itemsContainer,{space:l=oP,defaultCurrent:h=1}=n,c=gP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=fm.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(lP.selected)?this._setLegendItemState(t,lP.selectedHover,e):this._setLegendItemState(t,lP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===cP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(hP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(lP.unSelectedHover)||t.hasState(lP.selectedHover))&&(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(lP.unSelectedHover)&&!t.hasState(lP.selectedHover)||(i=!0),t.removeState(lP.unSelectedHover),t.removeState(lP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===cP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(hP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==cP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(hP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(lP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},mP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(lP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var vP;function _P(t){return y(t)?t:[t,t]}function yP(t){return t?"ew-resize":"ns-resize"}fP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:rP,spaceRow:aP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:oP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(vP||(vP={})),uP();class bP extends Mb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},bP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=ft(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===L_.env?(L_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=ft(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===L_.env?(L_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),L_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===L_.env?(L_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),L_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?ft(t+p,h,c):ft(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?ft(t+p,0,c-h):ft(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===L_.env?(L_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),L_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:_P(d)[0],endValue:_P(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=fm.group({x:0,y:0});m.name=vP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=fm.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=vP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=fm.group({x:g?v:0,y:g?0:v});m.add(_);const y=fm.group({x:0,y:0});let b;if(y.name=vP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=fm.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=vP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=fm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=vP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=_P(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(v.name=vP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=vP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":yP(p)},r));if(i.name=vP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=vP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=vt(h,i,s);c=t[0],d=t[1]}else c=i,d=ft(h,i,s);const p=this._isHorizontal;e||(c=i);const m=fm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=vP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":yP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=fm.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=vP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return fm.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":yP(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),fm.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=fm.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=fm.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===vP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===vP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===vP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===vP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}bP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},pP(),uP();class xP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function SP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}xP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},pP(),uP(),uM();class AP extends dP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},AP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=fm.group({x:0,y:0});this._innerView.add(x);const S=new bP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:SP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=fm.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}AP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},aM(),kM(),_M();let kP=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,N,V,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ti(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},BM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},BM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(N=K.width)&&void 0!==N?N:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(V=$.width)&&void 0!==V?V:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};kP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const MP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};aM(),kM(),_M();let TP=class extends Mb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(MP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=ZM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:e={},content:i,size:s,limitRatio:n=1/0}=this.attribute,r=Math.min(s.width,s.height)*n,a=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(p(e)&&(this._title=this._renderText(a,e,r,n,"title.style","indicator-title")),p(i)){const t=Y(i),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(a,t,r,n,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(r),this._setYPosition();const o=null!==(t=null==a?void 0:a.AABBBounds.height())&&void 0!==t?t:0;a.setAttribute("y",s.height/2-o/2),a.setAttribute("x",s.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=XM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class wP extends Sg{constructor(t){super(t)}}var CP,EP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(CP||(CP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(EP||(EP={}));class PP extends Mb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},PP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},PP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},PP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new wP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new wP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new wP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(CP.OnPlay)},this.pause=()=>{this._dispatchEvent(CP.OnPause)},this.forward=()=>{this._dispatchEvent(CP.OnForward)},this.backward=()=>{this._dispatchEvent(CP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}PP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},PP.defaultAttributes={[EP.Start]:{},[EP.Pause]:{},[EP.Backward]:{},[EP.Forward]:{}};const BP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},RP=[200,10];var LP,OP;!function(t){t.Default="default",t.Reverse="reverse"}(LP||(LP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(OP||(OP={}));const IP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},DP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===LP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===LP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},FP=t=>"top"===t||"bottom"===t;class jP extends Mb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=It(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(FP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:RP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:RP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new bP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return FP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new PP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=FP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:RP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:It(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(FP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:It(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:FP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:FP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:It(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:FP(this._orient)?t+s:(this._size.width-r)/2,y:FP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function zP(){uP(),aM(),SM()}jP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},BP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},BP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},BP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},BP),{key:"backward",position:"start"})}},zP();class HP extends jP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:LP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(OP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(IP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||DP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===LP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(OP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(OP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(OP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),L_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,L_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(OP.change),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var NP,VP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};zP();class GP extends jP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(CP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(CP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(CP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(CP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(OP.change))},this.play=()=>VP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(OP.play),this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=L_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,L_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,L_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(OP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(OP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(OP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(NP||(NP={}));const WP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},UP=5;const YP={debounce:bt,throttle:xt};aM(),gM();let KP=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:YP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(NP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(NP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(NP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=WP.trigger,updateTrigger:e=WP.updateTrigger,endTrigger:i=WP.endTrigger,resetTrigger:s=WP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Ke(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(NP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(NP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=UP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(NP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=fm.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},$P=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},qP={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:CM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:CM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Jt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ZP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];aM(),fM(),SM(),kM(),_M();let JP=class t extends Mb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ti(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:IM(u)&&IM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:IM(u)&&IM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:IM(u)&&IM(u.value)},$P(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},BM),u.value),visible:IM(u)&&IM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=IM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=IM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!IM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(IM(n.key)?r+n.key.spacing:0)+(IM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(JM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:IM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),JM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(IM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Hc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(IM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},BM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(IM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$P(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>ZP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&IM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=IM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=KM(u),y=KM(p);let b=0;if(IM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(IM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&_g[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return XP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return XP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};JP.defaultAttributes=qP;const QP=ut;function tB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function eB(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function iB(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function sB(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function nB(t,e){const i=sB(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function rB(t,e){const i=aB(t),s=aB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function aB(t,e={x:0,y:0}){return $t.distancePP(t,e)}function oB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function lB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const hB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var dB,uB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(dB||(dB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(uB||(uB={}));const pB="__VCHART",gB=500,mB=500,fB=`${pB}_LABEL_LIMIT`,vB=`${pB}_LABEL_ALIGN`,_B=`${pB}_LABEL_TEXT`,yB=`${pB}_LABEL_VISIBLE`,bB=`${pB}_LABEL_X`,xB=`${pB}_LABEL_Y`,SB=`${pB}_ARC_TRANSFORM_VALUE`,AB=`${pB}_ARC_RATIO`,kB=`${pB}_ARC_START_ANGLE`,MB=`${pB}_ARC_END_ANGLE`,TB=`${pB}_ARC_K`,wB=`${pB}_ARC_MIDDLE_ANGLE`,CB=`${pB}_ARC_QUADRANT`,EB=`${pB}_ARC_RADIAN`,PB=-Math.PI/2,BB=3*Math.PI/2,RB=-90,LB=.6;var OB,IB,DB,FB,jB,zB,HB,NB,VB,GB,WB,UB,YB,KB,XB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(OB||(OB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(IB||(IB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(DB||(DB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(FB||(FB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(jB||(jB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(zB||(zB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(HB||(HB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(NB||(NB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(VB||(VB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(GB||(GB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(WB||(WB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(UB||(UB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(YB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",YB.AFTER_EVALUATE_DATA="afterEvaluateData",YB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",YB.AFTER_EVALUATE_SCALE="afterEvaluateScale",YB.BEFORE_PARSE_VIEW="beforeParseView",YB.AFTER_PARSE_VIEW="afterParseView",YB.BEFORE_TRANSFORM="beforeTransform",YB.AFTER_TRANSFORM="afterTransform",YB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",YB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",YB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",YB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",YB.BEFORE_STAGE_RESIZE="beforeStageResize",YB.AFTER_STAGE_RESIZE="afterStageResize",YB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",YB.AFTER_VRENDER_DRAW="afterVRenderDraw",YB.BEFORE_MARK_JOIN="beforeMarkJoin",YB.AFTER_MARK_JOIN="afterMarkJoin",YB.BEFORE_MARK_UPDATE="beforeMarkUpdate",YB.AFTER_MARK_UPDATE="afterMarkUpdate",YB.BEFORE_MARK_STATE="beforeMarkState",YB.AFTER_MARK_STATE="afterMarkState",YB.BEFORE_MARK_ENCODE="beforeMarkEncode",YB.AFTER_MARK_ENCODE="afterMarkEncode",YB.BEFORE_DO_LAYOUT="beforeDoLayout",YB.AFTER_DO_LAYOUT="afterDoLayout",YB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",YB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",YB.BEFORE_DO_RENDER="beforeDoRender",YB.AFTER_DO_RENDER="afterDoRender",YB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",YB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",YB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",YB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",YB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",YB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",YB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",YB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",YB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",YB.BEFORE_ELEMENT_STATE="beforeElementState",YB.AFTER_ELEMENT_STATE="afterElementState",YB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",YB.AFTER_ELEMENT_ENCODE="afterElementEncode",YB.ANIMATION_START="animationStart",YB.ANIMATION_END="animationEnd",YB.ELEMENT_ANIMATION_START="elementAnimationStart",YB.ELEMENT_ANIMATION_END="elementAnimationEnd",YB.ALL_ANIMATION_START="allAnimationStart",YB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(KB||(KB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(XB||(XB={}));const $B="__vgrammar_scene_item__",qB=[DB.line,DB.area],ZB=[DB.arc3d,DB.rect3d,DB.pyramid3d],JB="key",QB=[{}],tR=["key"],eR=!0,iR=!0,sR=!1,nR=!0,rR="VGRAMMAR_IMMEDIATE_ANIMATION",aR=0,oR=1e3,lR=0,hR=0,cR=!1,dR=!1,uR="quintInOut",pR={stopWhenStateChange:!1,immediatelyApply:!0},gR="_mo_hide_";function mR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function fR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return mR(t.dependency,e);var i;return[]}function vR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function _R(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function yR(t,e){return bR(t)?t.output():e[t]}const bR=t=>t&&!u(t.grammarType),xR=t=>d(t)?t:e=>e[t];function SR(t){return!!(null==t?void 0:t.scale)}function AR(t){return!!(null==t?void 0:t.field)}function kR(t,e){if(!t)return[];let i=[];return t.scale&&(i=bR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(fR(t,e))}function MR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function TR(t,e,i,s,n){i&&(vR(i)?e.forEach((e=>{const n=_R(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case DB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case DB.group:case DB.rect:case DB.image:return["width","height","y1"].includes(e);case DB.path:case DB.shape:return["path","customPath"].includes(e);case DB.line:return"defined"===e;case DB.area:return["x1","y1","defined"].includes(e);case DB.rule:return["x1","y1"].includes(e);case DB.symbol:return"size"===e;case DB.polygon:return"points"===e;case DB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(SR(l)){const t=yR(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?pb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(AR(l)){const t=pb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=_R(l,s,e.datum,t)}))})))}function wR(t,e,i,s){if(!t)return null;if(vR(t))return _R(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(SR(h)){const t=yR(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?pb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(AR(h)){const t=pb(h.field);n[r]=t(e)}else n[r]=_R(h,s,e,i)})),n}class CR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let ER=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};ER._plotMarks={},ER._marks={},ER._components={},ER._graphicComponents={},ER._transforms={},ER._grammars={},ER._glyphs={},ER._animations={},ER._interactions={},ER._graphics={},ER.registerGlyph=(t,e,i,s,n)=>(ER._glyphs[t]=new CR(e,i,s,n),ER._glyphs[t]),ER.registerAnimationType=(t,e)=>{ER._animations[t]=e},ER.getAnimationType=t=>ER._animations[t],ER.registerInteraction=(t,e)=>{ER._interactions[t]=e},ER.registerGraphic=(t,e)=>{ER._graphics[t]=e},ER.getGraphicType=t=>ER._graphics[t],ER.createGraphic=(t,e)=>{const i=ER._graphics[t];return i?i(e):null};const PR=t=>!!DB[t];function BR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=ER.getGraphicType(e)?ER.createGraphic(e,i):ER.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||rt.getInstance().error(`create ${e} graphic failed!`),n}const RR=t=>{t&&(t[$B]=null,t.release(),t.parent&&t.parent.removeChild(t))},LR=["fillOpacity"],OR=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const IR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[DB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[DB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[DB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const DR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?IR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(LR.includes(r)?OR(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{LR.includes(t)?OR(n,t,e):n[t]=e[t]}));return n},FR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),jR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],zR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(jR);function HR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?zR:jR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>FR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=NR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function NR(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let VR=class{constructor(t){this.data=null,this.states=[],this.diffState=IB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));TR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?DR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[$B]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?DR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===IB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(RR(this.graphicItem),this.graphicItem[$B]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=xR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(_R(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===IB.unChange&&(this.diffState=IB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,gR in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[gR],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||this.useStates(this.states),this.mark.markType===DB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[OB.update],a=e[OB.enter],o=e[OB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===IB.enter?(a&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.update?((n&&a||i)&&TR(this,t,a,s,l),r&&TR(this,t,r,s,l)):this.diffState===IB.exit&&o&&(i&&TR(this,t,a,s,l),TR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)vb(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[DB.line,DB.area,DB.largeRects,DB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||MR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[OB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=NR(h),e===DB.line||e===DB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>MR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===DB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=HR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=NR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?HR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=wR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=HR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===DB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===DB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(RR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class GR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const WR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class UR extends GR{constructor(t,e){super(t,e),this.type=UR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}UR.type="element-select",UR.defaultOptions={state:XB.selected,trigger:"click"};class YR extends GR{constructor(t,e){super(t,e),this.type=YR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},YR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function KR(t){if(t)return t.type===Iw.Band?t.bandwidth():t.type===Iw.Point?t.step():void 0}YR.type="element-highlight",YR.defaultOptions={highlightState:XB.highlight,blurState:XB.blur,trigger:"pointerover",triggerOff:"pointerout"};class XR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const $R=()=>{U(UR,XR),ER.registerInteraction(UR.type,UR)},qR=()=>{U(YR,XR),ER.registerInteraction(YR.type,YR)},ZR=(t,e)=>bR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,JR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=ZR(n,e),i}),{}):t.map((t=>ZR(t,e))):t;let QR=-1;class tL extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++QR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(fR(this.spec[e],this.view)),this.spec[e]=t,this.attach(fR(t,this.view)),this.commit(),this}}const eL=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=fR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},iL=(t,e)=>{const i=ER.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(mR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>eL(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return eL(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},sL=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=iL(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},nL={csv:Ur,dsv:Wr,tsv:Yr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class rL extends tL{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!nL[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return nL[e.type](t,i,new _a(new fa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?fR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=fR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=fR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=bR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=sL(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const aL="window",oL="view",lL={trap:!1},hL="width",cL="height",dL="viewWidth",uL="viewHeight",pL="padding",gL="viewBox",mL="autoFit";function fL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function vL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,fL(t,e,n,s)}class _L{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}return this.nodes.push(t),fL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),fL(this.nodes,e,0,this.compare),vL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,vL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class yL{constructor(t){this.list=[],this.ids={},this.idFunc=t||gb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class bL{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new yL((t=>t.uid)),this._heap=new _L(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new yL((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const xL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===DB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class SL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Jd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{jl.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new ey(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Jb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new ex(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function AL(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function kL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function ML(t,e,i,s,n){if(n===aL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{kL(t,AL(t),!1)}))}));const e=AL(t);kL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class TL extends tL{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?_R(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},PL=(t,e)=>e&&e.debounce?bt(t,e.debounce):e&&e.throttle?xt(t,e.throttle):t;class BL extends VR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return TR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[$B]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?DR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem||this.initGraphicItem(),this.diffState===IB.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==IB.enter&&this.diffState!==IB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=DR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=IR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===DB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return qB.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)vb(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[$B]=null})),this.glyphGraphicItems=null),super.release()}}const RL=t=>t.markType===DB.glyph?new BL(t):new VR(t);function LL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(JB,i?t.slice().sort(i):t.slice()),{keys:tR,data:s};const n=xR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class OL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?LL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const IL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=MR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const DL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class FL extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class jL extends _c{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Hd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:xo.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}bc.mode|=Ao.SET_ATTR_IMMEDIATELY;let zL=0;const HL=t=>{var e;if(u(t)||u(t.prototype))return!1;const i=null!==(e=t.prototype)&&void 0!==e?e:{};return i instanceof _c||"onBind"in i&&"onStart"in i&&"onEnd"in i&&"onUpdate"in i};class NL{constructor(t,e,i){this.id=zL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!ER.getAnimationType(e.type))return null;const r=ER.getAnimationType(e.type)(t,n,i);return IL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?DL(t,0,n[i].from,0,s):void 0,e.to[i]=l?DL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),IL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=HL(o);return u(o)||HL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new jL(r.from,r.to,a,t.easing):void 0:new FL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new Xc(a,e))}r>0&&t.wait(r)}}function VL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(GL(i,t[i]))})),e}function GL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:aR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:dR,loop:null!==(s=h.loop)&&void 0!==s?s:cR,controlOptions:z({},pR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:oR,delay:null!==(a=h.delay)&&void 0!==a?a:lR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:hR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:uR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:aR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:dR,loop:null!==(d=t.loop)&&void 0!==d?d:cR,controlOptions:z({},pR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:lR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:hR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:uR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function WL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class UL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class YL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=VL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=VL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==IB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=GL(rR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new UL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===IB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new NL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===IB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=_R(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=WL(t.startTime,e,n),o=WL(t.totalTime,e,n),l=WL(t.oneByOne,e,n),h=WL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=WL(t.delay,e,n),l=WL(t.delayAfter,e,n),h=null!==(i=WL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:WL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===IB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===IB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===rR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===IB.exit&&0===o[IB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class KL extends tL{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new YL(this,{}),this.differ=new OL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===IB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===UB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:QB,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===DB.group)return;const e=LL(null!=t?t:QB,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(IB.update,t,e,i)}encodeState(t,e,i,s){if(t===IB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(vR(n))this.detach(kR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(kR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(kR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(kR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(kR(i,this.view))):vR(e)?(this.spec.encode[t]=e,this.attach(kR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(kR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=sL(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=sL(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return qB.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==IB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===KB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!vR(n)&&Object.keys(n).forEach((t=>{SR(n[t])&&(e[t]=yR(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];vR(s)||Object.keys(s).forEach((t=>{AR(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B];if((null==s?void 0:s.mark)===this){const i=ML(this.view,t,s,0,oL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new YL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=yR(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==DB.group){if(!this.graphicItem){const t=BR(this,DB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||ZB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==DB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=xR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>JB),a=xR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>JB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===IB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=IB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):RL(this),n.diffState===IB.exit&&(n.diffState=IB.enter,this.animate.getElementAnimators(n,IB.exit).forEach((t=>t.stop("start")))),n.diffState=IB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=IB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:QB;l||this.differ.setCurrentData(LL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=wR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{this.markType===DB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&p(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:BR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==DB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=xR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>JB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=RL(this);e.diffState=IB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=RL(this);i.diffState=IB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==DB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=BR(this,DB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==IB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:IR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=IB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&RR(this.graphicItem),this.detachAll(),super.release()}}let XL=class extends KL{constructor(t,e){super(t,DB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===DB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return IR.rect}evaluateJoin(t){if(!this.elements.length){const t=RL(this);t.updateData(JB,QB,(()=>""),this.view),this.elements=[t],this.elementMap.set(JB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return TR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[OB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:BR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function $L(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function qL(t,e){return Math.min(t<0?t+e:t-1,e)}function ZL(t,e,i){let s=qL(t,i),n=qL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=qL(Math.max(0,n-1),i)):n=qL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const JL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>$L(t,i))),u=l.map((t=>$L(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=ZL(e,i,r),{start:h,end:c}=ZL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Zt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},QL={[FB.axis]:0,[FB.legend]:1,[FB.slider]:2,[FB.player]:3,[FB.datazoom]:4},tO=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=QL[t.componentType])&&void 0!==s?s:1/0},eO=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=_b(r.maxChildWidth,n.width()),o=_b(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=EL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&dtO(t)-tO(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==DB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=eO(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(dL,o),i.updateSignal(uL,l),i.updateSignal(pL,h)}else eO(t,n,a,e);else"grid"===r.display&&JL(t,n,a);iO(n,e,i)}}))};class sO extends KL{constructor(t,e,i){super(t,DB.glyph,i),this.glyphType=e,this.glyphMeta=ER.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!ER.getGraphicType(DB.glyph))return;const s=ER.createGraphic(DB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(ER.getGraphicType(n[t])){const e=ER.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const nO=Symbol.for("key");class rO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==DB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=LL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=LL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=xR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new OL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(LL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:nO})),r=LL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:nO}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==nO){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=_R(i.animation.delay,n,o,l),d=_R(i.animation.duration,n,o,l),u=_R(i.animation.oneByOne,n,o,l),p=_R(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Ed:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Pd)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Md(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Ed:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Pd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>xd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Ad(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:xo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new kd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mc,null!==(l=i.easing)&&void 0!==l?l:Tc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:xo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Td({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Tc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Md(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class aO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class oO extends aO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===DB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===DB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===DB.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===DB.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class lO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class hO extends KL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=BR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?DB.richtext:DB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}hO.markType=DB.text;const cO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},dO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},uO=Object.assign({},cO);uO.axis=Object.assign({},uO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.circleAxis=Object.assign({},uO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),uO.grid=Object.assign({},uO.grid,{style:{stroke:"#404349"}}),uO.circleGrid=Object.assign({},uO.circleGrid,{style:{stroke:"#404349"}}),uO.rectLabel=Object.assign({},uO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.lineLabel=Object.assign({},uO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.symbolLabel=Object.assign({},uO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),uO.title=Object.assign({},uO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const pO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:dO,components:uO},gO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:dO,components:cO};let mO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};mO._themes=new Map,mO.registerTheme("default",gO),mO.registerTheme("dark",pO);class fO extends KL{constructor(t,e,i,s){super(t,DB.component,i),this._componentDatum={[JB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:ER.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,JB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[JB]+=1}evaluateJoin(t){return this.spec.key=JB,t?(t[JB]=this._componentDatum[JB],this._componentDatum=t):this._componentDatum={[JB]:this._componentDatum[JB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class vO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=bt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[$B],n=ML(0,t,s,0,oL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(bR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):PR(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new TL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new rL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=ER.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=ER.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case DB.group:n=new XL(this,s);break;case DB.glyph:n=new sO(this,null==i?void 0:i.glyphType,s);break;case DB.component:n=ER.hasComponent(null==i?void 0:i.componentType)?ER.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new fO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case DB.text:n=new hO(this,t,s);break;default:n=ER.hasMark(t)?ER.createMark(t,this,s):new KL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(DB.group,t)}glyph(t,e){return this.mark(DB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(DB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(DB.component,t,{componentType:FB.grid,mode:e})}legend(t){return this.mark(DB.component,t,{componentType:FB.legend})}slider(t){return this.mark(DB.component,t,{componentType:FB.slider})}label(t){return this.mark(DB.component,t,{componentType:FB.label})}datazoom(t){return this.mark(DB.component,t,{componentType:FB.datazoom})}player(t){return this.mark(DB.component,t,{componentType:FB.player})}title(t){return this.mark(DB.component,t,{componentType:FB.title})}scrollbar(t){return this.mark(DB.component,t,{componentType:FB.scrollbar})}customized(t,e){const i=ER.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&CL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(RR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++wL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(mO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(hL,t.width),this.updateSignal(cL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=ER.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:hL,value:null!==(s=t[hL])&&void 0!==s?s:0},{id:cL,value:null!==(n=t[cL])&&void 0!==n?n:0},{id:pL,value:EL(null!==(a=null!==(r=t[pL])&&void 0!==r?r:e[pL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:dL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[hL]-i.left-i.right},dependency:[hL,pL]}},{id:uL,update:{callback:(t,e)=>{const i=EL(e[pL]);return e[cL]-i.top-i.bottom},dependency:[cL,pL]}},{id:gL,update:{callback:(t,e)=>{const i=EL(e[pL]);return(t||new Zt).setValue(i.left,i.top,i.left+e[dL],i.top+e[uL])},dependency:[dL,uL,pL]}},{id:mL,value:null!==(o=t[mL])&&void 0!==o?o:e[mL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===DB.glyph?{glyphType:t.glyphType}:t.type===DB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=mO.getTheme(t))&&void 0!==e?e:mO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(hL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(cL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(dL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(uL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(pL);if(arguments.length){const i=EL(t);return this.updateSignal(e,i),i}return EL(e.output())}autoFit(t){const e=this.getSignalById(mL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(gL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=UB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===DB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||iO;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{xL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),xL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=eR,morph:o=iR,morphAll:l=sR,animation:h={},enableExitAnimation:c=nR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:uR,delay:null!==(i=h.delay)&&void 0!==i?i:lR,duration:null!==(s=h.duration)&&void 0!==s?s:oR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:dR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=UB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=UB.reevaluate,this._dataflow.evaluate()),this._layoutState=UB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!CL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return xL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ei(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(hL,t)),e!==this.height()&&(s=!0,this.updateSignal(cL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):PR(t)?(i.markType=t,i.source=e):i.source=t===aL?aL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=mR(l,this),v=PL(((t,e)=>{const s=c===oL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===aL&&(t=ML(0,t,e,0,aL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===oL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,oL,d))return this.addEventListener(d,v,lL),()=>{this.removeEventListener(d,v)}}else if(c===aL)return L_.addEventListener(d,v),this._eventListeners.push({type:d,source:L_,handler:v}),()=>{L_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===L_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=ER.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new SL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new aO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new oO((t=>t.id())),this._options.logger&&rt.setInstance(this._options.logger),this.logger=rt.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new bL,this.animate=new lO(this),this._morph=new rO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[oL,aL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:mO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&L_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=UB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==DB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=L_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&L_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),ER.unregisterRuntimeTransforms(),rt.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _O=()=>{bM(),uM(),ER.registerGraphic(DB.path,Ug)},yO=()=>{bM(),fM(),ER.registerGraphic(DB.rect,Eg)},bO=()=>{bM(),cM(),ER.registerGraphic(DB.rule,Tg)},xO=()=>{bM(),SM(),ER.registerGraphic(DB.symbol,Ag)},SO=()=>{bM(),kM(),_M(),ER.registerGraphic(DB.text,_p)},AO=()=>{bM(),nM(),ER.registerGraphic(DB.glyph,Bg)},kO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},MO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},TO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(Sb(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},wO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Sb(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},CO=kO(TO),EO=MO(TO);const PO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Sb(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},BO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Sb(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},RO=kO(PO),LO=MO(PO);const OO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},IO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},DO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?IO:OO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},FO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},jO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},zO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class HO extends fO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const NO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class VO extends HO{constructor(t,e,i){super(t,FB.axis,e),this.spec.componentType=FB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=wR(n,e,i,s);const h=_R(this.spec.inside,s,e,i),c=_R(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(NO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=_R(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case zB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case zB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?zB.circleAxis:zB.lineAxis,this._axisComponentType}}VO.componentType=FB.axis;let GO=class extends fO{constructor(t,e){super(t,FB.label,e),this.spec.componentType=FB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=_R(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=_R(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case DB.line:case DB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case DB.rect:case DB.rect3d:case DB.interval:g=p.rectLabel;break;case DB.symbol:case DB.circle:case DB.cell:g=p.symbolLabel;break;case DB.arc:case DB.arc3d:g=p.arcLabel;break;case DB.polygon:case DB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=wR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=wR(i,t,e,d);m.push(z({},f,s))}));else{const t=wR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};GO.componentType=FB.label;const WO=()=>{ER.registerGraphicComponent(FB.label,(t=>new JT(t))),ER.registerComponent(FB.label,GO)};class UO extends HO{constructor(t,e,i){super(t,FB.grid,e),this.spec.componentType=FB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=ER.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=wR(s,t,e,i);const d=_R(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case HB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case HB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=_R(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(NO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===HB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=_R(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case HB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case HB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=HB.circleAxisGrid:this._gridComponentType=HB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case zB.circleAxis:this._gridComponentType=HB.circleAxisGrid;break;case zB.lineAxis:default:this._gridComponentType=HB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?HB.lineAxisGrid:HB.circleAxisGrid:HB.lineAxisGrid}else this._gridComponentType=HB.lineAxisGrid;return this._gridComponentType}}UO.componentType=FB.grid;const YO=(t,e,i)=>e.filter((e=>t.callback(e,i))),KO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function XO(t){return t.reduce(((t,e)=>t+e),0)}const $O={min:$,max:X,average:function(t){return 0===t.length?0:XO(t)/t.length},sum:XO};function qO(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function ZO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function JO(t,e,i,s){return ZO(t,e,i,"min",s)}function QO(t,e,i,s){return ZO(t,e,i,"max",s)}function tI(t,e,i,s){return ZO(t,e,i,"average",s)}function eI(t,e,i,s){return ZO(t,e,i,"sum",s)}const iI=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=qO;if("min"===n?l=JO:"max"===n?l=QO:"average"===n?l=tI:"sum"===n&&(l=eI),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const sI=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(gR)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(gR,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(gR,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},nI=()=>{ER.registerTransform("filter",{transform:YO,markPhase:"beforeJoin"},!0)},rI=()=>{ER.registerTransform("map",{transform:KO,markPhase:"beforeJoin"},!0)},aI=()=>{ER.registerTransform("sampling",{transform:iI,markPhase:"afterEncode"},!0)},oI=()=>{ER.registerTransform("markoverlap",{transform:sI,markPhase:"afterEncode"},!0)},lI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},hI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},cI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalAnimationAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},dI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},uI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},pI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},_I=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},yI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},bI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},xI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},SI=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},AI=(t,e,i)=>({from:{points:SI(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),kI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:SI(t,e)}}),MI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),TI=(t,e,i)=>({from:{points:MI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),wI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:MI(t,e,i)}}),CI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),EI=(t,e,i)=>({from:{points:CI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),PI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:CI(t,e,i)}}),BI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l,excludeChannels:h=[]}=null!=e?e:{};let c=0,u=0;"negative"===a&&(i.group?(c=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),u=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=c,i.groupHeight=u):(c=i.width,u=i.height)),c+=r,u+=r;const p=d(l)?l.call(null,t.getDatum(),t,i):l,g=p&&k(p.x)?p.x:c,m=p&&k(p.y)?p.y:u,f=h.includes("x")?t.getGraphicAttribute("x"):t.getFinalAnimationAttribute("x"),v=h.includes("y")?t.getGraphicAttribute("y"):t.getFinalAnimationAttribute("y");switch(o){case"x":return{from:{x:g},to:{x:f}};case"y":return{from:{y:m},to:{y:v}};default:return{from:{x:g,y:m},to:{x:f,y:v}}}},RI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},LI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalAnimationAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},OI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},II={symbol:["_mo_hide_","visible"]},DI=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=II[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{vb(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},FI=(t,e,i)=>{var s;const n=null!==(s=t.getFinalAnimationAttribute("angle"))&&void 0!==s?s:0;let r=0;return r=ut(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},jI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=ut(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},zI=()=>{ER.registerAnimationType("clipIn",lI)},HI=()=>{ER.registerAnimationType("clipOut",hI)},NI=()=>{ER.registerAnimationType("fadeIn",cI)},VI=()=>{ER.registerAnimationType("fadeOut",dI)},GI=()=>{ER.registerAnimationType("growCenterIn",uI)},WI=()=>{ER.registerAnimationType("growCenterOut",pI)},UI=()=>{ER.registerAnimationType("growHeightIn",fI)},YI=()=>{ER.registerAnimationType("growHeightOut",vI)},KI=()=>{ER.registerAnimationType("growWidthIn",gI)},XI=()=>{ER.registerAnimationType("growWidthOut",mI)},$I=()=>{ER.registerAnimationType("growPointsIn",AI)},qI=()=>{ER.registerAnimationType("growPointsOut",kI)},ZI=()=>{ER.registerAnimationType("growPointsXIn",TI)},JI=()=>{ER.registerAnimationType("growPointsXOut",wI)},QI=()=>{ER.registerAnimationType("growPointsYIn",EI)},tD=()=>{ER.registerAnimationType("growPointsYOut",PI)},eD=()=>{ER.registerAnimationType("growAngleIn",_I)},iD=()=>{ER.registerAnimationType("growAngleOut",yI)},sD=()=>{ER.registerAnimationType("growRadiusIn",bI)},nD=()=>{ER.registerAnimationType("growRadiusOut",xI)},rD=()=>{ER.registerAnimationType("moveIn",BI)},aD=()=>{ER.registerAnimationType("moveOut",RI)},oD=()=>{ER.registerAnimationType("scaleIn",LI)},lD=()=>{ER.registerAnimationType("scaleOut",OI)},hD=()=>{ER.registerAnimationType("rotateIn",FI)},cD=()=>{ER.registerAnimationType("rotateOut",jI)},dD=()=>{ER.registerAnimationType("update",DI)};class uD extends KL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=vR(e)?null:Object.keys(e).reduce(((t,s)=>(SR(e[s])&&(t[s]=yR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=wR(e,t,i,n);if(u(r.size)){const t=s.x?KR(s.x):void 0,e=s.y?KR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(IR.symbol)}release(){super.release(),this._encoders=null}}uD.markType=DB.cell;const pD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var gD,mD,fD;t.ChartEvent=void 0,(gD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",gD.rendered="rendered",gD.renderFinished="renderFinished",gD.animationFinished="animationFinished",gD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",gD.afterInitData="afterInitData",gD.afterInitEvent="afterInitEvent",gD.afterInitMark="afterInitMark",gD.rawDataUpdate="rawDataUpdate",gD.viewDataFilterOver="viewDataFilterOver",gD.viewDataUpdate="viewDataUpdate",gD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",gD.markDeltaYUpdate="markDeltaYUpdate",gD.viewDataLabelUpdate="viewDataLabelUpdate",gD.scaleDomainUpdate="scaleDomainUpdate",gD.scaleUpdate="scaleUpdate",gD.dataZoomChange="dataZoomChange",gD.drill="drill",gD.layoutStart="layoutStart",gD.layoutEnd="layoutEnd",gD.layoutRectUpdate="layoutRectUpdate",gD.playerPlay="playerPlay",gD.playerPause="playerPause",gD.playerEnd="playerEnd",gD.playerChange="playerChange",gD.playerForward="playerForward",gD.playerBackward="playerBackward",gD.scrollBarChange="scrollBarChange",gD.brushStart="brushStart",gD.brushChange="brushChange",gD.brushEnd="brushEnd",gD.brushClear="brushClear",gD.legendSelectedDataChange="legendSelectedDataChange",gD.legendFilter="legendFilter",gD.legendItemClick="legendItemClick",gD.legendItemHover="legendItemHover",gD.legendItemUnHover="legendItemUnHover",gD.tooltipShow="tooltipShow",gD.tooltipHide="tooltipHide",gD.tooltipRelease="tooltipRelease",gD.afterResize="afterResize",gD.afterRender="afterRender",gD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(mD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",mD.window="window",mD.canvas="canvas",t.Event_Bubble_Level=void 0,(fD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",fD.chart="chart",fD.model="model",fD.mark="mark";const vD=`${pB}_waterfall_default_seriesField`,_D=`${pB}_CORRELATION_X`,yD=`${pB}_CORRELATION_Y`,bD=`${pB}_CORRELATION_SIZE`,xD=`${pB}_MEASURE_CANVAS_ID`,SD=`${pB}_DEFAULT_DATA_INDEX`,AD=`${pB}_DEFAULT_DATA_KEY`,kD=`${pB}_DEFAULT_DATA_SERIES_FIELD`,MD=`${pB}_DEFAULT_SERIES_STYLE_NAME`;var TD;t.AttributeLevel=void 0,(TD=t.AttributeLevel||(t.AttributeLevel={}))[TD.Default=0]="Default",TD[TD.Theme=1]="Theme",TD[TD.Chart=2]="Chart",TD[TD.Base_Series=3]="Base_Series",TD[TD.Series=4]="Series",TD[TD.Mark=5]="Mark",TD[TD.User_Chart=6]="User_Chart",TD[TD.User_Series=7]="User_Series",TD[TD.User_Mark=8]="User_Mark",TD[TD.User_SeriesStyle=9]="User_SeriesStyle",TD[TD.Built_In=99]="Built_In";const wD=`${pB}_STACK_KEY`,CD=`${pB}_STACK_START`,ED=`${pB}_STACK_END`,PD=`${pB}_STACK_START_PERCENT`,BD=`${pB}_STACK_END_PERCENT`,RD=`${pB}_STACK_START_OffsetSilhouette`,LD=`${pB}_STACK_END_OffsetSilhouette`,OD=`${pB}_STACK_TOTAL`,ID=`${pB}_STACK_TOTAL_PERCENT`,DD=`${pB}_STACK_TOTAL_TOP`,FD=`${pB}_SEGMENT_START`,jD=`${pB}_SEGMENT_END`;var zD,HD;t.LayoutZIndex=void 0,(zD=t.LayoutZIndex||(t.LayoutZIndex={}))[zD.Axis_Grid=50]="Axis_Grid",zD[zD.CrossHair_Grid=100]="CrossHair_Grid",zD[zD.Region=450]="Region",zD[zD.Mark=300]="Mark",zD[zD.Node=400]="Node",zD[zD.Axis=100]="Axis",zD[zD.MarkLine=500]="MarkLine",zD[zD.MarkArea=100]="MarkArea",zD[zD.MarkPoint=500]="MarkPoint",zD[zD.DataZoom=500]="DataZoom",zD[zD.ScrollBar=500]="ScrollBar",zD[zD.Player=500]="Player",zD[zD.Legend=500]="Legend",zD[zD.CrossHair=500]="CrossHair",zD[zD.Indicator=500]="Indicator",zD[zD.Title=500]="Title",zD[zD.Label=500]="Label",zD[zD.Brush=500]="Brush",zD[zD.CustomMark=500]="CustomMark",zD[zD.Interaction=700]="Interaction",t.LayoutLevel=void 0,(HD=t.LayoutLevel||(t.LayoutLevel={}))[HD.Indicator=10]="Indicator",HD[HD.Region=20]="Region",HD[HD.Axis=30]="Axis",HD[HD.DataZoom=40]="DataZoom",HD[HD.Player=40]="Player",HD[HD.ScrollBar=40]="ScrollBar",HD[HD.Legend=50]="Legend",HD[HD.Title=70]="Title",HD[HD.CustomMark=70]="CustomMark";const ND=["linear","radial","conical"],VD={x0:0,y0:0,x1:1,y1:1},GD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},WD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},UD={linear:VD,radial:GD,conical:WD},YD={label:{name:"label",type:"text"}},KD=`${pB}_rect_x`,XD=`${pB}_rect_x1`,$D=`${pB}_rect_y`,qD=`${pB}_rect_y1`,ZD={data:!0},JD={animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},QD=Object.assign(Object.assign({},YD),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),tF=Object.assign(Object.assign({},YD),{bar3d:{name:"bar3d",type:"rect3d"}}),eF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},iF=Object.assign(Object.assign({},YD),eF),sF=Object.assign(Object.assign({},YD),{point:{name:"point",type:"symbol"}}),nF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),rF=Object.assign(Object.assign(Object.assign({},YD),eF),{area:{name:"area",type:"area"}}),aF=Object.assign(Object.assign({},YD),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),oF=Object.assign(Object.assign({},YD),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),lF=Object.assign(Object.assign({},YD),{rose:{name:"rose",type:"arc"}}),hF=Object.assign(Object.assign({},YD),{area:{name:"area",type:"path"}}),cF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"}}),dF=Object.assign(Object.assign({},cF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),uF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),pF=Object.assign(Object.assign({},YD),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),gF=Object.assign(Object.assign({},YD),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),mF=Object.assign(Object.assign({},YD),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),fF=Object.assign(Object.assign({},YD),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),vF=Object.assign(Object.assign({},YD),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),_F=Object.assign(Object.assign({},QD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),yF=Object.assign(Object.assign({},YD),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),bF=Object.assign(Object.assign({},YD),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),xF=Object.assign(Object.assign({},YD),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),SF=Object.assign(Object.assign({},cF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),AF=Object.assign(Object.assign({},YD),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),kF=Object.assign(Object.assign({},YD),{sunburst:{name:"sunburst",type:"arc"}}),MF=Object.assign(Object.assign({},QD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),TF=Object.assign(Object.assign({},tF),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),wF=Object.assign(Object.assign({},YD),{circlePacking:{name:"circlePacking",type:"arc"}}),CF=Object.assign(Object.assign({},YD),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),EF=Object.assign(Object.assign({},YD),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),PF=Object.assign({},nF),BF=Object.assign(Object.assign({},YD),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}}),RF=Object.assign(Object.assign({},YD),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var LF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(LF||(LF={}));const OF={[dB.bar]:QD,[dB.bar3d]:tF,[dB.line]:iF,[dB.scatter]:sF,[dB.area]:nF,[dB.radar]:rF,[dB.pie]:aF,[dB.pie3d]:oF,[dB.rose]:lF,[dB.geo]:YD,[dB.map]:hF,[dB.circularProgress]:dF,[dB.link]:uF,[dB.dot]:pF,[dB.wordCloud]:gF,[dB.wordCloud3d]:gF,[dB.funnel]:mF,[dB.funnel3d]:fF,[dB.linearProgress]:vF,[dB.waterfall]:_F,[dB.boxPlot]:yF,[dB.treemap]:bF,[dB.sankey]:xF,[dB.gauge]:SF,[dB.gaugePointer]:AF,[dB.sunburst]:kF,[dB.rangeColumn]:MF,[dB.rangeColumn3d]:TF,[dB.circlePacking]:wF,[dB.heatmap]:CF,[dB.correlation]:EF,[dB.rangeArea]:PF,[dB.liquid]:BF,[dB.venn]:RF};function IF(t){var e,i;const{type:s}=t;return s===dB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const DF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},FF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function jF(t,e){var i;if(!t)return[];const s=UF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?GF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>VF(i)?HF(t,i,e):i)).filter(p)}))):i.map((i=>VF(i)?HF(t,i,e):i)).filter(p):[]}return[]}function zF(t,e){var i,s;return GF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function HF(t,e,i){var s;const n=UF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=DF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=FF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ve(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=he(t,i,s),a=le(n,r,e.l),l=new ve(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const NF=(t,e,i)=>{if(e&&VF(t)){const s=HF(e,t,i);if(s)return s}return t};function VF(t){return t&&"palette"===t.type&&!!t.key}function GF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function WF(t){return y(t)?{dataScheme:t}:t}function UF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=IF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class YF extends lC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!GF(this._range))return void super.range(this._range);const t=zF(this._range,this._domain);super.range(t)}}const KF={linear:BC,band:cC,point:class extends cC{constructor(t){super(!1),this.type=Iw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:lC,threshold:DC,colorOrdinal:YF};function XF(t){const e=KF[t];return e?new e:null}function $F(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function qF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ZF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function JF(t){return!!_(t)&&(!!t.endsWith("%")&&ob(t.substring(0,t.length-1)))}function QF(t,e,i,s=0){var n,r;return S(t)?t:JF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function tj(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=QF(t[s],e.size,i)}))})),o}function ej(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||JF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function ij(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sj=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},nj=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],rj={default:{dataScheme:nj,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},aj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",oj={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:aj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:aj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:RB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},lj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},hj=Object.assign(Object.assign({},lj),{label:{space:0}}),cj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},dj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",uj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:dj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},pj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},gj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},mj={horizontal:Object.assign(Object.assign({},pj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj}),vertical:Object.assign(Object.assign({},pj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:gj})},fj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},vj={horizontal:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj}),vertical:Object.assign(Object.assign({},pj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:fj})},_j={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},yj={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},bj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function xj(t,e){return t&&e.key in t?t[e.key]:e.default}function Sj(t){return t&&"token"===t.type&&!!t.key}const Aj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},kj={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:rj,token:Aj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:oj,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:mj,sizeLegend:vj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:lj,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:hj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:yj,markArea:_j,markPoint:bj,polarMarkLine:yj,polarMarkArea:_j,polarMarkPoint:bj,geoMarkPoint:bj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:uj,crosshair:cj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},Mj={name:"dark",colorScheme:{default:{dataScheme:nj,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Tj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>Tj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>Tj(t[i],e[i])))),wj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),wj(t[s],e.slice(1),i))};function Cj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof _a||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=Cj(n,e)}return s}function Ej(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?Pj(t,e,r,i):Bj(t,r,s[r])}}}}function Pj(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Rj({},t[n][e.index],i):i):t[n]=s?Rj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Rj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Rj({},t[n],i):i)}))}function Oj(t,...e){return Rj(Ij(t),...e.map(Ij))}function Ij(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=WF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(OF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Dj(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Dj(t,e,i,s){if(!OF[e])return t;const n={};return Object.values(OF[e]).forEach((({type:e,name:r})=>{n[r]=Rj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Fj=["animationThreshold","colorScheme","name","padding"];function jj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Fj.includes(r)?n[r]=a:f(a)?VF(a)?n[r]=NF(a,e,s):Sj(a)?n[r]=xj(i,a):n[r]=jj(a,e,i,s):n[r]=a})),n}const zj={[kj.name]:kj},Hj=kj.name,Nj=new Map(Object.keys(zj).map((t=>[t,zj[t]]))),Vj=new Map(Object.keys(zj).map((t=>[t,jj(zj[t])]))),Gj=new Map(Object.keys(zj).map((t=>[t,t===Hj]))),Wj=(t,e)=>{if(!t)return;const i=Xj(e);Nj.set(t,i),Vj.set(t,jj(i)),Gj.set(t,!0)},Uj=(t=Hj,e=!1)=>(Gj.has(t)&&!Gj.get(t)&&Wj(t,Nj.get(t)),e?Vj.get(t):Nj.get(t)),Yj=t=>Nj.delete(t)&&Vj.delete(t)&&Gj.delete(t),Kj=t=>!!_(t)&&Nj.has(t),Xj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Hj;return Oj({},Uj(i),t)};class $j{static registerInstance(t){$j.instances.set(t.id,t)}static unregisterInstance(t){$j.instances.delete(t.id)}static getInstance(t){return $j.instances.get(t)}static instanceExist(t){return $j.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return $j.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}$j.instances=new Map;class qj{static registerTheme(t,e){Wj(t,e)}static getTheme(t,e=!1){return Uj(t,e)}static removeTheme(t){return Yj(t)}static themeExist(t){return Kj(t)}static getDefaultTheme(){return qj.themes.get(Hj)}static setCurrentTheme(t){qj.themeExist(t)&&(qj._currentThemeName=t,$j.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return qj.getTheme(qj._currentThemeName,t)}static getCurrentThemeName(){return qj._currentThemeName}}function Zj(t,e){return _(t)?qj.themeExist(t)?qj.getTheme(t,e):{}:g(t)?t:{}}function Jj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Jj(t[s],e)}return i}return y(t)?t.map((t=>Jj(t,e))):t}function Qj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Qj(t[s],e)}return i}return y(t)?t.map((t=>Qj(t,e))):t}qj.themes=Nj,qj._currentThemeName=Hj;function tz(t,e){for(let i=0;it.key===e))}function iz(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sz(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},lz(t,a,n[o],l,e,r))})),s?nz(n):n}function nz(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nz(t[e].nodes);return t}function rz(t,e){if("values"in t&&t.values.length){const i=iB(t.values,e),s=eB(t.values,BD);t.values.forEach((t=>{t[OD]=i,t[ID]=s,delete t[DD]}));const n=t.values.reduce(((t,e)=>e[ED]>t[ED]?e:t));n[DD]=!0}else for(const i in t.nodes)rz(t.nodes[i],e)}function az(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ED]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[CD]=s,s+=r[ED],r[ED]=s):(r[CD]=n,n+=r[ED],r[ED]=n),r[wD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[PD]=0===h?0:Math.min(1,l[CD]/h)*r,l[BD]=0===h?0:Math.min(1,l[ED]/h)*r}}for(const s in t.nodes)oz(t.nodes[s],e,i)}function lz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[ED]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),lz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const hz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uz(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mz(t.style(e,i,s,n)):B(t.style)||(e.style=mz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mz(t.state[e]))})),e.state=i}return e}function pz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e,s,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}function gz(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mz(i)}function mz(t){return(null==t?void 0:t.angle)&&(t.angle=Qt(t.angle)),t}class fz{static registerChart(t,e){fz._charts[t]=e}static registerSeries(t,e){fz._series[t]=e}static registerComponent(t,e,i){fz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){fz._marks[t]=e}static registerRegion(t,e){fz._regions[t]=e}static registerTransform(t,e){fz.transforms[t]=e}static registerLayout(t,e){fz._layout[t]=e}static registerAnimation(t,e){fz._animations[t]=e}static registerImplement(t,e){fz._implements[t]=e}static registerChartPlugin(t,e){fz._chartPlugin[t]=e}static registerComponentPlugin(t,e){fz._componentPlugin[t]=e}static createChart(t,e,i){if(!fz._charts[t])return null;return new(0,fz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!fz._charts[t])return null;const i=fz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!fz._regions[t])return null;return new(0,fz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!fz._regions[t])return null;return new(0,fz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!fz._series[t])return null;return new(0,fz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!fz._series[t])return null;return new(0,fz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!fz._marks[t])return null;const s=new(0,fz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(fz._components)}static getComponentInKey(t){return fz._components[t].cmp}static getLayout(){return Object.values(fz._layout)}static getLayoutInKey(t){return fz._layout[t]}static getSeries(){return Object.values(fz._series)}static getSeriesInType(t){return fz._series[t]}static getRegionInType(t){return fz._regions[t]}static getAnimationInKey(t){return fz._animations[t]}static getImplementInKey(t){return fz._implements[t]}static getSeriesMarkMap(t){return fz._series[t]?fz._series[t].mark:{}}static getChartPlugins(){return Object.values(fz._chartPlugin)}static getComponentPlugins(){return Object.values(fz._componentPlugin)}static getComponentPluginInType(t){return fz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}fz._charts={},fz._series={},fz._components={},fz._marks={},fz._regions={},fz._animations={},fz._implements={},fz._chartPlugin={},fz._componentPlugin={},fz.transforms={fields:Lr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},fz.dataParser={csv:Ur,dsv:Wr,tsv:Yr},fz._layout={};const vz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},_z=(t,e,i,s)=>{var n;const r=Gw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:yz(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,bz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},xz=(t,e)=>{if(!t)return null;const{x:i,y:s}=e,n=bz(t,(t=>"angle"===t.getOrient()),e),r=bz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&Gw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=rB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=aB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=_z(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&Gw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=rB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=aB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=_z(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function Sz(t){return"bottom"===t||"top"===t}function Az(t){return"left"===t||"right"===t}function kz(t){return"z"===t}function Mz(t,e){return ZF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Tz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function wz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Sz(t)?"linear":"band":Sz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Cz=t=>t.fieldX[0],Ez=t=>t.fieldY[0],Pz=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Bz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Rz=(t,e)=>t?e?Cz:Pz:e?Ez:Bz,Lz=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=bz(t,(t=>Sz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=bz(t,(t=>Az(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Gw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=Oz(s,i,t,Rz(e,Gw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=Oz(s,i,t,Rz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},Oz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Iz(t,a,s)},Iz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=_z(e,t,"cartesian",null!=i?i:Sz(t.getOrient())?Cz:Ez);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Dz{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Jy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Jy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Lz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=xz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>Gw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return Sz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Iz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Fz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Fz||(Fz={}));const jz={[Fz.dimensionHover]:class extends Dz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!vz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),sb(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),sb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Fz.dimensionClick]:class extends Dz{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let zz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(jz[t]){const e=new jz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(jz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Hz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Nz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Vz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new Hz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Nz[a]&&(a=Nz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=xt(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=bt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return pD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&ER.hasInteraction(e)}}function Gz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Wz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const Uz=new Map;let Yz;function Kz(){Yz||(Yz=new fa,Wz(Yz,"geojson",ca),Wz(Yz,"topojson",ua),Gz(Yz,"simplify",Br))}function Xz(t,e,i={type:"geojson",centroid:!0}){Uz.has(t)&&Zy(`map type of '${t}' already exists, will be overwritten.`),Kz();const s=new _a(Yz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),Uz.set(t,s)}function $z(t){Uz.has(t)?Uz.delete(t):Zy(`map type of '${t}' does not exists.`)}function qz(t,e=!1){let i=e;return t.latestData instanceof _a&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Zz=(t,e)=>0===t.length?[]:1===t.length?qz(t[0],null==e?void 0:e.deep):t.map((t=>qz(t,null==e?void 0:e.deep)));function Jz(t,e,i){Gz(e=e instanceof fa?e:t.dataSet,"copyDataView",Zz);const s=new _a(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:eH.copyDataView}),s}function Qz(t,e,i=[],s={}){var n,r,a;if(t instanceof _a)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new _a(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Jy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Jy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Zy("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function tH(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var eH;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(eH||(eH={}));const iH=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new rt(null!==(t=this._option.logLevel)&&void 0!==t?t:nt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:oH(this._option.mode),autoFit:!1,eventConfig:{gesture:sb(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(L_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=L_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return ib(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function hH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Jy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function cH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Rj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function dH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ei(l,i.width,i.height);a=t,o=e}else if(h&&ib(e.mode)){let t;t=_(h)?L_.getElementById(h):h;const{width:e,height:s}=ei(t,i.width,i.height);a=e,o=s}else if(nb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function uH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function pH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(rH||(rH={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aH||(aH={}));class gH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},gH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}gH.defaultMarkInfo={};class mH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gH,this._markReverse=new gH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(rH.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(rH.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(rH.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rH.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[rH.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[rH.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Fz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const fH={};Object.values(rH).forEach((t=>{fH[t]=!0}));const vH={[rH.STATE_HOVER]:rH.STATE_HOVER_REVERSE,[rH.STATE_SELECTED]:rH.STATE_SELECTED_REVERSE,[rH.STATE_DIMENSION_HOVER]:rH.STATE_DIMENSION_HOVER_REVERSE};function _H(t){return vH[t]}class yH{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=_H(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=_H(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=_H(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=_H(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class bH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class xH extends bH{constructor(){super(...arguments),this.id=ab(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class SH extends xH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=nH.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class AH extends bH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new SH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class kH extends AH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class MH extends kH{constructor(){super(...arguments),this.id=ab(),this.stateKeyToSignalName=t=>`${pB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===sH.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===sH.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?sH.none:sH.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?sH.exit:"update"===e.diffState?sH.update:sH.appear}}}}class TH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Rj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class wH extends bH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=TH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new gH,this._lastLayoutRect=null,this.id=ab(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${pB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=fz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class CH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=tj(ej(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class EH extends wH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new CH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class PH extends TH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BH extends EH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=PH,this.modelType="region",this.specKey="region",this.type=BH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new yH,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new mH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aH)B(t.stateStyle[aH[e]])||this.interaction.registerMark(aH[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function RH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function LH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function OH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function IH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),OH(c,!0,u,o),s&&LH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function DH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),OH(c,!1,u,a),s&&LH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function jH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"left"),n.length&&IH(n,e,i,!0,"left"),r.length&&DH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"top"),n.length&&FH(n,e,i,!0,"top"),r.length&&jH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&IH(s,e,i,!1,"right"),n.length&&IH(n,e,i,!0,"right"),r.length&&DH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RH(t);s.length&&FH(s,e,i,!1,"bottom"),n.length&&FH(n,e,i,!0,"bottom"),r.length&&jH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Jy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}zH.type="base";const HH=["line","area","trail"];function NH(t){return HH.includes(t)}class VH extends kH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(NH)?s:!t.mark||NH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!fH[t])).map((t=>[t,10])),s=!t.mark||NH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(pB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(pB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(Nw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class GH extends xH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=nH.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class WH extends GH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${pB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class UH extends xH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=nH.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new VH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new zz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new WH(t)}stateKeyToSignalName(t){return`${pB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=rH.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=rH.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===sH.appear&&this.runAnimationByState(sH.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(sH.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class YH extends UH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Qt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Rj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=XF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):ND.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Vw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},UD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=ve.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)ND.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=zF(jF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class KH extends YH{constructor(){super(...arguments),this.type=KH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Zy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Zy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}KH.type="group";const XH=()=>{bM(),aM(),ER.registerGraphic(DB.group,wu),fz.registerMark(KH.type,KH)},$H={type:"fadeIn"};function qH(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return $H;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ZH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},JH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},QH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},tN=()=>{fz.registerAnimation("scaleInOut",(()=>JH))},eN=()=>{fz.registerAnimation("fadeInOut",(()=>QH))},iN=(t,e)=>({appear:qH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Gc,duration:ZH.update.duration,easing:ZH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),sN=()=>{fz.registerAnimation("line",iN)},nN=()=>{vO.useRegisters([$I,qI,ZI,JI,QI,tD,zI,HI])},rN={measureText:(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:Aj.fontFamily,fontSize:Aj.fontSize}))(e,i,s).measure(t)};class aN{static instance(){return aN.instance_||(aN.instance_=new aN),aN.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class oN{constructor(){this.id=ab(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Zy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class lN extends oN{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class hN{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>fz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>fz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>fz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return fz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>fz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){fz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}static unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}static getFunction(t){return t?aN.instance().getFunction(t):null}static getFunctionList(){return aN.instance().getFunctionNameList()}static registerMap(t,e,i){const s=fz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=fz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,Uz.get(e);var e}static hideTooltip(t=[]){$j.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h;this.id=ab(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=bt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const c=this._option,{dom:d,renderCanvas:u,mode:p,stage:g,poptip:m}=c,f=e(c,["dom","renderCanvas","mode","stage","poptip"]),v=ib(p);v?Rx(Ql):"node"===p&&uA(Ql),v&&d&&(this._container=_(d)?L_.getElementById(d):d),u&&(this._canvas=u),g&&(this._stage=g),"node"===p||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=qj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new lH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:u},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:!1!==m?["poptipForText"]:[]},f),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Vz(this,this._compiler),this._event=new zz(this._eventDispatcher,p),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!v&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),$j.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Rj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Jj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;hN.getFunctionList()&&hN.getFunctionList().length&&(t=Qj(t,hN)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=fz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=fz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return dH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:gB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:mB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof fa?t:new fa,Wz(this._dataSet,"dataview",pa),Wz(this._dataSet,"array",s),Gz(this._dataSet,"stackSplit",iH),Gz(this._dataSet,"copyDataView",Zz);for(const t in fz.transforms)Gz(this._dataSet,t,fz.transforms[t]);for(const t in fz.dataParser)Wz(this._dataSet,t,fz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(d=this._compiler)||void 0===d||d.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?sH.appear:sH.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,$j.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:i,values:n,parser:r,fields:a}=t,o=s.find((t=>t.name===i));if(o)o instanceof _a?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const i=Qz(t,this._dataSet,s,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(i)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1,i){var s,n;const r=this._spec,a={reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a;this._initChartSpec(this._spec,"render");const l=uH(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||Lj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Rj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=Zj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Oj({},Zj(this._currentThemeName,!0),Zj(s,!0),Zj(n,!0));this._currentTheme=t}else{const t=Oj({},Zj(this._currentThemeName),Zj(s),Zj(n));this._currentTheme=jj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(nT.poptip,sT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!ib(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Zj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!qj.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield hH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!ib(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?L_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?ij(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Zy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?ij(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Zy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return aN.instance().getFunction(t)}registerFunction(t,e){t&&e&&aN.instance().registerFunction(t,e)}unregisterFunction(t){t&&aN.instance().unregisterFunction(t)}getFunctionList(){return aN.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=fz.getChartPlugins();t.length>0&&(this._chartPlugin=new lN(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}hN.InstanceManager=$j,hN.ThemeManager=qj,hN.globalConfig={uniqueTooltip:!0},hN.Utils=rN,hN.vglobal=L_;fz.registerRegion("region",BH),fz.registerLayout("base",zH),XH(),vO.useRegisters([nI,rI]),vO.useRegisters([oD,lD,NI,VI,rD,aD,hD,cD,dD]),qR(),$R(),Wj(Mj.name,Mj),rt.getInstance(nt.Error);const cN=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(dB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=fz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=fz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},dN=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=cN(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):Tj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Rj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Rj(m,f),hasChanged:!0};const i=Rj({},t,f);wj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class uN{constructor(t){this.id=ab(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const pN=t=>{fz.registerChartPlugin(t.type,t)};class gN extends uN{constructor(){super(gN.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[gN.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[gN.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=Cj(this._option.globalInstance.getSpec(),["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Cj(this._baseChartSpec,["data",gN.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=dN(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=Cj(i,["data",gN.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}gN.pluginType="chart",gN.specKey="media",gN.type="MediaQueryPlugin";const mN=/\{([^}]+)\}/,fN=/\{([^}]+)\}/g,vN=/:/;class _N extends uN{constructor(){super(_N.type),this.type="formatterPlugin",this._timeModeFormat={utc:ci.getInstance().timeUTCFormat,local:ci.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=_i.getInstance().format,this._numericSpecifier=_i.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[_N.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),fz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=mN.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(fN,((t,i)=>{if(!vN.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(mi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}_N.pluginType="chart",_N.specKey="formatter",_N.type="formatterPlugin";function yN(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function bN(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function xN(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function SN(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function AN(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function kN(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const MN=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return FC(v)};class TN extends uN{constructor(){super(TN.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Nw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&yN(c)&&yN(d)))return;const u=bN(t,c),p=bN(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!SN(u,p))return}else if(0===y&&0===b){if(!SN(p,u))return}else if(_||A)if(_&&!A){if(!xN(u,p))return}else if(A&&!_){if(!xN(p,u))return}else{if(m===b)return;if(m>b){if(!AN(u,p))return}else if(!AN(p,u))return}else{if(0===m&&0===y){if(!kN(u,p))return}else if(0===b&&0===g&&!kN(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Gz(e.getOption().dataSet,"tickAlign",MN);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}TN.pluginType="component",TN.type="AxisSyncPlugin";const wN=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,CN=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},_m||(_m=fm.CreateGraphic("richtext",{})),_m.setAttributes(a),_m.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},EN="vchart-tooltip-container",PN={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function BN(t,e){return R(e,`component.${t}`)}function RN(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=fz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const LN={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ON(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function IN(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function DN(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function FN(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const jN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):["linear","log","symlog"].includes(e)?BN("axisLinear",i):{})&&void 0!==s?s:{},r=Sz(t)?BN("axisX",i):Az(t)?BN("axisY",i):BN("axisZ",i);return Rj({},BN("axis",i),n,r)},zN=(t,e,i)=>{var s;const n=null!==(s="band"===e?BN("axisBand",i):"linear"===e?BN("axisLinear",i):{})&&void 0!==s?s:{},r=BN("angle"===t?"axisAngle":"axisRadius",i);return Rj({},BN("axis",i),n,r)},HN=t=>"band"===t||"ordinal"===t||"point"===t;function NN(t,e){return{id:t,label:t,value:e,rawValue:t}}function VN(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function GN(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}const WN=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(Gw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Nw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=ON(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(Gw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Nw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=GN(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=ON(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&UN(t,"top",r.label),e.visible&&UN(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(YN(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&UN(t,"left",a.label),e.visible&&UN(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},UN=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=RN(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},YN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},KN=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=$N(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},XN=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=$N(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},$N=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},qN=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},ZN={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},JN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},QN=(t,e)=>{var i,s;return null!==(s=null===(i=ZN[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},tV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=WN(3,e,i,s,n,r,a);return o?KN(r,o,d,h):l?XN(a,l,u,c):void 0},eV={fontFamily:Aj.fontFamily,spacing:10,wordBreak:"break-word"};function iV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eV),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},nV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aV=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oV(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=lV(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rV(i,s)(t)&&rV(n,r)(t)&&(u(a)||rV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return hN.globalConfig.uniqueTooltip&&hN.hideTooltip(u.id),d}return"none"}const lV=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=nV(c,t);let _=nV(d,t);const y=aV(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rV(c,v));if(!y&&(_=nV(d,i),!aV(_)))return;const n=e.type===dB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=Gw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(rV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nV(d,o),!aV(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(rV(c,n));if(!y&&(_=nV(d,r),!aV(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===dB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=nV(d,i),!aV(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},hV=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const cV=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class dV{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class uV extends dV{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:gV(e.title,{seriesId:this.series.id},!0),content:mV(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=hV(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const pV=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},gV=(t,e,i)=>p(t)?d(t)?(...s)=>pV(t(...s),e,i):pV(t,e,i):void 0,mV=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>pV(t,e,i))):pV(t,e,i))):void 0;return s},fV=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=cV(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=cV(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},vV=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=_V(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&hV(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},_V=mt((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),yV=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},bV=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=RN(void 0,s,t,e);i&&r&&(n=i(...r))}return n},SV=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class AV{}AV.dom=`${pB}_TOOLTIP_HANDLER_DOM`,AV.canvas=`${pB}_TOOLTIP_HANDLER_CANVAS`;const kV=20,MV={key:"其他",value:"..."},TV=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ci.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},wV=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=SV(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==xV(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:TV(xV(c,t,i,v),p,g),valueStyle:xV(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=kV}=t,x=t.othersLine?Object.assign(Object.assign({},MV),t.othersLine):MV,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=CV(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=CV(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},CV=(t,e,i)=>{const s=TV(xV(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=TV(xV(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==xV(e.visible,t,i)&&(p(s)||p(n)),a=xV(e.isKeyAdaptive,t,i),o=xV(e.spaceRow,t,i),l=xV(e.shapeType,t,i),h=xV(e.shapeColor,t,i),c=xV(e.shapeFill,t,i),d=xV(e.shapeStroke,t,i),u=xV(e.shapeLineWidth,t,i),g=xV(e.shapeHollow,t,i),m=xV(e.keyStyle,t,i),f=xV(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class EV extends uN{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=SV(x.position,b,e),M=null!==(n=SV(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:gB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:mB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(ib(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=wN(t,e),j=wN(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(JN(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=tV(e.dimensionInfo,hB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(QN(t)){case"top":N=r-C*z-_;break;case"bottom":N=a+_;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-_;break;case"centerBottom":N=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=qN(t,c),N=qN(i,c),V=qN(e,c),G=qN(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=qN(t,c):Y(t),S(e)||d(e)?N=qN(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-w*z-V;else{const t=Z;switch(JN(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(QN(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,ib(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===JN(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===JN(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===QN(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===QN(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(JN(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(QN(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,xt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},PN),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:PN.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:PN.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ti(d.padding),x=ej(d.padding),S=iV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=iV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=iV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:sV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Rj({},A,iV(b,void 0,{})),{width:s,height:n,text:r}=CN(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Rj({},k,iV(x,void 0,{})),{width:e,height:s,text:n}=CN(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(V){Y=Rj({},S,iV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=CN(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,N=H+(O?T.title.spaceRow:0)}return P+=N,B+=N,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(ib(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=wN(t,s),u=wN(l,c)}return s*=d,n*=d,ib(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(Ie(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Ke([c,a,o],r.x,r.y)||Ke([c,l,h],r.x,r.y)||Ke([c,a,h],r.x,r.y)||Ke([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}EV.specKey="tooltip";const PV=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",BV=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let RV;const LV=(t=document.body)=>{if(u(RV)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),RV=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return RV};function OV(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Rj({},e,t),s={};return s.width=PV(i),s}(C),R=IV(E),L=IV(P),{bottom:O,left:I,right:D,top:F}=ej(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:PV(T+2*M),minHeight:PV(g+2*M),paddingBottom:PV(O),paddingLeft:PV(I),paddingRight:PV(D),paddingTop:PV(F),borderColor:k,borderWidth:PV(M),borderRadius:PV(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?PV(null==r?void 0:r.spaceRow):"0px"},IV(Rj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return DV.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=DV.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==eb?void 0:eb.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(DV.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}DV.type="tooltipModel";const FV={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},jV={boxSizing:"border-box"},zV={display:"inline-block",verticalAlign:"top"},HV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},NV={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},VV={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},GV={lineHeight:"normal",boxSizing:"border-box"};class WV extends DV{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=BV(u),y=t=>new Sg({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class UV extends DV{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const YV={overflowWrap:"normal",wordWrap:"normal"};class KV extends DV{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=et(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=et(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Rj({},zV,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Rj({},o?NV:HV,Object.assign(Object.assign(Object.assign({height:PV(l)},YV),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Rj({},VV,Object.assign(Object.assign(Object.assign({height:PV(s)},YV),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Rj({},GV,Object.assign(Object.assign({height:PV(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class XV extends DV{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new KV(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Rj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+BV(e)),0);return Object.assign(Object.assign({},t),{width:`${a+LV(this._option.getContainer())}px`,maxHeight:PV(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class $V extends DV{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new WV(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new UV(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Rj({},FV,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const qV="99999999999999";class ZV extends DV{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:qV,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new $V(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new XV(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Rj({},jV,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const JV=t=>{fz.registerComponentPlugin(t.type,t)};class QV extends EV{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(QV.type),this.type=AV.dom,this._tooltipContainer=null==eb?void 0:eb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(eb&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=OV(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!ii(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}QV.type=AV.dom;class tG extends EV{constructor(){super(tG.type),this.type=AV.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new JP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}tG.type=AV.canvas;const eG=()=>{JV(tG)},iG=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sG={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},nG=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tz([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return rG(a,n,o)},rG=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{ob(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{ob(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=sG[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},aG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{ob(t[e])||(t[e]=0)}))})),t};class oG extends GH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const lG=`${pB}_HIERARCHY_DEPTH`,hG=`${pB}_HIERARCHY_ROOT`,cG=`${pB}_HIERARCHY_ROOT_INDEX`;function dG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function uG(t,e,i){t&&(i.needDefaultSeriesField&&(t[kD]=i.defaultSeriesField),t[SD]=e,t[AD]=i.getKey(t,e,i))}function pG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function gG(t,e,i,s=0,n,r){void 0===r&&(r=e),uG(t,e,i),t[lG]=s,t[hG]=n||t[i.categoryField],t[cG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>gG(e,s,i,t[lG]+1,t[hG],r)))}const mG=["appear","enter","update","exit","disappear","normal"];function fG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Rj({},o[e],a);return xG(n)&&delete n.type,n.oneByOne&&(n=_G(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function vG(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),SG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function _G(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function yG(t,e){var i,s;return null!==(i=null==t?void 0:t[SD])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function bG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function xG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function SG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),SG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),SG(t[i],e)}function AG(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class kG extends TH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=IF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Dj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Rj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Rj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Rj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class MG extends wH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${pB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=AG(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"invalidTravel",aG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Qz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Jz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Jz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new oG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=rG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){Gz(this._dataSet,"dimensionStatistics",nG);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new _a(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tz(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Gz(this._dataSet,"dimensionStatistics",nG);const s=new _a(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tz(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tz(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new _a(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:sb(s)||nb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Rj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Rj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:rH.STATE_HOVER_REVERSE,highlightState:rH.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:rH.STATE_SELECTED_REVERSE,state:rH.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:kD;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:MD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,MD,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new uV(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=Object.assign(Object.assign(Object.assign({},ZD),JD),i)).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((i=>JD[i]&&!G(t[i],e[i])))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof _a||tH(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();AG(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:kD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new YF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return jF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:kD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Rj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:AD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ED&&t!==BD&&t!==CD&&t!==PD||(t=this.getStackValueField()),null!==(e=iz(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=OF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>ob(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:kD]}}function TG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Nw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function wG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}MG.mark=YD,MG.transformerConstructor=kG;class CG extends MG{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Nw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${pB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(BD),this.setFieldX2(PD)):(this.setFieldY(BD),this.setFieldY2(PD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(LD),this.setFieldX2(RD)):(this.setFieldY(LD),this.setFieldY2(RD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(TG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const EG="monotone",PG="linear";class BG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(eF.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===EG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(eF.point,{morph:bG(this._spec,eF.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new _a(this._option.dataSet,{name:`${pB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[eF.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Fz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Rj({},this._spec[eF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:rH.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class RG extends YH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Vw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class LG extends RG{constructor(){super(...arguments),this.type=LG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===dB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}LG.type="line";const OG=()=>{fz.registerMark(LG.type,LG),bM(),cM(),ER.registerGraphic(DB.line,Tg),nN()};class IG extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class DG extends IG{constructor(){super(...arguments),this.type=DG.type}}DG.type="symbol";const FG=()=>{fz.registerMark(DG.type,DG),xO()};class jG extends kG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class zG extends oN{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function HG(t,e,i,s){switch(t){case r.cartesianBandAxis:return jN(Mz(i,["z"]),"band",e);case r.cartesianLinearAxis:return jN(Mz(i,["z"]),"linear",e);case r.cartesianLogAxis:return jN(Mz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return jN(Mz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return jN(Mz(i),void 0,e);case r.polarBandAxis:return zN(i.orient,"band",e);case r.polarLinearAxis:return zN(i.orient,"linear",e);case r.polarAxis:return zN(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>Sz(t.orient)));let d;d=p(c)?Rj({},HN(c.type)?a:o,l):l;const u=n.find((t=>Az(t.orient)));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=BN(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Rj({},HN(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Rj({},Gw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return NG(i,BN(t,e));default:return BN(t,e)}}const NG=(t,e)=>{var i;const s=Rj({},e,e[Tz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class VG extends TH{getTheme(t,e){return HG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},ej(e)),{[s]:0}))}}class GG extends EH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new zG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=VG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof nc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new MH({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}GG.transformerConstructor=VG;class WG extends YH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(DB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WG.type="component";const UG=()=>{fz.registerMark(WG.type,WG)},YG=t=>t;class KG extends GG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?HB.circleAxisGrid:HB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fG(null===(o=fz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new GH(this._option,t)]}collectData(t,e){const i=[];return oB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Nw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return oB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(oB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_delegateAxisContainerEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uz(s=t.domainLine)).startSymbol=uz(s.startSymbol),s.endSymbol=uz(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mz(Rj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mz(t.tick.style)),t.tick.state&&(i.tick.state=pz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mz(Rj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mz(t.subTick.style)),t.subTick.state&&(i.subTick.state=pz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=LN[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Qt(p):null,textStyle:Rj({},d,mz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mz(h.style)}),h.state&&(i.title.state.shape=pz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mz(o.style)}),o.state&&(i.title.state.background=pz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mz(t.background.style)),t.background.state&&(i.panel.state=pz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mz(Rj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=RN(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Wz(this._option.dataSet,"scale",YG),Gz(this._option.dataSet,"ticks",qC);return new _a(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}KG.specKey="axes";const XG=()=>{ER.registerGraphicComponent(zB.lineAxis,((t,e)=>new Lw(t,e))),ER.registerGraphicComponent(zB.circleAxis,(t=>new Fw(t))),ER.registerComponent(FB.axis,VO),ER.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new tE(t,e))),ER.registerGraphicComponent(HB.circleAxisGrid,((t,e)=>new iE(t,e))),ER.registerComponent(FB.grid,UO),UG(),fz.registerAnimation("axis",(()=>({appear:{custom:zw},update:{custom:jw},exit:{custom:Kc}})))},$G=[TN];class qG extends KG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{const e=this.getOrient();Sz(e)?t.setXAxisHelper(this.axisHelper()):Az(e)?t.setYAxisHelper(this.axisHelper()):kz(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Rj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Rj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Sz(this.getOrient()),n=t=>{var e;return(s?!Sz(t.getOrient()):Sz(t.getOrient()))&&Nw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=Mz(i,["z"]),kz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!DN(e))return null;const{axisType:t,componentName:s}=wz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>Az(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!DN(t))return;const{axisType:s,componentName:n}=wz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];Sz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):kz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load($G.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){Sz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Sz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!kz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Az(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Sz(this.getOrient())?t.fieldX:kz(this.getOrient())?t.fieldZ:t.fieldY,Nw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(Sz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Sz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return oB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:Sz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:kz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();oB(this._regions,(e=>{Sz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Az(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):kz(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Sz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=Sz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Rj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return NN(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=IN(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=ZG?10:n>=JG?5:n>=QG?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}eW.type=r.cartesianLinearAxis,eW.specKey="axes",U(eW,tW);const iW=()=>{XG(),fz.registerComponent(eW.type,eW)};class sW{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=NN(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class nW extends qG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=eC(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{XG(),fz.registerComponent(nW.type,nW)};class aW extends eW{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{Sz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Rj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new GH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ci.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>NN(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}aW.type=r.cartesianTimeAxis,aW.specKey="axes";class oW extends eW{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new OC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}oW.type=r.cartesianLogAxis,oW.specKey="axes",U(oW,tW);class lW extends eW{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new IC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}lW.type=r.cartesianSymlogAxis,lW.specKey="axes",U(lW,tW);class hW extends CG{constructor(){super(...arguments),this.type=dB.line,this.transformerConstructor=jG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),vG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=dB.line,hW.mark=iF,hW.transformerConstructor=jG,U(hW,BG);class cW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{tH(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof _a)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{lb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tz(e,[{key:t,operations:Nw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tz(e,[{key:i.field,operations:Nw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?XF("colorOrdinal"):XF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(lb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),lb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!lb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Nw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Nw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Nw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Nw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Nw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=sz(t,!0);for(const e in a)for(const i in a[e].nodes)oz(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)az(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rz(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pW extends bH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ab(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:gB,height:mB},this._viewRect={width:gB,height:mB},this._viewBox={x1:0,y1:0,x2:gB,y2:mB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=ej(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new zz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new uW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=fz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=fz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof YH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof YH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&tH(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=dH(this._spec,this._option,{width:gB,height:mB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=jF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){uH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=jF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{uH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;if(i.type===r.label||i.type===r.totalLabel)return;const a=i.specKey||i.type,o=null!==(s=this._spec[a])&&void 0!==s?s:{};y(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,uH(t,i.updateSpec(null!==(n=o[i.getSpecIndex()])&&void 0!==n?n:{},o))):uH(t,i.updateSpec(o))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];uH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=tj(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rH.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rH.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(rH.STATE_SELECTED)}clearHovered(){this.clearState(rH.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Fz.dimensionHover||s===Fz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>Gw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const gW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class mW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);wj(t,r,l.spec),wj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));wj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=gW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(fz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=fz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=fz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class fW extends mW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Rj(i,pH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class vW extends fW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class _W extends pW{constructor(){super(...arguments),this.transformerConstructor=vW,this.type="line",this.seriesType=dB.line,this._canStack=!0}}_W.type="line",_W.seriesType=dB.line,_W.transformerConstructor=vW;class yW extends RG{constructor(){super(...arguments),this.type=yW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}yW.type="area";const bW=()=>{fz.registerMark(yW.type,yW),bM(),tM(),ER.registerGraphic(DB.area,Xg),nN()};class xW extends uV{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const SW=()=>{fz.registerAnimation("area",iN),sN(),tN()};class AW extends jG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Rj({},m.style,g.style),l.state=Rj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class kW extends CG{constructor(){super(...arguments),this.type=dB.area,this.transformerConstructor=AW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(kW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===EG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return $F(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return $F(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),vG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),vG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=wG(this);this._symbolMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new xW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}kW.type=dB.area,kW.mark=nF,kW.transformerConstructor=AW,U(kW,BG);class MW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),cH(t)}}class TW extends pW{constructor(){super(...arguments),this.transformerConstructor=MW,this.type="area",this.seriesType=dB.area,this._canStack=!0}}TW.type="area",TW.seriesType=dB.area,TW.transformerConstructor=MW;function wW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const CW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wW(t,e)}),EW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wW(t,e)}),PW={type:"fadeIn"},BW={type:"growCenterIn"};function RW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return PW;case"scaleIn":return BW;default:return CW(t)}}class LW extends YH{constructor(){super(...arguments),this.type=LW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}LW.type="rect";const OW=()=>{fz.registerMark(LW.type,LW),yO(),vO.useRegisters([UI,YI,KI,XI,GI,WI])};function IW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[KD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):$F(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[XD]):$F(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[$D]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):$F(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[qD]):$F(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},jW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:bG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(jW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Gz(this._option.dataSet,"addVChartProperty",iG),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Gz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new _a(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new oG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=qD,s=$D,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=XD,s=KD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sz(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)IW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=$F(this[n](t),o),d=$F(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[CD],n=t[ED],r=t[PD],h=t[BD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[CD]:i,[ED]:s}),a?{[PD]:o,[BD]:l}:void 0);t.push(Eg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>$F(this._dataToPosY(t),a),y1:t=>$F(this._dataToPosY1(t),a)}:{y:t=>$F(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>$F(this._dataToPosX(t),r),x1:t=>$F(this._dataToPosX1(t),r)}:{x:t=>$F(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=wG(this);this._barMark.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),vG(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=void 0!==this._spec.barWidth&&r===n,l=void 0!==this._spec.barMinWidth,h=void 0!==this._spec.barMaxWidth;let c=a;return o&&(c=sj(this._spec.barWidth,a)),l&&(c=Math.max(c,sj(this._spec.barMinWidth,a))),h&&(c=Math.min(c,sj(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sj(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=Nw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}jW.type=dB.bar,jW.mark=QD,jW.transformerConstructor=FW;const zW=()=>{aI(),OW(),fz.registerAnimation("bar",((t,e)=>({appear:RW(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t)}))),rW(),iW(),fz.registerSeries(jW.type,jW)};class HW extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),cH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class NW extends pW{constructor(){super(...arguments),this.transformerConstructor=HW,this.type="bar",this.seriesType=dB.bar,this._canStack=!0}}NW.type="bar",NW.seriesType=dB.bar,NW.transformerConstructor=HW;class VW extends YH{constructor(){super(...arguments),this.type=VW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}VW.type="rect3d";class GW extends jW{constructor(){super(...arguments),this.type=dB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}GW.type=dB.bar3d,GW.mark=tF;class WW extends HW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class UW extends NW{constructor(){super(...arguments),this.transformerConstructor=WW,this.type="bar3d",this.seriesType=dB.bar3d}}UW.type="bar3d",UW.seriesType=dB.bar3d,UW.transformerConstructor=WW;const YW=[10,20],KW=Iw.Linear,XW="circle",$W=Iw.Ordinal,qW=["circle","square","triangle","diamond","star"],ZW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class JW extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QW extends CG{constructor(){super(...arguments),this.type=dB.scatter,this.transformerConstructor=JW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${pB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${pB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KW,defaultRange:YW},"size")}getShapeAttribute(t,e){return u(e)?XW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:$W,defaultRange:qW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(QW.mark.point,{morph:bG(this._spec,QW.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=wG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),vG("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:XW},rH.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rH.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rH.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QW.type=dB.scatter,QW.mark=sF,QW.transformerConstructor=JW;const tU=()=>{FG(),fz.registerAnimation("scatter",((t,e)=>Object.assign({appear:ZW(0,e)},JH))),rW(),iW(),fz.registerSeries(QW.type,QW)};class eU extends fW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class iU extends pW{constructor(){super(...arguments),this.transformerConstructor=eU,this.type="scatter",this.seriesType=dB.scatter,this._canStack=!0}}iU.type="scatter",iU.seriesType=dB.scatter,iU.transformerConstructor=eU;Rn();const sU={},nU=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rU(t,e){t&&_(t)||db("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(sU[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Rn().projection(s),s.copy=s.copy||function(){const t=i();return nU.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),sU[i]||null}const aU={albers:Zn,albersusa:function(){var t,e,i,s,n,r,a=Zn(),o=qn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=qn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(aU).forEach((t=>{rU(t,aU[t])}));const oU="Feature",lU="FeatureCollection";function hU(t){const e=Y(t);return 1===e.length?e[0]:{type:lU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===lU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===oU?t:{type:oU,geometry:t}))}(e))),[])}}const cU=nU.concat(["pointRadius","fit","extent","size"]);function dU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{cU.includes(s)&&(i=i.concat(fR(t[s],e)))})),i):i}let uU=class extends tL{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(fR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(fR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(fR(this.spec.size,this.view)),this.spec.size=t,this.attach(fR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(fR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(fR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(fR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(fR(t,this.view)),this.commit(),this}configure(t){return this.detach(dU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(dU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=rU((t||"mercator").toLowerCase());return e||db("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),nU.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,_R(this.spec[t],e,rU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(_R(this.spec.pointRadius,e,rU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=hU(_R(this.spec.fit,e,rU));this.spec.extent?this.projection.fitExtent(_R(this.spec.extent,e,rU),t):this.spec.size&&this.projection.fitSize(_R(this.spec.size,e,rU),t)}return this.projection}output(){return this.projection}};const pU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class gU extends MG{constructor(){super(...arguments),this.type=dB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${pB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mU=`${pB}_MAP_LOOK_UP_KEY`,fU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[SD]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mU]=e.nameMap[n]:t[mU]=n})),t.features);class vU extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class _U extends YH{constructor(){super(...arguments),this.type=_U.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}_U.type="path";const yU=()=>{fz.registerMark(_U.type,_U),_O()};class bU{constructor(t){this.projection=rU(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class xU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class SU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function AU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:xU}:sb(e)||nb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:SU}:null}const kU={debounce:bt,throttle:xt};class MU{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=sb(this._renderMode)||nb(this._renderMode),AU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;if(u(n))return;if(!Ie({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let o={};i&&(o=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},o),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,kU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:Ie({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,kU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,kU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){AU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;Ie({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||AU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||AU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=kU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v),this._eventObj.allow(d)}),l),_=kU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(d,v);const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function TU(t,e){return`${pB}_${e}_${t}`}class wU extends GG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:TU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Rj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new bU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===dB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),oB(this._regions,(t=>{var e;if(t.type===dB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new ae})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===dB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}wU.type=r.geoCoordinate,U(wU,MU);const CU=()=>{fz.registerComponent(wU.type,wU)};class EU extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class PU extends gU{constructor(){super(...arguments),this.type=dB.map,this.transformerConstructor=EU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),Uz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Gz(this._dataSet,"copyDataView",Zz),Gz(this._dataSet,"map",fU),Gz(this._dataSet,"lookup",pU);const i=Uz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new _a(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:eH.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new oG(this._option,s)}initMark(){this._pathMark=this._createMark(PU.mark.area,{morph:bG(this._spec,PU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:kD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(fG(null===(t=fz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),vG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[SD]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[SD],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new ae}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new ae}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return SD}getActiveMarks(){return[this._pathMark]}}PU.type=dB.map,PU.mark=hF,PU.transformerConstructor=EU;const BU=()=>{ER.registerGrammar("projection",uU,"projections"),CU(),yU(),fz.registerSeries(PU.type,PU),fz.registerImplement("registerMap",Xz),fz.registerImplement("unregisterMap",$z),eN()},RU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[DD]=!0:delete t[DD]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=LU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=Kt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=LU(a,t,n,r,h,l,i,e),r.push(n)})),r};function LU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===vD)&&(t[vD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Zy("total.collectCountField error"):n=e[a].start;o<0?Zy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},DU={type:"fadeIn"},FU={type:"growCenterIn"};function jU(t,e){switch(e){case"fadeIn":return DU;case"scaleIn":return FU;default:return CW(t,!1)}}class zU extends YH{constructor(){super(...arguments),this.type=zU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}zU.type="rule";const HU=()=>{fz.registerMark(zU.type,zU),bO()},NU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new _a(e instanceof fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Gz(e,"dimensionTree",NU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WU extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UU={rect:qU,symbol:XU,arc:JU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=XU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:QU,line:tY,area:tY,rect3d:qU,arc3d:JU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=RN(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function KU(t){return d(t)?e=>t(e.data):t}function XU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=KU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:$U(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function $U(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function qU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=KU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:ZU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function ZU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function JU(t){var e;const{labelSpec:i}=t,s=null!==(e=KU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function QU(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=YU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),_p(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function tY(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class eY extends jW{constructor(){super(...arguments),this.type=dB.waterfall,this.transformerConstructor=WU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=vD)}getSeriesKeys(){return this._seriesField===vD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Gz(this._dataSet,"waterfallFillTotal",IU),Gz(this._dataSet,"waterfall",RU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Jz(this.getViewData(),this._dataSet,{name:`${pB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new oG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:CD,endAs:ED,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=wG(this);this._barMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),vG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(eY.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Kt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Kt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return QU(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?$F(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):$F(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}eY.type=dB.waterfall,eY.mark=_F,eY.transformerConstructor=WU;const iY=()=>{HU(),OW(),fz.registerAnimation("waterfall",((t,e)=>({appear:jU(t,e),enter:CW(t,!1),exit:EW(t,!1),disappear:EW(t,!1)}))),eN(),rW(),iW(),fz.registerSeries(eY.type,eY)},sY=`${pB}_BOX_PLOT_OUTLIER_VALUE`;var nY;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nY||(nY={}));const rY=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sY]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class aY extends uV{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return this.series.getOutliersField();if(t===nY.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nY.MIN:return this.series.getMinField();case nY.MAX:return this.series.getMaxField();case nY.MEDIAN:return this.series.getMedianField();case nY.Q1:return this.series.getQ1Field();case nY.Q3:return this.series.getQ3Field();case nY.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nY.OUTLIER)return e[sY];if(t===nY.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nY.MIN:return e[this.series.getMinField()];case nY.MAX:return e[this.series.getMaxField()];case nY.MEDIAN:return e[this.series.getMedianField()];case nY.Q1:return e[this.series.getQ1Field()];case nY.Q3:return e[this.series.getQ3Field()];case nY.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sY])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(nY.OUTLIER),value:this.getContentValue(nY.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(nY.MAX),value:this.getContentValue(nY.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q3),value:this.getContentValue(nY.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MEDIAN),value:this.getContentValue(nY.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.Q1),value:this.getContentValue(nY.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.MIN),value:this.getContentValue(nY.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(nY.SERIES_FIELD),value:this.getContentValue(nY.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class oY extends YH{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}oY.type="boxPlot";const lY=()=>{fz.registerMark(oY.type,oY),ER.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(wO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Sb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Sb(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),ER.registerAnimationType("boxplotScaleIn",CO),ER.registerAnimationType("boxplotScaleOut",EO),AO(),yO(),bO(),ER.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(BO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Sb(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),ER.registerAnimationType("barBoxplotScaleIn",RO),ER.registerAnimationType("barBoxplotScaleOut",LO),AO(),yO(),bO()};class hY extends CG{constructor(){super(...arguments),this.type=dB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(hY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(hY.mark.outlier,{progressive:t,key:SD,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,rH.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rH.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>$F(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>$F(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>$F(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>$F(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>$F(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},rH.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>$F(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>$F(e(this.getDatumPositionValues(t,sY),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,rH.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"foldOutlierData",rY),Gz(this._dataSet,"addVChartProperty",iG);const t=new _a(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${pB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._outlierDataView=new oG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=wG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=fz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(vG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(fG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(fG(null===(a=fz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aY(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}hY.type=dB.boxPlot,hY.mark=yF;class cY extends YH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}cY.type="text";const dY=()=>{fz.registerMark(cY.type,cY),SO(),bM(),_M(),ER.registerGraphic(DB.richtext,Vg)};function uY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class pY extends uV{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const gY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),mY={type:"fadeIn"},fY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vY(t,e){return"fadeIn"===e?mY:gY(t)}class _Y extends FW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class yY extends jW{constructor(){super(...arguments),this.type=dB.rangeColumn,this._barMarkType="rect",this._barName=dB.bar,this.transformerConstructor=_Y}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yY.mark.bar,{morph:bG(this._spec,yY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(yY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(yY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});uY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});uY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=wG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),vG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(fG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}yY.type=dB.rangeColumn,yY.mark=MF,yY.transformerConstructor=_Y;const bY=()=>{OW(),dY(),fz.registerAnimation("rangeColumn",((t,e)=>({appear:vY(t,e),enter:gY(t),exit:fY(t),disappear:fY(t)}))),eN(),rW(),iW(),fz.registerSeries(yY.type,yY)};class xY extends yY{constructor(){super(...arguments),this.type=dB.rangeColumn3d,this._barMarkType="rect3d",this._barName=dB.bar3d}}xY.type=dB.rangeColumn3d,xY.mark=TF;class SY extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class AY extends kW{constructor(){super(...arguments),this.type=dB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(AY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new SY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}AY.type=dB.rangeArea,AY.mark=PF;class kY extends MG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=LB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Nw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Nw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&TG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const MY=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{asStartAngle:s,asEndAngle:n,asMiddleAngle:r,asRadian:a,asRatio:o,asQuadrant:l,asK:h}=e,c=e.angleField(),d=e.startAngle(),u=e.endAngle(),p=e.minAngle(),g=(t,e,i)=>{t[s]=e,t[n]=e+i,t[r]=e+i/2,t[a]=i,t[l]=function(t){return(t=ne(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[c]))),y=u-d;let b=d,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[SB],s=m?i/m:0;let n=s*y;n{g(e,d+i*t,t)}))}else{const t=x/S;b=d,i.forEach((e=>{const i=e[a]===p?p:e[SB]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][n]=u),i};function TY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const wY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:TY(t,!0,sH.appear)}),CY={type:"fadeIn"},EY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:TY(t,!0,sH.enter)}),PY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:TY(t,!0,sH.exit)}),BY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:TY(t,!0,sH.exit)});function RY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CY;case"growRadius":return wY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return wY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class LY extends YH{constructor(t,e){super(t,e),this.type=OY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>ie({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[wB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class OY extends LY{constructor(){super(...arguments),this.type=OY.type}}OY.type="arc";const IY=()=>{bM(),Jk(),ER.registerGraphic(DB.arc,Zg),vO.useRegisters([sD,nD,eD,iD]),fz.registerMark(OY.type,OY)};class DY extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Rj({},this._theme,i,t);const n=(t,e)=>Rj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const FY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:RB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:LB,layoutRadius:e.layoutRadius}},jY=(t,e,i,s=0,n=0*Math.PI)=>{if(S(t))return t;if(d(t))return t(e(),i());const r=e();return"auto"===t&&r.width>0&&r.height>0?re(r,i(),s,n):Math.min(r.width/2,r.height/2)};class zY extends kY{constructor(){super(...arguments),this.transformerConstructor=DY,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}},this._startAngle=PB,this._endAngle=BB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[wB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ie(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?Qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Qt(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?Qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Gz(this._dataSet,"pie",MY),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Qt(this._spec.minAngle):0,asStartAngle:kB,asEndAngle:MB,asRatio:AB,asMiddleAngle:wB,asRadian:EB,asQuadrant:CB,asK:TB}},!1);const e=new _a(this._dataSet,{name:`${pB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new oG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},zY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:bG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:AD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return cB(kB)(t)}endAngleScale(t){return cB(MB)(t)}_computeLayoutRadius(){return jY(this._spec.layoutRadius,this.getLayoutRect,this.getCenter,this._startAngle,this._endAngle)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:qF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:qF(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:cB(yB).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[wB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ie(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===sH.appear)return this._startAngle;if(i===sH.disappear)return this._endAngle;const n=[sH.disappear,sH.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[SD];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[SD])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[wB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[wB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[wB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[wB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}zY.transformerConstructor=DY,zY.mark=aF;class HY extends zY{constructor(){super(...arguments),this.type=dB.pie}}HY.type=dB.pie;const NY=()=>{IY(),fz.registerAnimation("pie",((t,e)=>({appear:RY(t,e),enter:EY(t),exit:PY(t),disappear:BY(t)}))),fz.registerSeries(HY.type,HY)};class VY extends LY{constructor(){super(...arguments),this.type=VY.type,this._support3d=!0}}VY.type="arc3d";class GY extends DY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class WY extends zY{constructor(){super(...arguments),this.type=dB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=GY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[wB];return"inside"===i.position?te(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}WY.type=dB.pie3d,WY.mark=oF,WY.transformerConstructor=GY;const UY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},YY={type:"fadeIn"},KY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),XY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),$Y=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function qY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return YY;case"growAngle":return UY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return UY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class ZY extends kY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(ED),this.setInnerRadiusField(CD)}setValueFieldToPercent(){this.setRadiusField(BD),this.setInnerRadiusField(PD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class JY extends kG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class QY extends KG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!FN(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=FY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s,n;const r=[],a=[];return e.forEach(((e,o)=>{if(!FN(e))return;const{axisType:l,componentName:h,startAngle:c,endAngle:d,center:u,outerRadius:p,layoutRadius:g}=FY(e,t);e.center=u,e.startAngle=c,e.endAngle=d,e.outerRadius=p,e.type=l,e.layoutRadius=g;const m={spec:e,specPath:[this.specKey,o],specInfoPath:["component",this.specKey,o],type:h};i.push(m),"radius"===e.orient?(r.push(m),n=o):(a.push(m),s=o)})),r.forEach((t=>{t.angleAxisIndex=s})),a.forEach((t=>{t.radiusAxisIndex=n})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=fz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=PB,this._endAngle=BB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),oB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Qt(this._spec.startAngle),this._endAngle=Qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:ON(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){oB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Nw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Nw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ie(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>NN(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=$t.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return jY(this._spec.layoutRadius,this.getRefLayoutRect,this.getCenter,this._startAngle,this._endAngle)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=LB,e=0;const i=this.getChart().getSpec();return oB(this.getRegions(),(s=>{const n=s;if(r=n.type,[dB.rose,dB.radar,dB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Rj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Rj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}QY.type=r.polarAxis,QY.specKey="axes";class tK extends QY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new BC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}tK.type=r.polarLinearAxis,tK.specKey="axes",U(tK,tW);const eK=()=>{XG(),fz.registerComponent(tK.type,tK)};class iK extends QY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}iK.type=r.polarBandAxis,iK.specKey="axes",U(iK,sW);const sK=()=>{XG(),fz.registerComponent(iK.type,iK)};class nK extends ZY{constructor(){super(...arguments),this.type=dB.rose,this.transformerConstructor=JY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(nK.mark.rose,{morph:bG(this._spec,nK.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>$F(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=$F(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),vG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}nK.type=dB.rose,nK.mark=lF,nK.transformerConstructor=JY;const rK=()=>{fz.registerSeries(nK.type,nK),IY(),fz.registerAnimation("rose",((t,e)=>({appear:qY(t,e),enter:KY(t),exit:XY(t),disappear:$Y(t)}))),sK(),eK()};class aK extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from),{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,QP(this._fromAngle,this._toAngle)&&QP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class oK extends Gc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1});let r=ne(s.angle),a=ne(n.angle);const o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1});let h=ne(o.angle),c=ne(l.angle);!k(r)&&k(h)&&(r=h),k(r)&&!k(h)&&(h=r),!k(a)&&k(c)&&(a=c),k(a)&&!k(c)&&(c=a);const d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new Xt(m,f,v,_);return y.defined=e.defined,y}}const lK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function hK(t,e,i){return"fadeIn"===e?lK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function cK(t,e,i){return"fadeIn"===e?lK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const dK=(t,e)=>({custom:Uc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class uK extends ZY{constructor(){super(...arguments),this.type=dB.radar,this.transformerConstructor=jG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(uK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:PG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?Qt(this._spec.startAngle):PB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),vG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=fz.getAnimationInKey(e);t.setAnimationConfig(fG(null==i?void 0:i(n,r),vG(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}uK.type=dB.radar,uK.mark=rF,uK.transformerConstructor=jG,U(uK,BG);const pK=()=>{fz.registerSeries(uK.type,uK),oI(),bW(),OG(),FG(),fz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:hK(t,e,"in"),enter:hK(t,e,"in"),exit:hK(t,e,"out"),disappear:"clipIn"===e?void 0:hK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:oK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:cK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:cK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:aK,customParameters:t,duration:ZH.update.duration,easing:ZH.update.easing}]}))),fz.registerAnimation("radarGroup",((t,e)=>({appear:dK(t,"in"),disappear:dK(t,"out")}))),Jk(),sK(),eK()};class gK extends uV{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>ci.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const mK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},fK={fill:"#bbb",fillOpacity:.2};class vK extends CG{constructor(){super(...arguments),this.type=dB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Gz(this._option.dataSet,"objFlat",mK),Gz(this._option.dataSet,"copyDataView",Zz),Wz(this._option.dataSet,"dataview",pa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:eH.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Rj(fK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(vK.mark.group),this._containerMark=this._createMark(vK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(vK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(vK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(vK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(vK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(vK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(vK.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new YF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:kD}}initTooltip(){this._tooltipHelper=new gK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}vK.type=dB.dot,vK.mark=pF;class _K extends uV{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>ci.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const yK=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class bK extends CG{constructor(){super(...arguments),this.type=dB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Gz(this._option.dataSet,"linkDotInfo",yK),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:eH.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(bK.mark.group),this._containerMark=this._createMark(bK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(bK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(bK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:kD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new _K(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}bK.type=dB.link,bK.mark=uF;class xK extends kY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?CD:FD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Qt(i.offsetAngle);let o;if(p(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ED:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Qt(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?Qt(n):PB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Qt(r):BB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[CD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=$F(this.angleAxisHelper.dataToPosition([t[ED]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(xK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+Qt(s),n=Qt(i)/2;return Zg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Eg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const kK=()=>{fz.registerAnimation("circularProgress",((t,e)=>({appear:AK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class MK extends kG{constructor(){super(...arguments),this._supportStack=!0}}class TK extends xK{constructor(){super(...arguments),this.type=dB.circularProgress,this.transformerConstructor=MK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(TK.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(TK.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?CD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ED:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}TK.type=dB.circularProgress,TK.mark=dF,TK.transformerConstructor=MK;function wK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const CK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wK(t)}),EK={type:"fadeIn"};function PK(t,e){return!1===e?{}:"fadeIn"===e?EK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wK(t)}))(t)}class BK extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class RK extends CG{constructor(){super(...arguments),this.type=dB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(RK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return $F(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(RK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return $F(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return $F(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(RK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=$F(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Eg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=$F(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Eg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),vG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new BK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}RK.type=dB.linearProgress,RK.mark=vF;const LK=()=>{OW(),fz.registerAnimation("linearProgress",((t,e)=>({appear:PK(t,e),enter:{type:"grow"},disappear:CK(t)}))),eN(),fz.registerSeries(RK.type,RK)},OK=[0],IK=[20,40],DK=[200,500],FK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},jK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],zK=`${pB}_WORD_CLOUD_WEIGHT`,HK=`${pB}_WORD_CLOUD_TEXT`;class NK extends MG{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=IK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:DK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:OK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?HK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:FK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:OK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!jK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(NK.mark.word,{key:AD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(fG(fz.getAnimationInKey("wordCloud")(n,s),vG("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new YF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:kD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new BC,o=this._fontWeightRange;if(r){const[e,i]=fb(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:zK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:HK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:ib(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:AD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:zK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:AD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:zK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}NK.mark=gF;function VK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||ZH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function WK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function UK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const YK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function KK(t){return d(t)?t:function(){return t}}class XK{constructor(t){var e,i,s;switch(this.options=z({},XK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,GK[s]?GK[s]():GK.circle()),this.getText=null!==(e=KK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=KK(this.options.fontWeight),this.getTextFontSize=KK(this.options.fontSize),this.getTextFontStyle=KK(this.options.fontStyle),this.getTextFontFamily=KK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>YK(10,50);break;case"random-light":this.getTextColor=()=>YK(50,90);break;default:this.getTextColor=KK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return Qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return Qt(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class qK extends XK{constructor(t){var e;super(z({},qK.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=qK.defaultOptions.minFontSize&&(this.options.minFontSize=qK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=$K[this.options.spiral])&&void 0!==e?e:$K.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=KK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=UK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(L_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(tX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(QK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}tX(p,this._size)&&(p=eX(p,this._size))}else if(tX(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||JK(p,i))&&(!i||!ZK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function ZK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function JK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,tX=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function eX(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=UK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}sX.defaultOptions={enlarge:!1};const rX={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},aX=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?oX(t.fontFamily):"sans-serif",d=t.fontStyle?oX(t.fontStyle):"normal",u=t.fontWeight?oX(t.fontWeight):"normal",p=t.rotate?oX(t.rotate):0,g=oX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?oX(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||rX,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?oX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=hX(cX(t,l),C);w=i=>e(t(i))}let E=qK;"fast"===t.layoutType?E=sX:"grid"===t.layoutType&&(E=iX);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},oX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],lX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),hX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=lX(t[0]),s=lX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(lX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},cX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function dX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{ER.registerTransform("wordcloud",{transform:aX,markPhase:"beforeJoin"},!0),dY(),fz.registerAnimation("wordCloud",((t,e)=>({appear:VK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),fz.registerSeries(uX.type,uX)};(class extends NK{constructor(){super(...arguments),this.type=dB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(NK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),vG("word",this._spec,this._markAttributeContext)))}}).type=dB.wordCloud3d;const gX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},mX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},fX=`${pB}_FUNNEL_TRANSFORM_RATIO`,vX=`${pB}_FUNNEL_REACH_RATIO`,_X=`${pB}_FUNNEL_HEIGHT_RATIO`,yX=`${pB}_FUNNEL_VALUE_RATIO`,bX=`${pB}_FUNNEL_LAST_VALUE_RATIO`,xX=`${pB}_FUNNEL_NEXT_VALUE_RATIO`,SX=`${pB}_FUNNEL_LAST_VALUE`,AX=`${pB}_FUNNEL_CURRENT_VALUE`,kX=`${pB}_FUNNEL_NEXT_VALUE`,MX=`${pB}_FUNNEL_TRANSFORM_LEVEL`,TX=20;class wX extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[vX])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class CX extends YH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class EX extends CX{constructor(){super(...arguments),this.type=EX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}EX.type="polygon";const PX=()=>{fz.registerMark(EX.type,EX),bM(),gM(),ER.registerGraphic(DB.polygon,tm),vO.useRegisters([$I,qI])};class BX extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class RX extends MG{constructor(){super(...arguments),this.type=dB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=BX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Gz(this._dataSet,"funnel",gX),Gz(this._dataSet,"funnelTransform",mX);const t=new _a(this._dataSet,{name:`${pB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new oG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:AX,asTransformRatio:fX,asReachRatio:vX,asHeightRatio:_X,asValueRatio:yX,asNextValueRatio:xX,asLastValueRatio:bX,asLastValue:SX,asNextValue:kX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:MX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},RX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:bG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},RX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(RX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(RX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new wX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*cB(vX).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),vG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(fG(fz.getAnimationInKey("fadeInOut")(),vG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(fG(fz.getAnimationInKey("funnel")({},o),vG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(fG(null===(a=fz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),vG("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[bX])/2:this._getSecondaryAxisLength(t[yX])/2,n=this._getSecondaryAxisLength(t[yX])/2):(s=this._getSecondaryAxisLength(t[yX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[xX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[MX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[AD]===t[AD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?TX:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y{PX(),dY(),HU(),fz.registerSeries(RX.type,RX),fz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},QH))),fz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Yc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),eN()};class OX extends CX{constructor(){super(...arguments),this.type=OX.type}}OX.type="pyramid3d";class IX extends BX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class DX extends RX{constructor(){super(...arguments),this.type=dB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=IX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},DX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},DX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(DX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(DX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}DX.type=dB.funnel3d,DX.mark=fF,DX.transformerConstructor=IX;const FX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},jX=t=>{const e=t.mark.elements.filter((t=>t.diffState===IB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},zX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},HX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=jX(i),a=zX(r,s,n);return FX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=jX(i),a=zX(r,s,n);return FX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),NX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},VX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=jX(i),a=NX(r);return FX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=jX(i),a=NX(r);return FX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},WX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):WX(t.children,e,i)))})),e};function UX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=XX(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,Tt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=Tt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},$X=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=$X(t.children,e,t,n))})),s},qX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=qX(t.children,e,t,n)),n=e(t,s,i,n)})),n},ZX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:UX,slice:YX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?YX:UX)(t,e,i,s,n)}};class JX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},JX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?pb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?KX(this.options.aspectRatio):null!==(e=ZX[this.options.splitType])&&void 0!==e?e:ZX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=XX(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}JX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const QX=(t,e)=>{const i=new JX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return WX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},t$={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class e${constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];UX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),t$);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},e$.defaultOpionts,t):Object.assign({},e$.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?pb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+_b(this.options.center[0],t.width),s=t.y0+_b(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>_b(t,n))):_b(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>_b(t,n))):_b(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=_b(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=XX(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ie({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}e$.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const i$=4294967296;function s$(t,e){let i,s;if(a$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function a$(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function c$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function d$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function u$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function p$(t){return{_:t,next:null,prev:null}}function g$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];c$(n,s,r);let a,o,l,h,c,d,u,p=p$(s),g=p$(n),m=p$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=XX(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%i$)/i$}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:_$.defaultOpionts.nodeSort;$X([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)$X([o],m$(h)),qX([o],f$(this._getPadding,.5,a)),$X([o],v$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);$X([o],m$(_$.defaultOpionts.setRadius)),qX([o],f$(mb,1,a)),c&&qX([o],f$(this._getPadding,o.radius/t,a)),$X([o],v$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}_$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const y$=(t,e={})=>{if(!t)return[];const i=[];return WX(t,i,e),i},b$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new e$(i).layout(t,{width:s,height:n})};class x$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var S$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(S$||(S$={}));const A$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===S$.DrillDown){return Y(hz(t,n,s,"children"))}if(i.type===S$.DrillUp){const e=cz(t,n,s,"children");if(e)return Y(e)}return t};class k${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Gz(t,"drillFilter",A$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:S$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:S$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:S$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:S$.DrillUp},model:this}),r}}class M$ extends kY{constructor(){super(...arguments),this.type=dB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._startAngle=Qt(this._spec.startAngle),this._endAngle=Qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"sunburstLayout",b$),Gz(this._dataSet,"flatten",y$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(M$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(M$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new x$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}M$.type=dB.sunburst,M$.mark=kF,U(M$,k$);const T$=()=>{fz.registerSeries(M$.type,M$),IY(),dY(),eN(),fz.registerAnimation("sunburst",((t,e)=>({appear:GX(0,e),enter:HX(t),exit:VX(t),disappear:VX(t)})))},w$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new _$(i).layout(t,{width:s,height:n})};class C$ extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const E$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class P$ extends CG{constructor(){super(...arguments),this.type=dB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:AD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Gz(this._dataSet,"circlePackingLayout",w$),Gz(this._dataSet,"flatten",y$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Gz(t.dataSet,"addVChartProperty",iG),t.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(P$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(P$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rH.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}P$.type=dB.circlePacking,P$.mark=wF,U(P$,k$);const B$=()=>{fz.registerSeries(P$.type,P$),IY(),dY(),tN(),fz.registerAnimation("circlePacking",((t,e)=>({appear:E$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},R$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=R$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function L$(t){return t.depth}function O$(t,e){return e-1-t.endDepth}const I$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),D$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},F$={left:L$,right:O$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:L$,end:O$},j$=_t(0,1);class z${constructor(t){this._ascendingSourceBreadth=(t,e)=>I$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>I$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},z$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?pb(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):F$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Ab(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Ab(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];R$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[D$(s[t.source]),D$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=ft(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(a=()=>s,this._gapY=s,(n+s)*e>this._viewBox.height&&(n=i-s),this.options.equalNodeHeight)o=this._viewBox.height/e-s;else{const e=n>0?Math.max(s,n):s;r=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+n))/s)}),1/0)}}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*j$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(u/=i.length-1,r+u>=0)){r+=u,this._gapY=Math.min(r);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(I$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(I$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new z$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},N$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&N$(t,e.children,i)}))},V$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},G$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new z$(e),r=[];return r.push(n.layout(s,i)),r},W$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},U$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class Y$ extends uV{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const K$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),X$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:K$(t),$$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class q$ extends YH{constructor(){super(...arguments),this.type=q$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}q$.type="linkPath";const Z$=()=>{ER.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(DO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),ER.registerAnimationType("linkPathGrowIn",FO),ER.registerAnimationType("linkPathGrowOut",jO),ER.registerAnimationType("linkPathUpdate",zO),AO(),_O(),fz.registerMark(q$.type,q$)};class J$ extends CG{constructor(){super(...arguments),this.type=dB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Zt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(rH.STATE_SANKEY_EMPHASIS),e.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS)):(t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(rH.STATE_SANKEY_EMPHASIS),void s.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(rH.STATE_SANKEY_EMPHASIS),s.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[rH.STATE_SANKEY_EMPHASIS,rH.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(rH.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(rH.STATE_SANKEY_EMPHASIS),void t.addState(rH.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(rH.STATE_SANKEY_EMPHASIS),t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Gz(this._dataSet,"sankeyLayout",G$),Gz(this._dataSet,"sankeyFormat",V$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:eH.sankeyLayout});const{dataSet:a}=this._option;Gz(a,"sankeyNodes",W$),Gz(a,"flatten",y$);const o=new _a(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._nodesSeriesData=new oG(this._option,o),Gz(a,"sankeyLinks",U$);const l=new _a(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:dG.bind(this),call:uG}},!1),this._linksSeriesData=new oG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(J$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(J$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(J$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},rH.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rH.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),vG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),vG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(fG(null===(n=fz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vG("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([rH.STATE_SANKEY_EMPHASIS_REVERSE,rH.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(rH.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new Y$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new YF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return N$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}J$.type=dB.sankey,J$.mark=xF;const Q$=()=>{ER.registerTransform("sankey",{transform:H$,markPhase:"beforeJoin"},!0),OW(),Z$(),dY(),fz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:X$(t,e)},QH))),fz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:$$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),eN(),fz.registerSeries(J$.type,J$)},tq=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=y$(n);return i=nG([{latestData:r}],e),i};class eq extends uV{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const iq=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class sq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class nq extends CG{constructor(){super(...arguments),this.type=dB.treemap,this.transformerConstructor=sq,this._viewBox=new Zt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:hG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ae),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:AD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[hG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Gz(this._rawData.dataSet,"addVChartProperty",iG),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:pG.bind(this),call:gG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Gz(this._dataSet,"hierarchyDimensionStatistics",tq),Gz(this._dataSet,"flatten",y$);const i=new _a(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:lG,operations:["max","min","values"]},{key:hG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(nq.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(nq.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rH.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},rH.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new eq(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}nq.type=dB.treemap,nq.mark=bF,nq.transformerConstructor=sq,U(nq,k$),U(nq,MU);const rq=()=>{OW(),dY(),fz.registerAnimation("treemap",((t,e)=>({appear:iq(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),eN(),ER.registerTransform("treemap",{transform:QX,markPhase:"beforeJoin"},!0),fz.registerSeries(nq.type,nq)},aq={type:"fadeIn"};function oq(t,e){return"fadeIn"===e?aq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class lq extends kG{constructor(){super(...arguments),this._supportStack=!1}}class hq extends xK{constructor(){super(...arguments),this.type=dB.gaugePointer,this.transformerConstructor=lq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(hq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},hq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(hq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=ft(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}hq.type=dB.gaugePointer,hq.mark=AF,hq.transformerConstructor=lq;const cq=()=>{fz.registerSeries(hq.type,hq),yU(),OW(),fz.registerAnimation("gaugePointer",((t,e)=>{const i=oq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),sK(),eK()};class dq extends kG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class uq extends xK{constructor(){super(...arguments),this.type=dB.gauge,this.transformerConstructor=dq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Gz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[jD]=t[this._angleField[0]],t[FD]=e>0?i[e-1][jD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(uq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(uq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return _t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return _t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[FD])?this.angleAxisHelper.dataToPosition([t[FD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[jD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}uq.type=dB.gauge,uq.mark=SF,uq.transformerConstructor=dq;class pq extends IG{constructor(){super(...arguments),this.type=pq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}pq.type="cell";const gq=()=>{fz.registerMark(pq.type,pq),bM(),SM(),ER.registerGraphic(DB.cell,Ag),ER.registerMark(DB.cell,uD)};function mq(t){return!1===t?{}:{type:"fadeIn"}}class fq extends uV{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class vq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class _q extends CG{constructor(){super(...arguments),this.type=dB.heatmap,this.transformerConstructor=vq}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(_q.mark.cell,{morph:bG(this._spec,_q.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(_q.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ti(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=wG(this);this._cellMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),vG("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new fq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}_q.type=dB.heatmap,_q.mark=CF,_q.transformerConstructor=vq;const yq=()=>{dY(),gq(),fz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},QH),{appear:mq(e)}))),rW(),iW(),fz.registerSeries(_q.type,_q)},bq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=Qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=Qt(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=_b(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=_b(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+_b(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+_b(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=pb(e.field),C=t.map(w),[E,P]=fb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:pb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?fb(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=xq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),Sq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Sq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[SD]:null==n?void 0:n[SD],[kD]:null==n?void 0:n[kD]}};class kq extends YH{constructor(){super(...arguments),this.type=kq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}kq.type="ripple";const Mq=()=>{fz.registerMark(kq.type,kq),ER.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),AO(),xO()},Tq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class wq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Cq extends kY{constructor(){super(...arguments),this.type=dB.correlation,this.transformerConstructor=wq,this._viewBox=new Zt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Gz(this._dataSet,"correlation",bq);const s=new fa;Wz(s,"dataview",pa),Gz(s,"correlationCenter",Aq);const n=new _a(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new oG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(Cq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:SD,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(Cq.mark.ripplePoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Cq.mark.centerPoint,{key:SD,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[_D],y:t=>t[yD],size:t=>t[bD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},rH.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},rH.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),vG("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}Cq.type=dB.correlation,Cq.mark=EF,Cq.transformerConstructor=wq;const Eq=()=>{FG(),Mq(),fz.registerSeries(Cq.type,Cq),fz.registerAnimation("correlation",((t,e)=>Object.assign({appear:Tq(0,e)},JH)))};class Pq extends YH{constructor(){super(...arguments),this.type=Pq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Pq.type="liquid";const Bq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class Rq extends uV{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Lq extends MG{constructor(){super(...arguments),this.type=dB.liquid,this.transformerConstructor=jG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Ag({x:s,y:n,size:r,symbolType:Bq(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=ej(this._spec.outlineMargin),this._paddingSpec=ej(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=It(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Lq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Lq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Lq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Lq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Rq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(fG(null===(i=fz.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),vG("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(fG(null===(s=fz.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),vG("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=HM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Lq.type=dB.liquid,Lq.mark=BF,Lq.transformerConstructor=jG;const Oq=t=>Y(t).join(",");class Iq extends uV{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Oq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Oq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Dq extends kG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Fq extends MG{constructor(){super(...arguments),this.type=dB.venn,this.transformerConstructor=Dq,this._viewBox=new Zt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:AD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(Fq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Fq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},rH.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},rH.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},rH.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Oq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},rH.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Oq(t.sets)},rH.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Iq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Oq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Oq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Oq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Oq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(fG(null===(e=fz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),vG(t.name,this._spec,this._markAttributeContext)))}))}}Fq.type=dB.venn,Fq.mark=RF,Fq.transformerConstructor=Dq;class jq extends mW{_isValidSeries(t){return t===dB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class zq extends pW{constructor(){super(...arguments),this.transformerConstructor=jq,this.type="map",this.seriesType=dB.map}}zq.type="map",zq.seriesType=dB.map,zq.transformerConstructor=jq;class Hq extends mW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Nq extends Hq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=IN(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Rj({},s,l)),n&&Object.assign(o,Rj({},n,o))}}class Vq extends Hq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Gq extends Hq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,layoutRadius:t.layoutRadius})}}class Wq extends pW{constructor(){super(...arguments),this.transformerConstructor=Gq}}Wq.transformerConstructor=Gq;class Uq extends Wq{constructor(){super(...arguments),this.transformerConstructor=Gq,this.type="pie",this.seriesType=dB.pie}}Uq.type="pie",Uq.seriesType=dB.pie,Uq.transformerConstructor=Gq;class Yq extends Gq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Kq extends Wq{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="pie3d",this.seriesType=dB.pie3d}}Kq.type="pie3d",Kq.seriesType=dB.pie3d,Kq.transformerConstructor=Yq;class Xq extends Vq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:LB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:LB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class $q extends pW{constructor(){super(...arguments),this.transformerConstructor=Xq,this.type="rose",this.seriesType=dB.rose,this._canStack=!0}}$q.type="rose",$q.seriesType=dB.rose,$q.transformerConstructor=Xq;class qq extends Vq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Rj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Rj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Zq extends pW{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="radar",this.seriesType=dB.radar,this._canStack=!0}}Zq.type="radar",Zq.seriesType=dB.radar,Zq.transformerConstructor=qq;class Jq extends mW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Rj(e,pH(this.type,t))})),this._transformAxisSpec(t)}}class Qq extends pW{constructor(){super(...arguments),this.transformerConstructor=Jq,this.type="common",this._canStack=!0}}Qq.type="common",Qq.transformerConstructor=Jq;class tZ extends fW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class eZ extends pW{constructor(){super(...arguments),this.transformerConstructor=tZ,this._canStack=!0}}eZ.transformerConstructor=tZ;class iZ extends tZ{transformSpec(t){super.transformSpec(t),cH(t)}}class sZ extends eZ{constructor(){super(...arguments),this.transformerConstructor=iZ,this.type="histogram",this.seriesType=dB.bar}}sZ.type="histogram",sZ.seriesType=dB.bar,sZ.transformerConstructor=iZ;class nZ extends eZ{constructor(){super(...arguments),this.transformerConstructor=iZ,this.type="histogram3d",this.seriesType=dB.bar3d}}nZ.type="histogram3d",nZ.seriesType=dB.bar3d,nZ.transformerConstructor=iZ;class rZ extends Nq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class aZ extends pW{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="circularProgress",this.seriesType=dB.circularProgress,this._canStack=!0}}aZ.type="circularProgress",aZ.seriesType=dB.circularProgress,aZ.transformerConstructor=rZ;class oZ extends Nq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:dB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===dB.gauge||t.type===dB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===dB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class lZ extends pW{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="gauge",this.seriesType=dB.gaugePointer}}lZ.type="gauge",lZ.seriesType=dB.gaugePointer,lZ.transformerConstructor=oZ;class hZ extends mW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class cZ extends pW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}cZ.transformerConstructor=hZ;class dZ extends hZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class uZ extends cZ{constructor(){super(...arguments),this.transformerConstructor=dZ,this.type="wordCloud",this.seriesType=dB.wordCloud}}uZ.type="wordCloud",uZ.seriesType=dB.wordCloud,uZ.transformerConstructor=dZ;class pZ extends hZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class gZ extends cZ{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="wordCloud3d",this.seriesType=dB.wordCloud3d}}gZ.type="wordCloud3d",gZ.seriesType=dB.wordCloud3d,gZ.transformerConstructor=pZ;class mZ extends mW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class fZ extends pW{constructor(){super(...arguments),this.transformerConstructor=mZ,this.type="funnel",this.seriesType=dB.funnel}}fZ.type="funnel",fZ.seriesType=dB.funnel,fZ.transformerConstructor=mZ;class vZ extends pW{constructor(){super(...arguments),this.transformerConstructor=mZ,this.type="funnel3d",this.seriesType=dB.funnel3d}}vZ.type="funnel3d",vZ.seriesType=dB.funnel3d,vZ.transformerConstructor=mZ;class _Z extends fW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=IN(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=IN(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class yZ extends pW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="linearProgress",this.seriesType=dB.linearProgress,this._canStack=!0}}yZ.type="linearProgress",yZ.seriesType=dB.linearProgress,yZ.transformerConstructor=_Z;class bZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),cH(t)}}class xZ extends pW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="rangeColumn",this.seriesType=dB.rangeColumn}}xZ.type="rangeColumn",xZ.seriesType=dB.rangeColumn,xZ.transformerConstructor=bZ;class SZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class AZ extends pW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="rangeColumn3d",this.seriesType=dB.rangeColumn3d}}AZ.type="rangeColumn3d",AZ.seriesType=dB.rangeColumn3d,AZ.transformerConstructor=SZ;class kZ extends mW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:RB,i=p(t.endAngle)?t.endAngle:e+te(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=dB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class MZ extends pW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="sunburst",this.seriesType=dB.sunburst}}MZ.type="sunburst",MZ.seriesType=dB.sunburst,MZ.transformerConstructor=kZ;class TZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=dB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wZ extends pW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="circlePacking",this.seriesType=dB.circlePacking}}wZ.type="circlePacking",wZ.seriesType=dB.circlePacking,wZ.transformerConstructor=TZ;class CZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class EZ extends pW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="treemap",this.seriesType=dB.treemap}}EZ.type="treemap",EZ.seriesType=dB.treemap,EZ.transformerConstructor=CZ;class PZ extends HW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),cH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class BZ extends NW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="waterfall",this.seriesType=dB.waterfall}}BZ.type="waterfall",BZ.seriesType=dB.waterfall,BZ.transformerConstructor=PZ;class RZ extends fW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),cH(t)}}class LZ extends pW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="boxPlot",this.seriesType=dB.boxPlot}}LZ.type="boxPlot",LZ.seriesType=dB.boxPlot,LZ.transformerConstructor=RZ;class OZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IZ extends pW{constructor(){super(...arguments),this.transformerConstructor=OZ,this.type="sankey",this.seriesType=dB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}IZ.type="sankey",IZ.seriesType=dB.sankey,IZ.transformerConstructor=OZ;class DZ extends fW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),cH(t)}}class FZ extends pW{constructor(){super(...arguments),this.transformerConstructor=DZ,this.type="rangeArea",this.seriesType=dB.rangeArea}}FZ.type="rangeArea",FZ.seriesType=dB.rangeArea,FZ.transformerConstructor=DZ;class jZ extends fW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class zZ extends pW{constructor(){super(...arguments),this.transformerConstructor=jZ,this.type="heatmap",this.seriesType=dB.heatmap}}zZ.type="heatmap",zZ.seriesType=dB.heatmap,zZ.transformerConstructor=jZ;class HZ extends mW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=dB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class NZ extends pW{constructor(){super(...arguments),this.transformerConstructor=HZ,this.type="correlation",this.seriesType=dB.correlation}}NZ.type="correlation",NZ.seriesType=dB.correlation,NZ.transformerConstructor=HZ;function VZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mz(t.style)),B(t.textStyle)||Rj(s.textStyle,mz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mz(s.background.style),s}const GZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},WZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:kD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class UZ extends GG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=ZF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new GH(this._option,e),this._initSelectedData(),oB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(oB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Rj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Rj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}UZ.specKey="legends";class YZ extends UZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Gz(this._option.dataSet,"discreteLegendFilter",WZ),Gz(this._option.dataSet,"discreteLegendDataMake",GZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return oB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!lb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iz(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=VZ(s)),B(n.focusIconStyle)||mz(n.focusIconStyle),n.shape&&(n.shape=uz(n.shape)),n.label&&(n.label=uz(n.label)),n.value&&(n.value=uz(n.value)),n.background&&(n.background=uz(n.background)),JF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),JF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),JF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mz(r.railStyle),B(r.sliderStyle)||mz(r.sliderStyle)):(B(r.textStyle)||mz(r.textStyle),r.handler&&uz(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Rj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return fP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(hP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(hP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(hP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=RN(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=RN(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}YZ.specKey="legends",YZ.type=r.discreteLegend;const KZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},XZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function $Z(t){return"color"===t||"size"===t}const qZ={color:xP,size:AP},ZZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],JZ=[2,10];class QZ extends UZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return $Z(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{$Z(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),oB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:eH.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Gz(this._option.dataSet,"continuousLegendFilter",XZ),Gz(this._option.dataSet,"continuousLegendDataMake",KZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>lB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iz(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!lb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iz(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?ZZ:JZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Rj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=VZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=mz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=mz(r.style)),B(a.style)||(w.trackStyle=mz(a.style)),w.startText=uz(o),w.endText=uz(l),w.handlerText=uz(h),B(c)||(w.sizeBackground=mz(c)),d.visible&&!B(d.style)&&(Rj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return qZ[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}QZ.specKey="legends",QZ.type=r.continuousLegend;class tJ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Lz(n,a,!0))&&void 0!==e?e:[],...null!==(i=xz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Gw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=hV(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=hV(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(_V(s).every((t=>{var e;return!hV(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=hV(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=fV(t,i,s),m=vV(t,i,s),f=Rj({},I(e[t]),m),v=g.title,_=bV(void 0,f,u.shape,void 0,v);p(f.title)?f.title=gV(f.title,Object.assign(Object.assign({},v),_)):f.title=gV(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=yV(y);f.content=mV(f.content,(e=>bV(e,f,u.shape,t)))}else f.content=mV(y,(t=>bV(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=wV(a,t,e),l=!!p(o)&&!1!==SV(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class eJ extends tJ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class iJ extends tJ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class sJ extends tJ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const nJ=t=>p(t)&&!y(t),rJ=t=>p(t)&&y(t);class aJ extends VG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=Rj({},this._theme,s.style),s.offset=Rj({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=hV(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:nb(this._option.mode)||!ib(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=L_.getElementById(t.parentElement)):ib(this._option.mode)&&(t.parentElement=null==eb?void 0:eb.body)}}class oJ extends GG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=aJ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=ib(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(this._clickLock)return void(t&&(this._handleChartMouseOut(e),this._clickLock=!1));const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&nJ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&rJ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||this._handleChartMouseOut(e)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(this._timer&&clearTimeout(this._timer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._timer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&hN.globalConfig.uniqueTooltip&&l&&hN.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._timer&&clearTimeout(this._timer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?AV.canvas:AV.dom,n=fz.getComponentPluginInType(t);n||Jy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new iJ(this),dimension:new eJ(this),group:new sJ(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(sb(i)||nb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=oV(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(rJ(t)){if(nJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>vz(t,e[i])))))return!1}else{if(rJ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&ii(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}oJ.type=r.tooltip,oJ.transformerConstructor=aJ,oJ.specKey="tooltip";var lJ,hJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(lJ||(lJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(hJ||(hJ={}));const cJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class dJ extends GG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:sb(e)||nb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{cJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){Sz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Az(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=hB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=WN(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=KN(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=XN(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new mT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new fT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new iT(e)),null==s||s.add(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}uJ.specKey="crosshair",uJ.type=r.cartesianCrosshair;class pJ extends dJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{Gw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:$t.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=hB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Rj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=ON(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=ON(s.getSpec())),c.angle=a.angle,c.axis=s,Rj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=RN(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=RN(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:ie(o,s,i),end:ie(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new mT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new _T(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ne(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},ie(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=se(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=ie(t,r,p),f=ie(t,r,g),v=Be([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=ft($t.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new yT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new vT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ne(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},ie(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new iT(e),null==s||s.add(t),i(t)),VN(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}pJ.specKey="crosshair",pJ.type=r.polarCrosshair;const gJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},mJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class fJ extends GG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else oB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),oB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=ft(this._start+g,0,1),v=ft(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Rt(s/n)>=.5:Rt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=Mz(t),this._isHorizontal="horizontal"===Tz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(Nw(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};oB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=Nw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else oB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Wz(s,"dataview",pa),Gz(s,"dataFilterComputeDomain",mJ);const n=new _a(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new GH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(Nw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&Nw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Nw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new cC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Gz(this._option.dataSet,"dataFilterWithNewDomain",gJ),oB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>Nw(this._stateScale.type)},level:eH.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&Gw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,Gw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(fJ,MU);class vJ extends VG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Rj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class _J extends fJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=vJ,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new BC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Nw(t.type)||e[0]!==e[1])&&(!Gw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new hE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mz(g.style)},selectedBackgroundStyle:mz(this._spec.selectedBackground.style),dragMaskStyle:mz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Rj(mz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Rj(mz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=RN(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}_J.type=r.dataZoom,_J.transformerConstructor=vJ,_J.specKey="dataZoom";class yJ extends fJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new LM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=QP(this._start,e)&&QP(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}yJ.type=r.scrollBar,yJ.specKey="scrollBar";const bJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class xJ extends GG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==xJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Gz(this._option.dataSet,"indicatorFilter",bJ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new GH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Rj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gz(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?sj(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?sj(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},gz(H(this._spec.title.style,["text"]),this._activeDatum)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new TP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}xJ.type=r.indicator,xJ.specKey="indicator";const SJ=["sum","average","min","max","variance","standardDeviation","median"];function AJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function kJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&AJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=JF(t.x)?CJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function MJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&AJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=JF(t.y)?CJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function TJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&AJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function wJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&AJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function CJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function EJ(t){return SJ.includes(t)}function PJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=kJ(t,m,n,d,h,a),i=MJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=kJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=MJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function BJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=TJ(t,l,n,r),i=wJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=TJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=wJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function RJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=JF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=JF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&AJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&AJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function LJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&AJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&AJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function OJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=CJ(e,r)),e+=s,JF(i)&&(i=CJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return JF(e)&&(e=CJ(e,s)),JF(i)&&(i=CJ(i,n)),{x:e,y:i}}))}function IJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function DJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},mz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},jJ(mz(s.style),i)),p(s.padding)&&(t.padding=ti(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=jJ(mz(n),i)),t}return{visible:!1}}function FJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function jJ(t,e){return d(t)?t(e):t}function zJ(t,e){return d(t)?t(e):t}function HJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function NJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function VJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function GJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function WJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>YJ(i,t,e))):s.x=YJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>YJ(i,t,e))):s.y=YJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>YJ(i,t,e))):s.angle=YJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>YJ(i,t,e))):s.radius=YJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=YJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const UJ={min:(t,e)=>tB(t[0].latestData,e.field),max:(t,e)=>eB(t[0].latestData,e.field),sum:function(t,e){return iB(t[0].latestData,e.field)},average:function(t,e){return sB(t[0].latestData,e.field)},variance:function(t,e){return nB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(nB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function YJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return UJ[i](e,{field:s})}return t}class KJ extends GG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&EJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&EJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&EJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&EJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&EJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new fa;return e.registerParser("array",s),new _a(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=hB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=QF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function XJ(t,e){return function(t,e,i){const{predict:s}=xb(t,(t=>t[e]),(t=>t[i])),n=tB(t,e),r=eB(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function $J(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class qJ extends KJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=NJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:jJ(mz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:DJ(y,this._markerData),state:{line:FJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:FJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:FJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:FJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:FJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:mz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:mz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=IJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=NJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Gz(this._option.dataSet,"markerAggregation",WJ),Gz(this._option.dataSet,"markerRegression",XJ),Gz(this._option.dataSet,"markerFilter",$J);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new _a(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}qJ.specKey="markLine";class ZJ extends qJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=NJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=PJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=RJ(i,r,d,e.coordinatesOffset):c&&(y=OJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(JF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=NJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}ZJ.type=r.markLine,ZJ.coordinateType="cartesian";class JJ extends qJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=NJ(this._spec);return e||i?new JE(t):new $E(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=NJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=BJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>ie(m,t.radius,t.angle)))}}else u&&(p=LJ(i,r,a),g={points:p.map((t=>ie(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=NJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}JJ.type=r.polarMarkLine,JJ.coordinateType="polar";class QJ extends GG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=ZF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new kP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}QJ.type=r.title,QJ.specKey=r.title;class tQ extends KJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=VJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:jJ(mz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:DJ(u,this._markerData),state:{area:FJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:FJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:FJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=IJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=VJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Gz(this._option.dataSet,"markerAggregation",WJ),Gz(this._option.dataSet,"markerFilter",$J);const c=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}tQ.specKey="markArea";class eQ extends tQ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=VJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=PJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=PJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=RJ(i,r,d,e.coordinatesOffset):c&&(u=OJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=VJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}eQ.type=r.markArea,eQ.coordinateType="cartesian";class iQ extends tQ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=VJ(this._spec);return i||e||s?new QE(t):new ZE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=VJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=BJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=LJ(i,r,c),u={points:d.map((t=>ie(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=VJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}iQ.type=r.polarMarkArea,iQ.coordinateType="polar";const sQ=t=>mz(Object.assign({},t)),nQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mz(t.style))}),rQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=sQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=sQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mz(Object.assign({},y)));var y;const b=nQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=nQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=nQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=nQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},aQ=t=>"left"===t||"right"===t,oQ=t=>"top"===t||"bottom"===t;class lQ extends GG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},rQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},rQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new HP(t):this._playerComponent=new GP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=aQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=aQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(OP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(OP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=aQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=oQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):aQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):oQ(this._orient)?this._maxSize():t.height}_computeDx(t){return aQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return oQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}lQ.specKey="player",lQ.type=r.player;class hQ extends GG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}hQ.type=r.label;class cQ extends cY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}cQ.type="text",cQ.constructorType="label";const dQ=()=>{fz.registerMark(cQ.constructorType,cQ),SO()};class uQ extends VG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class pQ extends hQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=uQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),oB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Rj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=UU[t])&&void 0!==i?i:UU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:YU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}pQ.type=r.label,pQ.specKey="label",pQ.transformerConstructor=uQ;class gQ extends hQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[OD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Rj({textStyle:{pickable:!0===this._spec.interactive},position:mQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[DD]))},a))}})).encode((e=>YU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function mQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}gQ.type=r.totalLabel,gQ.specKey="totalLabel";class fQ extends KJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=GJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:zJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:zJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:jJ(B.style,this._markerData)},state:{line:FJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:FJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:FJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:FJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:FJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:FJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:FJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:FJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:FJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:FJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=mz(jJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=jJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=DJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=jJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mz(z.style)}):{visible:!1};return new eP(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=IJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:HJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:HJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=GJ(t);if(!(p(t.coordinate)||e||i||s))return;Gz(this._option.dataSet,"markerAggregation",WJ),Gz(this._option.dataSet,"markerFilter",$J);const{options:n}=this._computeOptions(),r=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}fQ.specKey="markPoint";class vQ extends fQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=PJ(i,s,s,s,o)[0][0]:r?l=RJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=OJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=GJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}vQ.type=r.markPoint,vQ.coordinateType="cartesian";class _Q extends fQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=BJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ie({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}_Q.type=r.polarMarkPoint,_Q.coordinateType="polar";class yQ extends fQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}yQ.type=r.geoMarkPoint,yQ.coordinateType="geo";const bQ="inBrush",xQ="outOfBrush";class SQ extends GG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),bQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),xQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new KP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(NP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(NP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,xQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(NP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(NP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(NP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(bQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(bQ),i.addState(xQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(bQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(bQ),i.addState(xQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],qe(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],qe(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(bQ),i.removeState(xQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}SQ.type=r.brush,SQ.specKey="brush";class AQ extends GG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${pB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=fG({},vG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Zt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Zt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}AQ.type=r.customMark,AQ.specKey="customMark";function kQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function MQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function TQ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:MQ(t.rect),anchorCandidates:RQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>kQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tkQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function wQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=We(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=PQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=hi(r,s,i);if(!PQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],CQ(EQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=CQ(EQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=BQ(t.rect,a,0),t}));return TQ(h)}function CQ(t){return t>180?t-360:t}function EQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function PQ(t,e){for(let i=0;i{const{x:r,y:a}=BQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class LQ extends GG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new _a(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:eH.copyDataView},!1),this._data=new GH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new eP({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=ej(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=wu({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Eg(mz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Ag(mz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=_p(mz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=_p(mz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=BQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):TQ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}LQ.type=r.mapLabel,LQ.specKey="mapLabel";class OQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>IQ(t))),a=n.filter((t=>!IQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>IQ(t))),h=o.filter((t=>!IQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function IQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}OQ.type="grid";hN.useRegisters([()=>{aI(),oI(),OG(),FG(),sN(),tN(),rW(),iW(),fz.registerSeries(hW.type,hW),fz.registerChart(_W.type,_W)},()=>{aI(),oI(),OG(),bW(),FG(),SW(),rW(),iW(),fz.registerSeries(kW.type,kW),fz.registerChart(TW.type,TW)},()=>{zW(),fz.registerChart(NW.type,NW)},()=>{tU(),fz.registerChart(iU.type,iU)},()=>{NY(),fz.registerChart(Uq.type,Uq)},()=>{rK(),fz.registerChart($q.type,$q)},()=>{pK(),fz.registerChart(Zq.type,Zq)},()=>{zW(),fz.registerChart(sZ.type,sZ)},()=>{BU(),fz.registerChart(zq.type,zq)},()=>{cq(),fz.registerSeries(uq.type,uq),IY(),kK(),eK(),fz.registerChart(lZ.type,lZ)},()=>{pX(),fz.registerChart(uZ.type,uZ)},()=>{LX(),fz.registerChart(fZ.type,fZ)},()=>{iY(),fz.registerChart(BZ.type,BZ)},()=>{lY(),FG(),tN(),rW(),iW(),fz.registerSeries(hY.type,hY),fz.registerChart(LZ.type,LZ)},()=>{fz.registerSeries(TK.type,TK),IY(),kK(),eN(),sK(),eK(),fz.registerChart(aZ.type,aZ)},()=>{LK(),fz.registerChart(yZ.type,yZ)},()=>{bY(),fz.registerChart(xZ.type,xZ)},()=>{bW(),rW(),iW(),fz.registerSeries(AY.type,AY),fz.registerChart(FZ.type,FZ)},()=>{T$(),fz.registerChart(MZ.type,MZ)},()=>{B$(),fz.registerChart(wZ.type,wZ)},()=>{rq(),fz.registerChart(EZ.type,EZ)},()=>{Q$(),fz.registerChart(IZ.type,IZ)},()=>{yq(),fz.registerChart(zZ.type,zZ)},()=>{Eq(),fz.registerChart(NZ.type,NZ)},()=>{fz.registerChart(Qq.type,Qq)},iW,rW,()=>{XG(),fz.registerComponent(aW.type,aW)},()=>{XG(),fz.registerComponent(oW.type,oW)},()=>{XG(),fz.registerComponent(lW.type,lW)},sK,eK,()=>{fz.registerComponent(YZ.type,YZ)},()=>{fz.registerComponent(QZ.type,QZ)},()=>{fz.registerComponent(oJ.type,oJ)},()=>{fz.registerComponent(uJ.type,uJ)},()=>{fz.registerComponent(pJ.type,pJ)},()=>{fz.registerComponent(_J.type,_J)},()=>{fz.registerComponent(yJ.type,yJ)},()=>{fz.registerComponent(xJ.type,xJ)},CU,()=>{fz.registerComponent(ZJ.type,ZJ),XE()},()=>{fz.registerComponent(eQ.type,eQ),qE()},()=>{fz.registerComponent(vQ.type,vQ),tP()},()=>{fz.registerComponent(JJ.type,JJ),JE._animate=PE,XE()},()=>{fz.registerComponent(iQ.type,iQ),QE._animate=RE,qE()},()=>{fz.registerComponent(_Q.type,_Q),tP()},()=>{fz.registerComponent(yQ.type,yQ),tP()},()=>{fz.registerComponent(QJ.type,QJ)},()=>{fz.registerComponent(lQ.type,lQ)},()=>{WO(),dQ(),UG(),fz.registerComponent(pQ.type,pQ,!0)},()=>{WO(),dQ(),UG(),fz.registerComponent(gQ.type,gQ,!0)},()=>{fz.registerComponent(SQ.type,SQ)},()=>{fz.registerComponent(AQ.type,AQ)},()=>{fz.registerComponent(LQ.type,LQ)},()=>{Ql.load(pT)},()=>{fz.registerLayout(OQ.type,OQ)},eG,qR,$R]),hN.useRegisters([()=>{PA(Ql)}]),t.ARC_END_ANGLE=MB,t.ARC_K=TB,t.ARC_MIDDLE_ANGLE=wB,t.ARC_QUADRANT=CB,t.ARC_RADIAN=EB,t.ARC_RATIO=AB,t.ARC_START_ANGLE=kB,t.ARC_TRANSFORM_VALUE=SB,t.AxisSyncPlugin=TN,t.BASE_EVENTS=pD,t.CORRELATION_SIZE=bD,t.CORRELATION_X=_D,t.CORRELATION_Y=yD,t.CanvasTooltipHandler=tG,t.DEFAULT_CHART_HEIGHT=mB,t.DEFAULT_CHART_WIDTH=gB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=WD,t.DEFAULT_DATA_INDEX=SD,t.DEFAULT_DATA_KEY=AD,t.DEFAULT_DATA_SERIES_FIELD=kD,t.DEFAULT_GRADIENT_CONFIG=UD,t.DEFAULT_LABEL_ALIGN=vB,t.DEFAULT_LABEL_LIMIT=fB,t.DEFAULT_LABEL_TEXT=_B,t.DEFAULT_LABEL_VISIBLE=yB,t.DEFAULT_LABEL_X=bB,t.DEFAULT_LABEL_Y=xB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=VD,t.DEFAULT_MEASURE_CANVAS_ID=xD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=GD,t.DEFAULT_SERIES_STYLE_NAME=MD,t.DomTooltipHandler=QV,t.Factory=fz,t.FormatterPlugin=_N,t.GradientType=ND,t.MediaQuery=gN,t.POLAR_DEFAULT_RADIUS=LB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=BB,t.POLAR_START_ANGLE=RB,t.POLAR_START_RADIAN=PB,t.PREFIX=pB,t.SEGMENT_FIELD_END=jD,t.SEGMENT_FIELD_START=FD,t.STACK_FIELD_END=ED,t.STACK_FIELD_END_OffsetSilhouette=LD,t.STACK_FIELD_END_PERCENT=BD,t.STACK_FIELD_KEY=wD,t.STACK_FIELD_START=CD,t.STACK_FIELD_START_OffsetSilhouette=RD,t.STACK_FIELD_START_PERCENT=PD,t.STACK_FIELD_TOTAL=OD,t.STACK_FIELD_TOTAL_PERCENT=ID,t.STACK_FIELD_TOTAL_TOP=DD,t.ThemeManager=qj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=hN,t.WaterfallDefaultSeriesField=vD,t.builtinThemes=zj,t.computeActualDataScheme=zF,t.darkTheme=Mj,t.dataScheme=nj,t.default=hN,t.defaultThemeName=Hj,t.getActualColor=NF,t.getColorSchemeBySeries=UF,t.getDataScheme=jF,t.getMergedTheme=Xj,t.getTheme=Uj,t.hasThemeMerged=Gj,t.isColorKey=VF,t.isProgressiveDataColorScheme=GF,t.isTokenKey=Sj,t.lightTheme=kj,t.queryColorFromColorScheme=HF,t.queryToken=xj,t.registerCanvasTooltipHandler=eG,t.registerChartPlugin=pN,t.registerDomTooltipHandler=()=>{JV(QV)},t.registerFormatPlugin=()=>{pN(_N)},t.registerMediaQuery=()=>{pN(gN)},t.registerTheme=Wj,t.removeTheme=Yj,t.themeExist=Kj,t.themes=Nj,t.token=Aj,t.transformColorSchemeToStandardStruct=WF,t.version="1.11.12",t.vglobal=L_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index 35eaaf73a2..7b8faf9473 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "1.11.11", + "version": "1.11.12", "description": "", "main": "index.js", "miniprogram": ".", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index 4156bd2834..b88363277f 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -58,7 +58,7 @@ "dependencies": { "@visactor/vrender-core": "0.19.24", "@visactor/vrender-kits": "0.19.24", - "@visactor/vchart": "workspace:1.11.11", + "@visactor/vchart": "workspace:1.11.12", "@visactor/vrender": "0.19.24", "@visactor/vutils": "~0.18.10" }